Slow PrestaShop: how to find out why and in what order to fix it

Slow PrestaShop

Before touching anything, find out where the time is being lost. A slow PrestaShop shop has one of two problems: the server takes too long to generate the page, or the browser takes too long to render it. They are fixed in different ways, and picking the wrong side is the most expensive way of fixing nothing: changing hosting when the problem is the images, or compressing images when the server takes six seconds to respond.

You can check this in two minutes with your browser. After that, the review order we use ourselves, with the causes we actually come across.

How to tell whether the problem is the server or the browser

Open the slow page in Chrome, press F12 to open the developer tools and go to the Network tab. Reload the page. Click on the first row, which is the HTML document, and open the Timing tab. Look for the line Waiting for server response, which is the TTFB (time to first byte).

  • If TTFB is above 1.8 seconds, the problem is on the server. Google considers a TTFB of 0.8 seconds or less good and anything above 1.8 poor (web.dev). Until the server responds, the browser cannot do anything.
  • If TTFB is low and the page is still slow to appear, the problem is in the browser: images, scripts, styles or modules that load things on the page. For that side, see our general guide to website loading speed (in Spanish).

Measure it on three types of page, because each one is slow for different reasons: the homepage, a category with lots of products and a product page. Do it in an incognito window and reload twice, because the first visit after a change is always slower.

Chrome timing panel showing the TTFB of a PrestaShop category at 5.9 seconds, far above the 1.8 second threshold
If the “Waiting for server response” line is above 1.8 seconds, the problem is on the server.
Decision tree to tell whether a slow PrestaShop shop has a server or a browser problem, based on TTFB
A single figure separates the two problems. Each side has its own causes and its own tool.

Is this happening to you right now?

Leave us the URL and what you are seeing. A technician will look at it today and tell you what it is before touching anything.

We reply within 24 working hours.

If the server is slow: the PrestaShop profiler

PrestaShop includes a profiler that tells you where the time goes on each page. You enable it in the config/defines.inc.php file by changing this line:

define('_PS_DEBUG_PROFILING_', true);

When you reload, a report appears at the bottom of the page with the time per block, the slowest hooks and modules, the slowest SQL queries, repeated queries and how many objects of each type are created. We checked it in the PrestaShop 8.2 code: the profiler lives in the tools/profiling folder (PrestaShop 8.2 code).

Careful: while it is active, anyone visiting the shop sees that report. Enable it on a copy of the shop or for a few minutes, and set it back to false as soon as you have the data.

What to look for in the report:

  • A module eating half the time. If a single one goes above a few hundred milliseconds, you know where to start.
  • Hundreds or thousands of queries per page. A healthy category does not need a thousand.
  • Repeated queries. The same query run dozens of times means a badly coded module or theme.
  • Lots of objects of the same type. If a category creates hundreds of product objects, something is loading them one by one.

The causes, in order of likelihood

From most to least common. Numbers 1, 2 and 4 are fixed from the back office and cost nothing.

Symptom Likely cause Where to look
High TTFB on every page Cache disabled or misconfigured Advanced Parameters > Performance
High TTFB and connection errors in the logs Database connection limit Server logs and hosting panel
Low TTFB but the page is slow to appear Images that are too heavy The product page, in the browser
High TTFB only on categories Modules or queries that multiply per product The profiler
Everything slow, including the back office Debug mode or forced compilation Advanced Parameters > Performance

1. The cache is disabled, or enabled and not working

This is the most common one. Someone disabled the cache to run a test and nobody turned it back on. Check it in Advanced Parameters > Performance:

  • In the Smarty block, template compilation should be set to the option that starts with “Never recompile”, and Cache to Yes. The “Force compilation” option is for development: with it, PrestaShop recompiles the design on every visit.
  • Debug mode set to No.
Diagram of Advanced Parameters > Performance in PrestaShop 8 with the four cache and debug settings to check” class=”wp-image-28911″ width=”1200″ height=”660″ loading=”lazy”/><figcaption class=Compilation on “Never recompile”, cache enabled, debug disabled and a caching system that actually exists.

There is a trickier case, which we found in a shop after a migration: the cache was enabled, but pointing to Memcached with no server configured. In the PrestaShop 8.2 code, if the Memcached server list is empty, the cache has no connection and stops storing anything (code). In the back office everything looks fine, but every page is generated from scratch. If you see Memcached in the Caching block, check that there is a server in the list and that it really exists. If you are not sure, disable that cache.

A word of warning: when you enable the cache, the first visit to each page is slow because it has to be generated. Reload a couple of times before judging.

2. Images weigh far more than they should

