Post by hcamelion » Fri Jun 06, 2014 9:58 am

??? Hi,

This is not exactly a bug but it is a performance issue for stores with lots of categories.

We have a store here: http://www.lynallan.com/

We have a lot of categories in the top menu and also on sub category pages in the right sidebar. We were seeing server side and client side total page load times of 15-30 seconds. Server side the home page was seeing 6-15 seconds and the sub cat pages were seeing 12-25 seconds and this is all server side before the client side even gets the page. Then client side time was an additional 3-8 seconds.

I used a benchmark class and first thing I noticed was 900 queries being run. Most of them were calling $this->url->link.

I finally narrowed it down to the category data processing in these locations:

foreach ($categories as $category) in catalog/controller/module/category.php around line 33

foreach ($categories as $category in catalog/controller/common/header.php around line 107


My question is why isn't this category data cached?

I have now cached it via a vqmod. I have attached it if anyone else wants it.

My only other question remaining is I would like to know if there is a cache time setting in the admin and if not how long is data cached?

Let me know what you think of this?

Download it on Github: https://gist.github.com/weismannweb/a16 ... 89ca1d1209

EDIT: Updated to work with multi-store. Thanks to platoon for multi-store fix.
Last edited by hcamelion on Sat Dec 20, 2014 11:20 am, edited 5 times in total.

Henry Weismann
877.44.MY.WEB (877.446.9932)
We can help with your Opencart Site - Opencart Web Developer

Image


User avatar
New member

Posts

Joined
Mon Jul 27, 2009 3:14 am
Location - Albany, NY, USA

Post by rph » Sat Jun 07, 2014 2:42 am

Cache files expire in 60 minutes. Unfortunately there's no way to change the value within OpenCart as of 1.5.x short of modifying the core (that will change in 2.0). You'll have to edit /system/library/cache.php to increase it.

Also check that the url_alias table has query and keyword indexed. It can provide a good speed bump though the sheer number of queries will still be a drag.

-Ryan


rph
Expert Member

Posts

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

Post by tobychin » Sat Jun 28, 2014 4:50 am

Henry,
Your VQMod is a lifesaver! I have been trying to get the number of SQL queries on a site we're hosting (number of queries was almost 700 for the home page) and this did the trick. Server response time was over 18 seconds, and is now down to under 200 ms. Thank you, thank you, thank you! Anyone else experience slow load times and already have the product count turned off: you definitely need to try this!

Q / Daniel,
Please consider integrating something like this into the core. This was such a problem for us that we were considering not using OpenCart as a platform any longer. I no longer feel as though I have to immediately shy people away from considering the OpenCart platform.

RPH,
While I understand that the indexing can help, site owners shouldn't have to go in to PHPMyAdmin and ensure that these columns are indexed...

- Toby
"The only way to get to the top is to get off your bottom." - Fortune Cookie


New member

Posts

Joined
Tue Jul 12, 2011 12:03 am
Location - Warsaw, Indiana

Post by IP_CAM » Sat Jun 28, 2014 5:37 am

tobychin wrote:Henry, Your VQMod is a lifesaver!
read this post as well, you may find more speed-idea's:

http://forum.opencart.com/viewtopic.php?f=10&t=127322

Ernie

ipc.li/shop/

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by paynechia » Wed Jul 30, 2014 6:51 pm

Hi Hcamelion,

My site is running in 2 languages. The category cache doesn't work when I change to another language. Is it possible to get this cache to support multi-language site?

Thank you~

Newbie

Posts

Joined
Mon Mar 24, 2014 2:49 pm

Post by IP_CAM » Fri Aug 22, 2014 1:10 am

paynechia wrote:My site is running in 2 languages. The category cache doesn't work when I change to another language. Is it possible to get this cache to support multi-language site?
since you got no reply, let me do it:

If you have any caching active in your 'header' Files, category-selection will possibly not change languages, I had a similar effect.
But the Content should change anyway to the other language, but it probably depends as well on what kind of caching method you use.

Ernie

openshop.li
Last edited by IP_CAM on Sat Aug 23, 2014 3:03 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by yavenay » Fri Aug 22, 2014 10:46 pm

OMG this worked. My site is now lightning fast. :D :D :D :D :D

Thank you so much.

Newbie

Posts

Joined
Fri Aug 22, 2014 10:54 am

Post by platoon » Sun Oct 26, 2014 4:51 pm

hcamelion wrote: This is not exactly a bug but it is a performance issue for stores with lots of categories.
It is not an issue anymore after i found your life saver post :)
In addition, it is also good to have multistore support which is achieved with couple small changes. Small improvement to your already perfect mod attached.

