Post by AndyGaskell » Fri Mar 19, 2010 4:35 pm

Shame that didn't work. I know some hosts put a hard cap on these things, perhaps you're hitting that. I've used OpenCart on the web hosts Canaca, and they had unmovable caps on memory and execution.

I'm a web developer at http://www.ssofb.co.uk in Aberdeen, Scotland.
Got a random blog at http://www.andygaskell.blogspot.com/.


User avatar
New member

Posts

Joined
Thu Dec 10, 2009 3:59 am
Location - Aberdeen UK

Post by AndyGaskell » Wed Mar 24, 2010 6:58 pm

I've just noticed something with the big shop I'm working on just now, which I thought might be useful generally, so good to share.

I'd noticed slow loading times on my host's server, but ok loading times on my local dev server. The shop is about to go live so I thought I'd better have a look into. The shop has 18,000 products in ~300 categories, and the home page was taking sometimes 10 seconds to load, with only 10% of this being download time. The HTML sent to the user was 73KB, so a fair size, but not huge. Anyway, I've got the search module enabled, and that was generating quite a lot of HTML, as the "Search in a category:" select in the search module was creating and <option> for each category. Anyway, just as a test, I removed the category code from catalog/view/theme/mytemplate/template/module/search.tpl and catalog/controller/module/search.php, and the load times went down to 2-3 seconds, which is much better. HTML code is now 43KB, so that's better too.

This is OC 1.4.0, if I mention the name of the host, I think I'll get flamed, so I'll keep quiet on that one :)

I'm a web developer at http://www.ssofb.co.uk in Aberdeen, Scotland.
Got a random blog at http://www.andygaskell.blogspot.com/.


User avatar
New member

Posts

Joined
Thu Dec 10, 2009 3:59 am
Location - Aberdeen UK

Post by caspara » Fri Mar 26, 2010 4:36 am

AndyGaskell wrote:I've just noticed something with the big shop I'm working on just now, which I thought might be useful generally, so good to share.

I'd noticed slow loading times on my host's server, but ok loading times on my local dev server. The shop is about to go live so I thought I'd better have a look into. The shop has 18,000 products in ~300 categories, and the home page was taking sometimes 10 seconds to load, with only 10% of this being download time. The HTML sent to the user was 73KB, so a fair size, but not huge. Anyway, I've got the search module enabled, and that was generating quite a lot of HTML, as the "Search in a category:" select in the search module was creating and <option> for each category. Anyway, just as a test, I removed the category code from catalog/view/theme/mytemplate/template/module/search.tpl and catalog/controller/module/search.php, and the load times went down to 2-3 seconds, which is much better. HTML code is now 43KB, so that's better too.

This is OC 1.4.0, if I mention the name of the host, I think I'll get flamed, so I'll keep quiet on that one :)
That is a great idea as I have many cats also. Would you mind to PM me with the revised search.php file?

DownloadXS.com : Stock Photos & Vintage Illustrations, Fresh PLR Articles and more.
http://www.DownloadXS.com


Newbie

Posts

Joined
Fri Feb 19, 2010 2:16 am

Post by rph » Fri Mar 26, 2010 9:11 am

AndyGaskell wrote:This is OC 1.4.0, if I mention the name of the host, I think I'll get flamed, so I'll keep quiet on that one :)
Only if it's GoDaddy. ;)

Boy are you right on the search categories. I just did a check on the live server with 350 categories and the front page load time was 11 seconds. Ouch!

It's definitely the search categories that are the issue. Remove the code and the long load time completely disappears. Maybe they aren't being loaded from the cache? I'll have to do some checking.
caspara wrote:That is a great idea as I have many cats also. Would you mind to PM me with the revised search.php file?
In /catalog/view/theme/[theme name]/template/common/header.tpl delete:

