Jump to content

Recommended Posts

Posted

Hello, I have a comparison website. Each page has multiple fields (repeater, date, integer, text)

The purpose of site is to select 2 products and compare them

My problem is high load. There are several millions of possible comparisons. I use default Cache option. But for almost all comparisons there are no cached version. And generating cache for them is useless because many of them are requested rare

I think loading 2 pages with all their fields are creating high load

How can I optimize it? Can I cache all pages for individual products (less than 5000)? And when comparison runs it will use cached data instead of requesting all fields?

Whats the best way to do it?

Posted

If caching doesn't support GET parameters, then you need the correct solution: a /compare/ folder with nested elements that create a new page based on the pair. This will make the page live forever.

Another question is that if the content on the page changes, you will need to regenerate the page.

  • Like 1
Posted
4 hours ago, maximus said:

If caching doesn't support GET parameters, then you need the correct solution: a /compare/ folder with nested elements that create a new page based on the pair. This will make the page live forever.

Another question is that if the content on the page changes, you will need to regenerate the page.

I have:

Product page: /category/product-name/

Compare page: /category/product-name-1-exp-product-name-2/

Currently I have this code that checks if it's a comparison template:

if (!empty($segment)) {
    include_once('./compare-template.php');
    return;
}

And in the comparison template it finds page id by url:

$page1 = $pages->getByPath($pagesToCompare[0]);
$page2 = $pages->getByPath($pagesToCompare[1]);

Question is what's the best way to create a snapshot of page? Can I cache it with $cache-save? And rebuild cache via hook when page is saved?

I think pre build cache should solve problem with slow speed

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...