lat9 / usu

Ultimate SEO URLs for Zen Cart
GNU General Public License v3.0
1 stars 5 forks source link

Exhaust of memory when creating large cache #52

Closed xpasi closed 1 year ago

xpasi commented 2 years ago

Having 14305 products will freeze zencart (or exhaust allocated memory on server) on language switch to newly installed language when usu starts creating cache for the names.

In this case includes/classes/usu.php, Line: 1155

Calls zen_get_products_name() 14305 times in a loop, which generates 14305 queries to database.

lat9 commented 2 years ago

Thanks for the report! I'll be getting to the USU issues in a couple of weeks and will be looking to you to help me validate my solution.

lat9 commented 1 year ago

FWIW, I've reviewed the current handling of the caching and am of the opinion that it's hurting performance (and potentially memory consumption) more than it's helping.

For v3.1.0 and later the caching will be automatic and on a per-page basis. That will help performance in the determination of any category, product, manufacturer and ez-page names that are used in multiple spots on a specific page.

lat9 commented 1 year ago

From the, albeit on teeny sites, profiling that I've done, using a per-page cache to not re-determine the various names seems to have a similar performance to the current 'mass' calculation ... without the possible out-of-memory conditions that the current implementation raises.

xpasi commented 1 year ago

I finally had the time to install this on the customers site, and can verify that it now works with a large product database.

lat9 commented 1 year ago

Thanks for taking the time to let me know that the update did, in fact, correct your issue!