LiteSpeed Cache + Magento

webizen

Well-Known Member
#1
We have been trying to extend LiteSpeed Cache to Magento. However, due to dynamic of the application, the effort is on hold. Here is why:

1. LiteSpeed Cache is for page caching

It caches entire page output which is deemed to be static. How to determine if a page is static or cacheable in Magento is another story. A regular product page, or a category page is OK to be cached only if all the pieces/blocks on that page are cacheable/static. However, most pages have dynamic blocks for things like display number of items in shopping cart, and/or items in the cart, product comparisons, etc.

For example, if a user (guest or logged-in) adds product to shopping cart and continue to navigate the site.

In such a case, page cache actually causes more trouble than good because user may not see shopping cart number of items gets updated right away. There is no good indicator to tell when shopping cart gets updated without digging the code and add some hack.

2. The solution for that (not all the blocks are cacheable) is to open a few holes on the page for dynamic updates so called "dynamic holes". The majority part of the page is static and can be cached. For the dynamic holes, data can be retrieved via lightweight operations.

However, it is not what LiteSpeed Cache can do at this point.
 

J.T.

Well-Known Member
#2
Glad you mention Magento but shame it's on hold!

I'm working on this myself and aim to adopt your vB approach. You are right, when they put something in the cart or start comparing items, pages should start to be rendered dynamically. Or with such "dynamic holes" indeed. But if LSWS can't do that (yet), I'm still going to try full page caching.

It will be good for Google to begin with, as Google won't add anything to cart or start comparing items. It will also be good for first-time visitors. On their first landing, they have nothing in cart or comparison anyway, so may as well impress them with a speedy website. As they come to know the site, use it more, trust the brand etc. speed can be sacrificed a little bit for extra functionality.

For the cart, you can even come up with fancy was like putting cart content quantities in a cookie of an external URL which then through external JS renders that text with cart contents. But until that, I'm happy for full page caching for new visitors and Google.

Just need to work out a Magento module which keeps a cookie that tells LSWS to show a cache page or not. My plans are coming along nicely, aim to have something working mid-March.
 
Top