Page 1 of 2

Extreme Slowness - Suggestions?

Posted: Fri Jul 16, 2010 11:19 pm
by tkambler
I've recently finished installing OpenCart. I now have a product database consisting of 80,000 products. The site is suffering from extreme slowness, as in taking one minute or more to simply load the home page.

Can anyone provide some insight, recommendations, etc... for a way to fix this? Anyone else faced this problem?

Thanks!

Re: Extreme Slowness - Suggestions?

Posted: Fri Jul 16, 2010 11:37 pm
by JAY6390
Opencart isn't really designed for holding such large amounts of products

My biggest question for you is what hosting do you have? shared, vps, or dedicated?

Re: Extreme Slowness - Suggestions?

Posted: Fri Jul 16, 2010 11:53 pm
by fido-x
tkambler wrote:I've recently finished installing OpenCart. I now have a product database consisting of 80,000 products.
Wow! 80,000 products. Great testament for OpenCart!
JAY6390 wrote:Opencart isn't really designed for holding such large amounts of products
Probably more a case of "no-one expected OpenCart could hold so many products", than a design issue.
JAY6390 wrote:My biggest question for you is what hosting do you have? shared, vps, or dedicated?
I agree. This is the REAL issue! Using a dedicate host should speed things up.

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 12:23 am
by JAY6390
Yeah even stores with smaller amounts like 10,000 should be on dedicated. OC needs some major tweaking in a few areas when it comes to queries for the database, and processing results

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 1:53 am
by Xsecrets
how many categories? I see no reason why opencart couldn't handle that many products. There are two performance bottle necks that I know of.
1) if you have lots of categories the categories dropdown next to the search can slow things down. you can try removing this.
and
2) add indexes to product_id in product_special, product_review, and product_discount tables. the site where I saw this problem it was mostly from the specials box. I disabled the specials box and the site sped up tremendously, so if you disable specials and the site speeds up try adding the indexes, you'll most likely need them anyways with that many products.

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 5:50 am
by tkambler
Thanks for all of the input, everyone. To answer your questions...

Dedicated hosting. Quad core, 2.4GHz, 4GB Ram, etc...

And yes, there are a ton of categories. 841 to be exact.

Xsecrets: I will followup on your recommendation to add indexes and perhaps hard-code the category drop-down by the search box and get back to you.

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 5:55 am
by JAY6390
You could just cache it instead of hard coding it

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 6:02 am
by tkambler
A little bit of background... You would not believe how much time I spent perfecting a process that would allow me to import all of our product data, options, etc... into Magento. But by the time I had finally gotten it done, Magento became incredibly slow. Completely, unusably slow.

After taking one look at OP's db schema, I was able to put together an import process within 30 minutes. The same process for Magento took 12+ hours.

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 6:13 am
by JAY6390
Yeah Magento is a bit of a nightmare, and extremely cpu intensive

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 11:14 am
by Xsecrets
well let us know how it goes. Like I said there may be some bottlenecks here and there, but opencart shouldn't be too hard to make work very quickly with this number of products.

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 2:56 pm
by i2Paq
I know that there are issues when you have the search option in your header.

I've got the following from zrxraver over on the Dutch forums:

Caching of categories:

in catalog/controller/common/header.php

Find:

Code: Select all

$this->data['categories'] = $this->getCategories(0);
  
Replace by:

Code: Select all

    $category_tree_data = $this->cache->get('categories.0');
        if(!$category_tree_data) {
          $category_tree_data = $this->getCategories(0);
          $this->cache->set('categories.0', $category_tree_data);
        }
        $this->data['categories'] = $category_tree_data;
  

in catalog/controller/product/search.php

Find :

Code: Select all

$this->data['categories'] = $this->getCategories(0);        
  
Replace by:

Code: Select all

        $category_tree_data = $this->cache->get('categories.0');
        if(!$category_tree_data) {
          $category_tree_data = $this->getCategories(0);
          $this->cache->set('categories.0', $category_tree_data);
        }
        $this->data['categories'] = $category_tree_data;
  
in system/cache/ you will find a file called cache.categories.0.....

Disclaimer: Use this at your own risk, I have not tested this myself (yet).

Re: Extreme Slowness - Suggestions?

