After enabling WinCache as an object cache back-end, and OPCache for opcode caching, WordPress performance can be further improved by adding a database cache.

A database cache does nothing more than caching all MySQL query results into small text files. The web server reads those cache files faster than executing a query on the database, making the requests handled faster. This increases WordPress performance drastically. A great MySQL database cache for WordPress used to be DB Cache Reloaded (Fix) by Ivan Kristianto. Unfortunately, development came to a stop some years ago. After hours of work, I made it WordPress 4.4+ compatible, but have now removed the source from my GitHub account due to a lack of time 🙁 .

I’ve always liked that plugin, which made me decide to – try to – revive the database cache plugin for WordPress. I’ve renamed the plugin to Saotn DB Cache, and it’s somewhat usable now, after hours of making it WordPress 4.4+ compatible.

Here are the ab requests/s results:

$ ab -n 100 -c 10 http://www.example.com/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.example.com (be patient).....done


Server Software:        Microsoft-IIS/8.5
Server Hostname:        www.example.com
Server Port:            80

Document Path:          /
Document Length:        13601 bytes

Concurrency Level:      10
Time taken for tests:   1.465 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      1396000 bytes
HTML transferred:       1360100 bytes
Requests per second:    68.27 [#/sec] (mean)
Time per request:       146.477 [ms] (mean)
Time per request:       14.648 [ms] (mean, across all concurrent requests)
Transfer rate:          930.72 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       11   18   4.2     18      31
Processing:    81  122  36.5    113     247
Waiting:       65  103  35.4     94     225
Total:         97  140  38.6    129     273

Percentage of the requests served within a certain time (ms)
  50%    129
  66%    137
  75%    141
  80%    148
  90%    167
  95%    249
  98%    272
  99%    273
 100%    273 (longest request)

$ ab -n 100 -c 10 http://www.example.com/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.example.com (be patient).....done


Server Software:        Microsoft-IIS/8.5
Server Hostname:        www.example.com
Server Port:            80

Document Path:          /
Document Length:        13601 bytes

Concurrency Level:      10
Time taken for tests:   1.406 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      1396000 bytes
HTML transferred:       1360100 bytes
Requests per second:    71.13 [#/sec] (mean)
Time per request:       140.579 [ms] (mean)
Time per request:       14.058 [ms] (mean, across all concurrent requests)
Transfer rate:          969.76 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       12   19   4.6     18      34
Processing:    80  117  26.4    111     193
Waiting:       61   99  25.5     93     171
Total:         96  136  27.5    131     208

Percentage of the requests served within a certain time (ms)
  50%    131
  66%    139
  75%    150
  80%    153
  90%    187
  95%    204
  98%    206
  99%    208
 100%    208 (longest request)

During our previous WordPress benchmark, WordPress handled some 46 requests per second. Using this MySQL database cache for WordPress increased the requests per second WordPress can handle to 68. That’s 50% more requests per second!

When I increase the number of requests and concurrency in ab to 10000/100, we can even squeeze out almost 200 requests/s:

$ ab -n 10000 -c 100 http://www.example.com/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.www.example.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        Microsoft-IIS/8.5
Server Hostname:        www.example.com
Server Port:            80

Document Path:          /
Document Length:        13601 bytes

Concurrency Level:      100
Time taken for tests:   49.686 seconds
Complete requests:      10000
Failed requests:        4
   (Connect: 0, Receive: 0, Length: 4, Exceptions: 0)
Total transferred:      139599996 bytes
HTML transferred:       136009996 bytes
Requests per second:    201.26 [#/sec] (mean)
Time per request:       496.858 [ms] (mean)
Time per request:       4.969 [ms] (mean, across all concurrent requests)
Transfer rate:          2743.81 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8   46 308.0     14    3213
Processing:    83  445 253.7    400    2722
Waiting:       52  398 198.0    380    2651
Total:        115  491 401.1    416    4880

Percentage of the requests served within a certain time (ms)
  50%    416
  66%    433
  75%    446
  80%    456
  90%    498
  95%    877
  98%   1881
  99%   3313
 100%   4880 (longest request)

And we’re not even using WP-Super-Cache yet! 🙂

WordPress Database Cache plugin

Read and follow my database cache for WordPress article to stay updated on the development of my Saotn DB Cache plugin (renamed from Database Cache Reloaded (Fix)). Full source code is freely available on Github.

Unfortunately I had to abandon this project.

Leave a Reply

Your email address will not be published. Required fields are marked *


*