Competition is tough, but it's good for innovation! Even though Page Cache Ultimate has always offered a better cache than the competitors, it was becoming complicated to explain to customers. So I looked into this feature that I had in mind for a long time: not loading the Prestashop CMS at all when the cache is available, in other words, serving the pages as static files!
The stakes
Achieving such a feat would reduce the TTFB dramatically, in general a static file is served in less than 100ms (and I am very large).
The difficulty
The problem is that the same page does not have the same content depending on the visitor who requests its display. Several parameters are taken into account: the currency (euro, dollars, etc.), the visitor's user groups, the country (in case of access restriction), the taxes to be applied, etc. All this forms what I call a context.
Impossible to know this context without using Prestashop, so how to do?
The solution
The first display can not be done without loading Prestashop, so it will work as before, with the use of the server side cache if it is available. The module will take advantage of this first display to place a cookie 'jpresta_cache_context' to identify the context to use!
Thanks to this cookie it is now possible to return the right file corresponding to the URL of the page.
Technically, the name of the cache file will be the hash (MD5) of the URL. Since this cannot be calculated by Apache in a simple way, the module will use a small independent and very fast PHP script to return the static file to the browser. We take advantage of this to send back the already compressed stored version of the page, this saves Apache from having to do it.
Amazing results!
It's simply incredible, the speed difference is huge, my first tests give me a TTFB lower than 10ms!
On JPresta.com which uses a shared hosting, The average TTFB is now 100ms!
I took the opportunity to add statistics on the use of different types of cache, here is for example the distribution on JPresta.com:
To take advantage of this new feature you just need to update the module if your support and update period is still active, otherwise you can extend it, and if you don't have a license yet you can buy Page Cache Ultimate . Pour aller plus loin dans l'optimisation de votre boutique Prestashop vous pouvez aussi opter pour Speed Pack (Page Cache Ultimate + WEBP + SQL Profiling + Database cleaning) qui inclus Page Cache Ultimate. Je vous conseille aussi notre thème JPresta Origin optimized for speed and Core Web Vitals!
Leave a comment