Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

oscommerce suddenly running very slow?


FWR Media

Recommended Posts

I identified today the main reason that my oscommerce sites had become very slow loading so below is the solution in the hope that it helps someone.

 

Do I have this problem?

Check the images on non secure pages, if they are loading as https then you have the same problem. Also viewing source will show that the base href for non secure pages is https.

 

 

 

In catalog/includes/application_top.php the following line sets the request type SSL or not.

 

// set the type of request (secure or not)

$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

 

For whatever reason my server was always returning ON even when not an SSL request.

 

This causes the base href of non secure pages to be https and causes ALL images to load as https://www.mysite.com/thisimage.php causing massive slowdown.

 

Changing the line to ...

 

// set the type of request (secure or not)

$request_type = (getenv('SERVER_PORT') == '443') ? 'SSL' : 'NONSSL';

 

Works, at least on my server.

 

Hope this helps someone.

Link to comment
Share on other sites

  • 1 month later...

it is also necessary to make this change in ...

 

catalog/includes/functions/general.php

 

tep_redirect

 

if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

 

change to

 

if ( (ENABLE_SSL == true) && (getenv('SERVER_PORT') == '443') ) { // We are loading an SSL page

Link to comment
Share on other sites

  • 2 years later...
  • 6 months later...
  • 6 months later...

I too was struggling with this. SSL was not my problem, it was a poorly optimized mysql. top showed mysqld was continusouly pegged at 100%+ sometimes almost 200% and response time was dreadfully. slow. Google clocked us at an average 11.9 seconds per page, some pages taking more than 30 seconds to load. For an ecommerce site, that kind of response is death. I tried the SSL trick, but found our pages were not loading https until checkout (which is what you want). It was clear that mysql was the problem. I tried optimizing all of the tables (I wrote a short php script to do this) but no joy. Then I thought perhaps I had a semaphore problem with ibdata - according to SHOW ENGINE INNODB STATUS that was most likely not the case. Then I sat and watched what queries were exactly being executed using SHOW FULL PROCESSLIST repeatedly and using copy and paste executing those queries so I could see how long they were taking. Any query that took longer than .5 seconds (some were over 10 seconds!) grabbed my attention. I noted from the query all of the fields that were either involved in a JOIN or WHERE clause and made sure that field had an index created for it in the appropriate tables. I ended up creating about 10 indexes that were not already present and now my site flies. Well, as much as can be expected for a site with 8000+ products and 350+ categories utilizing most of the features available (visit www.pilotshop.com for details). If there was a better way, I'd like to hear it.

Tom

Link to comment
Share on other sites

  • 3 weeks later...

I too was struggling with this. SSL was not my problem, it was a poorly optimized mysql. top showed mysqld was continusouly pegged at 100%+ sometimes almost 200% and response time was dreadfully. slow. Google clocked us at an average 11.9 seconds per page, some pages taking more than 30 seconds to load. For an ecommerce site, that kind of response is death. I tried the SSL trick, but found our pages were not loading https until checkout (which is what you want). It was clear that mysql was the problem. I tried optimizing all of the tables (I wrote a short php script to do this) but no joy. Then I thought perhaps I had a semaphore problem with ibdata - according to SHOW ENGINE INNODB STATUS that was most likely not the case. Then I sat and watched what queries were exactly being executed using SHOW FULL PROCESSLIST repeatedly and using copy and paste executing those queries so I could see how long they were taking. Any query that took longer than .5 seconds (some were over 10 seconds!) grabbed my attention. I noted from the query all of the fields that were either involved in a JOIN or WHERE clause and made sure that field had an index created for it in the appropriate tables. I ended up creating about 10 indexes that were not already present and now my site flies. Well, as much as can be expected for a site with 8000+ products and 350+ categories utilizing most of the features available (visit www.pilotshop.com for details). If there was a better way, I'd like to hear it.

Tom

 

Hi, Im getting similar problems with my site loading. I have over 12000 products can you shed some light on to achieve faster loading time. www.desirablescents.biz

Link to comment
Share on other sites

  • 2 weeks later...

I too was struggling with this. SSL was not my problem, it was a poorly optimized mysql. top showed mysqld was continusouly pegged at 100%+ sometimes almost 200% and response time was dreadfully. slow. Google clocked us at an average 11.9 seconds per page, some pages taking more than 30 seconds to load. For an ecommerce site, that kind of response is death. I tried the SSL trick, but found our pages were not loading https until checkout (which is what you want). It was clear that mysql was the problem. I tried optimizing all of the tables (I wrote a short php script to do this) but no joy. Then I thought perhaps I had a semaphore problem with ibdata - according to SHOW ENGINE INNODB STATUS that was most likely not the case. Then I sat and watched what queries were exactly being executed using SHOW FULL PROCESSLIST repeatedly and using copy and paste executing those queries so I could see how long they were taking. Any query that took longer than .5 seconds (some were over 10 seconds!) grabbed my attention. I noted from the query all of the fields that were either involved in a JOIN or WHERE clause and made sure that field had an index created for it in the appropriate tables. I ended up creating about 10 indexes that were not already present and now my site flies. Well, as much as can be expected for a site with 8000+ products and 350+ categories utilizing most of the features available (visit www.pilotshop.com for details). If there was a better way, I'd like to hear it.

Tom

 

Hi Tom,

 

I have visited your site and I can tell that you've done a terrific job on optimization. I have been trying to do the same with indexing all intensively used table joins and I will eventually have over 180K items on our site, in which 60K will be in stock and available. Now aside from us using a heavily modded Year/Make/Model lookup, the site is pretty much stock and it loads decent on FireFox, Chrome & Safari...however in Internet Explorer (using 8), it loads very slow and I cannot figure out why.

 

Do you know of any ideas to help?

 

 

Thank you!

 

 

PS: Excellent site you got there. I will recommend it to a friend of the family, as he is a pilot for American Airlines...

 

-Chris

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...