Newbie

Posts

Joined
Sun Feb 23, 2014 11:44 pm

Post by hcamelion » Sat Dec 20, 2014 10:36 am

Im sorry for not responding to the posts that have been made since I created this post. For some reason even though I am subscribed I am not getting notifications of new posts.

Thanks platoon for your contribution...I have updated my file in case nobody scrolls and reads further. Also paynechia let us know if you resolved your problem?

Henry Weismann
877.44.MY.WEB (877.446.9932)
We can help with your Opencart Site - Opencart Web Developer

Image


User avatar
New member

Posts

Joined
Mon Jul 27, 2009 3:14 am
Location - Albany, NY, USA

Post by IP_CAM » Sat Dec 20, 2014 11:14 am

Just to inform about another Cache Option:
http://forum.opencart.com/viewtopic.php ... e&start=20

Ernie
ipc.li

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by IP_CAM » Tue Feb 17, 2015 11:14 pm

Customers will be happy not to have to click, just to find empty Pages!! They do this twice, then, they leave for good.

I hardcoded BOTH MOD's in Discussion, but not the Page-Cache Mod, mentioned in my last Post above, here into the Source. Testing the setup with activated Page-Cache, it 'fixed' my Page-Load Value to the (cached) Value, when cashing the Page, so, I was unable to get any more 'actual' results...

I enclosed ALL (Category-Cache related) 3 modified Source files in a ZIP. Avoid's more VqMod Server Templates to be built... (suitable OC v.1.5.6.1-5) For SUCH TASKS, I would NEVER use VqMods, just to mentioned it. I seek Speed, without compromises...

Good Luck
Ernie
ipc.li/shop/

PS: Please DO NOT ask questions, if it does not work. It's just meant for Coders, not Newbie's...
Last edited by IP_CAM on Thu Jun 23, 2016 8:31 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Concept211 » Wed Jul 15, 2015 4:12 pm

Really great job on this vQmod, @hcamelion! Many, many thanks...worked like a charm on v1.5.6.4!

User avatar
New member

Posts

Joined
Fri Oct 14, 2011 1:40 am

Post by dkgawande » Sun Nov 22, 2015 8:38 pm

Thanks for the vqmod. I have two questions
1. Are these changes now part of latest opencart version (2.1) released on 6th Oct 2015?
2. How can I apply this vqmod to my store?

Newbie

Posts

Joined
Sun Nov 22, 2015 8:35 pm

Post by mworsnop » Wed Jun 22, 2016 11:45 pm

Sorru I am new to OC. How do I install the mod and will it work with 2.1

Newbie

Posts

Joined
Thu Apr 21, 2016 11:31 pm

Post by IP_CAM » Thu Jun 23, 2016 9:04 am

No, they both won't work!
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by celia1980 » Thu Jun 23, 2016 9:25 pm

I have the same problem to open cart :-\

http://tecemur.es


Newbie

Posts

Joined
Thu Jun 23, 2016 9:00 pm

Post by IP_CAM » Thu Jul 19, 2018 3:36 am

Latest Extension for OC v.3.0.x Versions, possibly works on late v.2.3.x Versions too:
cache_category_data.xml
https://gist.github.com/weismannweb/8ad ... 8d751281b2
Ernie
---

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 28 guests