Code: Select all

            <select id="filter_category_id">
              <option value="0"><?php echo $text_category; ?></option>
              <?php foreach ($categories as $category) { ?>
              <?php if ($category['category_id'] == $category_id) { ?>
              <option value="<?php echo $category['category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by rph » Fri Mar 26, 2010 10:17 am

Looks like it does load the cache and it's the parsing that gets it in trouble.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by rph » Fri Mar 26, 2010 11:23 am

This is really fugly but it appears to do the trick for caching the search category filter options. Tested lightly on 1.4.4.

/catalog/controller/common/header.php

Find

Code: Select all

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

Code: Select all

		if (!$this->cache->get('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'))) {
			$this->data['categories'] = $this->getCategories(0);
			
			$this->cache->set('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $this->data['categories']);
		} else {
			$this->data['categories'] = $this->cache->get('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
		}

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Qphoria » Fri Mar 26, 2010 9:41 pm

Don't you still need to blow away that cache file when a new category is added?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by rph » Sat Mar 27, 2010 8:03 am

Yeah, you're right.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by rph » Mon Mar 29, 2010 2:10 pm

A little more complete/consistent code:

/catalog/controller/common/header.php
/catalog/controller/product/search.php

Replace

Code: Select all

$this->data['categories'] = $this->getCategories(0);
with

Code: Select all

		if ($this->cache->get('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'))) {
			$this->data['categories'] = $this->cache->get('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
		} else {
			$this->data['categories'] = $this->getCategories(0);
			
			$this->cache->set('search.categories.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $this->data['categories']);
		}
/admin/model/catalog/category.php
public function addCategory
public function editCategory
public function deleteCategory

Replace:

Code: Select all

$this->cache->delete('category');
with

Code: Select all

$this->cache->delete('category');
$this->cache->delete('search.categories');
Thanks to Q for mentioning the missed bit.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by caspara » Wed Mar 31, 2010 12:59 am

Excellent! Thanks Ryan. My site seems to load much more quickly now (results from http://www.webpagetest.org):

Before:

http://www.webpagetest.org/result/10032 ... 1/details/

After the above modification (and caching, GZipping js and css):

http://www.webpagetest.org/result/10033 ... 1/details/

I know it still isn't a great site speed, but I'm going to continue to improve it. Thanks again for your help.

DownloadXS.com : Stock Photos & Vintage Illustrations, Fresh PLR Articles and more.
http://www.DownloadXS.com


Newbie

Posts

Joined
Fri Feb 19, 2010 2:16 am

Post by cresela30 » Sat Jan 29, 2011 2:51 pm

Hi… that was great stuff.. I really like this subject

Newegg Coupons


Newbie

Posts

Joined
Sat Jan 29, 2011 12:58 pm

Post by slawson17 » Fri Apr 15, 2011 12:46 am

That worked great! Thanks Ryan!!

User avatar
Newbie

Posts

Joined
Fri Mar 11, 2011 8:12 am

Post by AndyGaskell » Fri May 27, 2011 7:56 am

So, from this chat, the league table stands at, drum roll please...

datacon @ 100k
ibdesign @ 56k
caspara @ 40k
alleikis @ 27k
AndyGaskell @ 20k
tintedpixel @ 12k
airetechit @ 9k

...and the winner is, OpenCart, for scaling really nicely :)

I'm a web developer at http://www.ssofb.co.uk in Aberdeen, Scotland.
Got a random blog at http://www.andygaskell.blogspot.com/.


User avatar
New member

Posts

Joined
Thu Dec 10, 2009 3:59 am
Location - Aberdeen UK

Post by onlinephilately » Fri Jun 10, 2011 10:10 pm

I have searched the forum for a hint to solve this in 1.5 but not found anything.

I have quite a lot of categories and when I have the enabled the site is very slow and when I disable the categories the site is lightning fast - so the issue is with the load of the categories.

Does anybody know if the cache functionality is included in 1.5 or not?

New member

Posts

Joined
Thu Jan 27, 2011 3:14 am

Post by sguven » Sun Jun 19, 2011 7:31 pm

hi
im using opencart 1.5.05
i have 10.000 product in the database.
opencart is slow working why?
http://www.pintiyiz.com main root
http://www.pintiyiz.com/Bilgisayar a categorie opens in 11 seconds bad performance

products are added automatically with c #

please help me .

Newbie

Posts

Joined
Sun Jun 19, 2011 5:28 am

Newbie

Posts

Joined
Sun Jun 19, 2011 5:28 am

Post by allaboutcake » Sun Jun 19, 2011 10:20 pm

I'm currently up around 13k on 1.4.9.3 moving to 15k products / images in a couple of weeks, use the Excel import / export mod, works fine at the moment - no real slowness to report although only get a 2 - 3 users on at any one time.

Newbie

Posts

Joined
Sun Jun 19, 2011 1:11 am

Post by allaboutcake » Sun Jun 19, 2011 10:29 pm

sguven wrote:hi
im using opencart 1.5.05
i have 10.000 product in the database.
opencart is slow working why?
http://www.pintiyiz.com main root
http://www.pintiyiz.com/Bilgisayar a categorie opens in 11 seconds bad performance

products are added automatically with c #

please help me .
Your's opened in about 6 seconds for me, which is around about the same time as mine :-)

Newbie

Posts

Joined
Sun Jun 19, 2011 1:11 am

Post by onlinephilately » Sun Jun 19, 2011 10:33 pm

I think this is too slow...

Has anybody found out if the solution above with cache of categories will speed up load?

New member

Posts

Joined
Thu Jan 27, 2011 3:14 am

Post by sguven » Mon Jun 20, 2011 12:59 am

install the old version ?

How many products you have installed?

Newbie

Posts

Joined
Sun Jun 19, 2011 5:28 am
Who is online

Users browsing this forum: No registered users and 14 guests