How To Speed Up OpenCart (and/or Fix Speed Issues)

Posted by Paul on December 15, 2020

Speed is one of the most important things when it comes to how enjoyable a website is to use for a customer and these days Google considers it a ranking factor - faster sites appear higher up in the results and therefore get sent more traffic.

So here is an article designed to be a work-in-progress and constantly updated as we find more and more ways to optimise OpenCart for speed, in no particular order.

Turn Off Category Counts
Discussed here:

Install a Good Caching Extension
Nitropack Cache may no longer be the best option:

Add Database Indices
This is essential, easy to do, and provides a massive speed boost:

Trim Error Log Files Automatically
Every time OpenCart has a notice, warning, or error it has to open a log file and if that file is large it can really slow your site. This can sometimes happen hundreds of times per page load so an extension like this is essential:

Fix the Code to Remove Notices and Warnings
Related to the above, you can prevent OpenCart from writing so much to the log.

Use a CSS-only Theme
Some themes are badly written front-end code and some themes are badly written front-end AND back-end code like Journal. Instead use a lightweight theme that is pure CSS like these:

Use CloudFlare (
CloudFlare is free, saves you bandwidth and can speed up your site but beware it can cause issues so always do various tests and test orders after enabling it.

Reduce the filesize of your images
If you have a lot of pictures on your site, the size of them can have a huge impact on performance. If they are super high-resolution, scaling them down to a size no larger than they'd appear on site is a sure-fire way to lighten the load on network connections and reduce loading times. Modern image formats like WebP give even better file sizes than JPEG, with no sacrifice in image quality. There are plenty of extensions available for OpenCart that will automatically serve images on site as WebP without you having to go through the hassle of converting them.

Make Sure You're Not Suffering from the vQmod "checked.cache" Issue
There's a file vQmod uses to keep track of changes (separate from the vqcache folder) and this can sometimes grow out of control without ever being trimmed. As it grows the site will slow until it eventually grinds to a halt. The issue can be triggered by installing a new extension, so even if this hasn't been a problem before it can suddenly start. You probably have this issue if the file /vqmod/checked.cache is larger than a few hundred KB. The issue is described on the forum here: We think this is probably the best fix for it:

Make Sure Your /tmp Folders Aren't Filling Up
PHP sesions (which manage logins) can sometimes be stored in a folder on the server called /tmp. This can grow too big if your php.ini settings aren't deleting them regularly enough. This one is described here:

Make Sure Your Cache Folders Aren't Filling Up
There are lots of different cache extensions for OpenCart as well as the built-in caches and the (horrible) Journal theme has its own cache too. All of these may store cache files in various folders and some extensions like NitroPack Cache from iSense will store potentially hundreds of thousands of files! You need to make sure these are cleared regularly when they get too old or your server will start to struggle. Sometimes a cron with a command like "tmpwatch" is the answer here.

Consider switching database tables' engines to InnoDB
By default, OpenCart uses the MyISAM engine for most of its database tables. The MyISAM engine is known for having table-level locking, which basically means if one person is adding or editing something in a table, the entire table is 'locked' from access by anyone else until the edit is complete. On busy websites, changing any data in a table that's accessed frequently (e.g. the customers, orders or products tables) can cause a huge pile-up of database connections waiting for their turn to access the table, and can potentially overwhelm and crash the database server!

The InnoDB engine, on the other hand, only locks the entry in the table being edited, allowing the rest of the table to be accessed freely. Switching the engine of your database tables to InnoDB is fully compatible with OpenCart and can greatly reduce the load on the server from pending connections.

Consider siwtching your PHP Handler from suPHP to LSAPI (LiteSpeed)
For a server with a lot of sites, this can speed up the sites significantly.

Do you know of any other speed optimisations for OpenCart?

If so, please comment with them below and we'll add any good ones to this list!

If your website is still running slow, feel free to contact us - we might be able to help!

blog comments powered by Disqus