Skip to content
10% off any project with promo code10% off with code

Optimising OpenCart: From 4 Seconds to 400 ms

Contents
  1. Step 1: read the slow query log
  2. Step 2: indexes and queries
  3. Step 3: FastCGI cache
  4. Step 4: Redis object cache
  5. Step 5: OPcache and JIT
  6. The result
  7. Frequently asked questions
Published
Reading time
~3 min
Views
189
Reader rating
12 reviews
Author
Yevhen Fostenko
Senior Backend & DevOps Engineer
Optimising OpenCart: From 4 Seconds to 400 ms Article
TL;DR
  • Enable the MySQL/MariaDB slow query log and use pt-query-digest — the usual culprits are oc_product, oc_product_description and oc_category_path.
  • Add composite indexes on the fields you filter by most, e.g. (status, date_available).
  • Nginx FastCGI cache drops TTFB on cached pages from 2–4 s to 10–50 ms.
  • Redis as the cache driver speeds up dynamic pages by 30–50%; PHP 8 OPcache + JIT adds 10–20%.

Result on a real 80k-product store: category TTFB 4,200 → 380 ms, MySQL CPU 240% → 18%.

Need help with this?
OpenCart / ocStore Speed Optimization
from 3000.00 грн.
Order via Telegram More about the service →
Free consultation and estimate. I reply quickly.

A slow OpenCart is one of the most common problems store owners run into. This walkthrough covers the process from analysis to result.

Step 1: read the slow query log

Start by enabling the slow query log in MySQL/MariaDB:

slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 0.5

Use pt-query-digest to find the heaviest queries. The usual culprits are oc_product, oc_product_description and oc_category_path.

Step 2: indexes and queries

Add composite indexes on the fields you filter by most. A classic case: category page queries doing a full table scan because there is no index on (status, date_available).

Step 3: FastCGI cache

Nginx FastCGI cache gives the biggest single win on static pages. TTFB drops from 2–4 seconds to 10–50 ms on cached pages. Configure exclusions for the cart and the admin panel.

Step 4: Redis object cache

OpenCart supports Redis through its standard cache driver. Moving session and object cache off disk and into Redis speeds up dynamic pages by 30–50%.

Step 5: OPcache and JIT

PHP 8.x JIT compilation adds 10–20% on CPU-heavy work. Set opcache.memory_consumption=256 and opcache.jit_buffer_size=64M.

The result

After a full pass on a real 80k-product store: category TTFB from 4,200 ms down to 380 ms, MySQL CPU from 240% down to 18%.

Frequently asked questions

Where should OpenCart optimisation start?

With the slow query log in MySQL/MariaDB (long_query_time = 0.5) and pt-query-digest to find the heaviest queries. Most often they hit oc_product, oc_product_description and oc_category_path.

Which indexes help the most?

Composite indexes on the fields you filter by. A classic case is category page queries doing a full table scan because there is no index on (status, date_available).

What gives the biggest single speed-up?

Nginx FastCGI cache on pages that can be cached: TTFB falls from 2–4 seconds to 10–50 ms. Keep the cart and the admin panel out of the cache.

Is Redis worth it for OpenCart?

Yes. OpenCart supports Redis through its standard cache driver, and moving session and object cache off disk speeds up dynamic pages by 30–50%.

Tags: opencartoptimizationmysqlnginxttfbperformance
Need help with this?
OpenCart / ocStore Speed Optimization
from 3000.00 грн.
Order via Telegram More about the service →
Free consultation and estimate. I reply quickly.

Related Products

OpenCart / ocStore Speed Optimization Service

OpenCart / ocStore Speed Optimization

7 reviews
from 3 000 грн
Admin Panel Optimization for Large Catalogs Service

Admin Panel Optimization for Large Catalogs

7 reviews
from 4 000 грн

Related Articles

PHP-FPM and Nginx Tuning: A Practical Checklist Article

PHP-FPM and Nginx Tuning: A Practical Checklist

Getting Nginx and PHP-FPM right is the foundation of a fast e-commerce server. Here is a practical checklist drawn from real production work. PHP-FPM: choosi…

02/06/2026 123
Redis Caching in OpenCart 3.x: Setup and Tuning Article

Redis Caching in OpenCart 3.x: Setup and Tuning

A slow OpenCart is one of the most common complaints store owners have. One of the most effective ways to speed it up is Redis. Here it is, step by step. Wh…

02/06/2026 148
PageSpeed Insights 90+: How to Get There on OpenCart / WordPress Article

PageSpeed Insights 90+: How to Get There on OpenCart / WordPress

PageSpeed 90+ is a genuinely achievable target for any PHP site. Here is a step-by-step plan, ordered from the biggest impact down to the details. The steps…

02/06/2026 118
Core Web Vitals Optimization Article

Core Web Vitals Optimization

Core Web Vitals are the metrics Google uses to measure real user experience, and they feed into ranking. Optimising LCP, CLS and INP makes a site faster and…

03/06/2026 173
Slow OpenCart Admin: Causes and Fixes Article

Slow OpenCart Admin: Causes and Fixes

Store speed is usually discussed from the customer's side. But there is another side that costs money every day: when a manager waits a minute for the produc…

18/06/2024 58

Reader reviews

5.0
Write a review