Posted: Sat Jul 17, 2010 8:32 pm
by JAY6390
You will of course need to delete the cache when you edit any of the category items

Re: Extreme Slowness - Suggestions?

Posted: Wed Jul 21, 2010 2:16 pm
by tkambler
OK, I have tried all of these suggestions, and it does seem to have helped. My category and product pages now load very quickly. Basically everything loads very fast with the exception of the home page. The home page regularly takes upwards of 20 seconds to load.

Can anyone provide any insight into what may be happening specifically on the home page that is causing OpenCart to slow down so badly with so many products?

Thank you for all your help!

Re: Extreme Slowness - Suggestions?

Posted: Wed Jul 21, 2010 9:03 pm
by Xsecrets
if everthing loads quickly but the homepage I would disable any module that you have set to the home position one by one and check each time to see if it speeds up. If you can pinpoint it to a module then we can go from there.

Re: Extreme Slowness - Suggestions?

Posted: Wed Jul 21, 2010 9:22 pm
by Qphoria
I will add the category dropdown cache to 1.4.9

Re: Extreme Slowness - Suggestions?

Posted: Fri Sep 24, 2010 1:36 pm
by maxmas
Qphoria wrote:I will add the category dropdown cache to 1.4.9
Hi Qphoria,

You did not add the category dropdown cache to 1.4.9.1.
Do you forgot it?

Re: Extreme Slowness - Suggestions?

Posted: Sun Oct 17, 2010 11:55 am
by 123adk
How do i add indexes to speed up the loading of my opencart website?

Re: Extreme Slowness - Suggestions?

Posted: Tue Jun 28, 2011 6:42 am
by tuba
Hi All,
I wonder if anyone used open cart with more categories? I have 6000 categories and the site just dies... loads so slow that it can not be used.
You wonder why I have 6000 categories? Well simple:
Car Store:
>>Car brand BMW
>>SUBCATS BMW 1 BMW 2 etc..
SUBSUBCATS Breaks, Parts etc 20 of them
So you can easily run up to 6-10000 categories at which it seems open cart can not work. Or is there anyone who has so many categories and the site still works?

Re: Extreme Slowness - Suggestions?

Posted: Thu Aug 25, 2011 5:54 pm
by naugtur
I work with a team and we build an OpenCart based solution that requires about 10000 categories. See my post in

"What is the largest shop so far, any scaling issues?" http://forum.opencart.com/viewtopic.php ... 54#p189354

Re: Extreme Slowness - Suggestions?

Posted: Tue Mar 06, 2012 9:30 am
by chrisg42
We're running OpenCart with 32,000 products in 63 categories.

The extreme slowness for us came from all the calls to getTotalProducts to display the total products in each category. After removing these calls the page load time became reasonable (about 2 secs).

In catalog/controller/common/header.php
search for

Code: Select all

					$product_total = $this->model_catalog_product->getTotalProducts($data);
									
					$children_data[] = array(
						'name'  => $child['name'] . ' (' . $product_total . ')',
						'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
					);	
and replace with

Code: Select all

					$children_data[] = array(
						'name'  => $child['name'],
						'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
					);	
and in catalog/controller/module/category.php

Code: Select all

$product_total = $this->model_catalog_product->getTotalProducts($data);
							
				$children_data[] = array(
					'category_id' => $child['category_id'],
					'name'        => $child['name'] . ' (' . $product_total . ')',
					'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
				);

and replace with

Code: Select all

$children_data[] = array(
					'category_id' => $child['category_id'],
					'name'        => $child['name'],
					'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
				);
and also in catalog/controller/module/category.php search for

Code: Select all

$product_total = $this->model_catalog_product->getTotalProducts($data);
						
			$this->data['categories'][] = array(
				'category_id' => $category['category_id'],
				'name'        => $category['name'] . ' (' . $product_total . ')',
				'children'    => $children_data,
				'href'        => $this->url->link('product/category', 'path=' . $category['category_id'])
			);
replace with

Code: Select all

$this->data['categories'][] = array(
				'category_id' => $category['category_id'],
				'name'        => $category['name'],
				'children'    => $children_data,
				'href'        => $this->url->link('product/category', 'path=' . $category['category_id'])
			);
If you have heaps of categories adding an index to category.parent_id will also help to speed things up.