PrestaShop is a world-renowned open source software for e-commerce, and we are honored to use it since 2009, when it was version 1.2.5.
Now that 2022 is old, PrestaShop has been updated to version 220.127.116.11, but recently the loading speed of the background of our website is very slow, causing our spirits to collapse, especially where modules and hooks are loaded, it is even more maddeningly slow .
So I enabled the Hierarchical Profiler of the PHP official website and the famous xhprof to find the root cause of the background loading of the PrestaShop website and fix it, which is roughly divided into several steps:
- Installing xhprof is very simple, just install and use it according to the manual.
- Load the performance analysis code into the background homepage file according to the sample code, then open several slow pages in the background of the website, and wait patiently for it to be loaded.
- Open the analysis interface and open the performance analysis connection one by one
- We still view it more intuitively according to the picture
- Finally we finally found a couple of final culprits that are causing slow loading in the background of PrestaShop.
At this point, we can choose to repair it, which is roughly divided into 2 steps:
- Search api-addons.prestashop.com and api.addons.prestashop.com all over the site, but we’ve already found it for you, 3 places in total.
- Replace all the above URLs with local(127.0.0.1) virtual addresses.
Here, if necessary, it is best to clear the cache file again.
Finally, we open the background website again,we found that the loading speed of PrestaShop in the background has skyrocketed, and it has reached a few milliseconds, a speed improvement visible to the naked eye.
Finally, remember to delete the debug code for the above-mentioned hierarchical analysis.