Boost opencart 1.5.6.x performance up to 10 times!

How to improve opencart 1.5.6.x performance up to 10 times? If you decide that your opencart website is slow and you want to improve its speed then the article is for you.

Opencart is a popular eCommerce web-site engine. It is a great solution to create an awesome online store. There are many plugins, integrations, themes and etc. Opencart World-Wide Community consists of many professional developers who can easily customize it by unique business design requirements.  Its current version is 2.x but 1.5.6.x is more stable at the moment.

But how to increase its performance? Because it is slow when product count is over 50000 items. When you navigate through website pages: start page, categories, category products, product details - your website is loaded very slow. Where is the problem? Well, during a page load, there are many sql queries to actual database (MySQL). So, we will research db access layer to improve average website performance.

We want to give you several solutions how to improve opencart performance:

1. First, look at the database tables. Where are indexes? So, if your table column like (product_id, category_id) without indexes - add as much indexes as table columns can be indexier (all columns that are involved in where clause, joins and etc).

Just, use PhpMyAdmin to manage your database. If you don't feel free with that - ask your programmer to do this stuff.

After you created indexes - you get great performance win.

So, we just optimized our database. It is fine. But we still have many database queries.

What about database MySQL caching?

All opencart pages consists of many modules which query database to get data each time you request the page. And different pages can contain the same modules and the same data will be fetched from the opencart database multiple times. It is overhead and the slowest  place in the opencart. Why we cannot just reuse the same data per database query? Yes, we can.

2. Second and final solution is to add db layer caching. There are many caching components but we have our solution: DB Cache - http://www.opencart.com/index.php?route=extension/extension/info&extension_id=25388

We created db cache layer that caches all select queries for 1 day but any modification query like insert/update/delete cancels that select queries from cache that have modified tables. So we have smart db cache solution.

Lets test our solution with ab (Apache Bench). We will use the command:

ab -n 100 -c 2 http://malishagu.ru/

You could change the url with your opencart website.

The first test will be with Disabled DB Cache module. And we get the next ab output:

Server Software:        nginx
Server Hostname:        malishagu.ru
Server Port:            80
 
Document Path:          /
Document Length:        218427 bytes
 
Concurrency Level:      2
Time taken for tests:   108.071 seconds
Complete requests:      100
Failed requests:        84
   (Connect: 0, Receive: 0, Length: 84, Exceptions: 0)
Write errors:           0
Total transferred:      21899476 bytes
HTML transferred:       21841776 bytes
Requests per second:    0.93 [#/sec] (mean)
Time per request:       2161.416 [ms] (mean)
Time per request:       1080.708 [ms] (mean, across all concurrent requests)
Transfer rate:          197.89 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:  1471 2132 216.6   2120    2934
Waiting:     1468 2128 216.2   2109    2925
Total:       1471 2132 216.6   2121    2934
 
Percentage of the requests served within a certain time (ms)
  50%   2121
  66%   2205
  75%   2248
  80%   2291
  90%   2364
  95%   2500
  98%   2806
  99%   2934
 100%   2934 (longest request)
 

The second test will be with Enabled DB Cache module and we get the next ab output:

Server Software:        nginx
Server Hostname:        malishagu.ru
Server Port:            80
 
Document Path:          /
Document Length:        218427 bytes
 
Concurrency Level:      2
Time taken for tests:   24.025 seconds
Complete requests:      100
Failed requests:        74
   (Connect: 0, Receive: 0, Length: 74, Exceptions: 0)
Write errors:           0
Total transferred:      21899740 bytes
HTML transferred:       21842040 bytes
Requests per second:    4.16 [#/sec] (mean)
Time per request:       480.506 [ms] (mean)
Time per request:       240.253 [ms] (mean, across all concurrent requests)
Transfer rate:          890.16 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:   382  467 169.7    433    1521
Waiting:      354  429 164.5    395    1487
Total:        383  467 169.8    433    1521
 
Percentage of the requests served within a certain time (ms)
  50%    433
  66%    450
  75%    467
  80%    476
  90%    499
  95%    515
  98%   1472
  99%   1521
 100%   1521 (longest request)
 
Look at the major performance figure - Requests per second. We get 4.16 [#/sec] with enabled DB Cache and 0.93 [#/sec] with disabled DB Cache. So, the difference is 4.16/0.93 = 447%!
 

Also, if your opencart website is hosted on private or dedicated server and not on shared hosting - we could offer you DB Cache with Memcached integration solution. In this case you will get the highest performance!

By the way, a professional web developer can ask: - Why we don't use http cache?

Good point! But each page can be various by logged in user, specific user location and so on. And we cannot just cache the whole page. We recommend you use the DB Cache module!

Just try it for free and enjoy the speed difference!

opencart 1.5.6, opencart performance, opencart cache, opencart db cache, opencart mysql cache, db cache, database cache, opencart, opencart database indexes, opencart indexes, opencart 1.5, opencart slow, opencart speed, opencart sql, opencart caching, opencart asp.net