A photo displayed at 600 pixels does not need to be 3,000. But that is what happens when photos are uploaded as they are from a phone or from the supplier’s catalogue. Open a product page, right-click on the photo, open it in a new tab and check how much it weighs. If a single image is above 300 KB, there is work to do.

It is fixed in two steps: regenerate the thumbnails in Design > Image Settings and compress what is already uploaded.

3. The database cannot keep up

If MySQL error 1203 (max_user_connections) shows up in the server error logs, the shop is trying to open more database connections than the hosting allows. Every time it hits that limit, the page fails or slows down. We saw it in a shop with thousands of errors a day, even in the middle of the night with no visitors. The fix is to ask the provider to raise the limit and then find out what is opening so many connections.

Also check the tables that grow out of control, such as visitor statistics, abandoned carts and logs. With millions of rows, every query that touches them gets slower.

4. There are modules installed that you no longer use

A module that is installed and hooked to the page runs on every visit, even if you do not use it. Check Modules > Module Manager and disable whatever is not needed. The profiler tells you how long each one takes: start with the ones that take the most time.

5. The hosting falls short

Only after the four points above. The signs are clear: TTFB is high even with the cache properly configured, the hosting panel shows CPU or memory at the limit, or there are errors due to lack of resources. In the shop from the migration, the account was at 100% CPU and producing hundreds of failures an hour. Upgrading the plan brought them down to zero.

6. The PrestaShop or PHP version is old

An old PHP version is slower and also stops receiving security patches. If your shop runs PrestaShop 1.6 or 1.7 with PHP 7.x, upgrading usually brings speed, although it is a project, not a five-minute tweak. We explain it in how to upgrade PrestaShop.

If instead of being slow the shop shows a 500 error, the path is a different one: what to do if the shop shows a 500 error.

What happens when it is done right

Bar chart: a PrestaShop shop's homepage goes from 10,191 to 1,137 ms and the product page from 3,849 to 1,229 ms
The same shop, without changing the design. The effect of fixing the server and the cache is measured in the same session.

This is the case of a shop that came to us after a migration. The cache was enabled pointing to a Memcached with no server, the account was running with the CPU at its limit and the database was rejecting connections every day. Once those three things were fixed, without touching the design or the modules, the homepage went from 10.2 to 1.1 seconds and the product page from 3.8 to 1.2. Categories remained slow because of a code problem, and that fix is no longer configuration: it is development.

What breaks if you get it wrong

  • Leaving the profiler on. Any visitor sees the full report, with internal shop data.
  • Enabling the cache without checking that it works. With Memcached or APC selected and the service not installed on the server, the shop may be just as slow or show errors. After changing it, measure TTFB again.
  • Deleting cache folders by hand. Use the Clear cache button in Advanced Parameters > Performance. Deleting folders blindly can leave the shop with errors.
  • Disabling modules without knowing what they do. Some of them handle payment, shipping or invoicing. Disable them one at a time and test an order afterwards.
  • Changing hosting without measuring first. If the problem was the cache or a module, you take it with you to the new server and pay more for the same.
  • Make a backup before touching the configuration, especially before changing the caching system or upgrading PHP.

If only the shop’s search is slow, the cause is usually different and we cover it separately in PrestaShop search does not find products (in Spanish), which also covers what to do when searches are slow.

If, on top of that, your hosting warns you it is running out of space, or backups take hours, first check which tables weigh the most: we explain it in the PrestaShop database takes up too much space (in Spanish).

When you cannot do this yourself

You can do it yourself if the problem is the cache, the images or unnecessary modules. You need help if the profiler points to queries or code you cannot interpret, if a category runs thousands of queries, if the logs show database errors or if you do not have access to the server. At that point the fix is a server or code fix, which is what we do in our PrestaShop maintenance and our PrestaShop hosting.

Is this happening to you right now?

Leave us the URL and what you are seeing. A technician will look at it today and tell you what it is before touching anything.

We reply within 24 working hours.

Frequently asked questions

Why is my PrestaShop shop slow?

The most common causes are a misconfigured cache, images that are too heavy, a database that cannot keep up, modules that are no longer used, hosting that falls short or old versions of PrestaShop or PHP.

How do I know whether the slowness comes from the server or the browser?

By measuring how long the server takes to respond, the time to first byte, against how long the page takes to finish loading. If the server is slow, the problem is in PrestaShop or the hosting; if not, it is in what loads in the browser.

What is the PrestaShop profiler?

It is a debug mode tool that shows how long each part of the page takes to be generated, including modules and database queries. It helps you find what is slowing the shop down.

Will changing hosting fix a slow shop?

Sometimes, if the server falls short. But if the cause is the cache, the images or the modules, the problem moves to the new server. You have to measure before changing.