(2) KUSANAGI Benchmark: Nginx + PHP 7
Next, switch the middleware configuration to Nginx + PHP 7.
kusanagi nginx
The command to switch to Nginx + PHP7 (kusanagi php7 was left out because we did it in step 1 already).
Execute the ab command below three times at ten second intervals.
ab -n 300 -c 30 http://ec2-xxx.xxx.compute.amazonaws.com/
In my environment, the requests per second on the third ab command was 178.42.
(3) KUSANAGI Benchmark: Apache + HHVM
Next, switch the middleware to Apache + HHVM (HipHop Virtual Machine).
kusanagi httpd kusanagi hhvm
The command to switch the middle ware to Apache + HHVM.
Execute the following ab command twelve times at ten second intervals. The reason for this increase is that HHVM needs time to warm up. It creates byte-code while using a JIT compiler, which makes it execute faster over time. Beginning with the second ab command, the page load time will get faster and faster.
ab -n 300 -c 30 http://ec2-xxx.xxx.compute.amazonaws.com/
In my environment, the twelfth ab command produced 182.59 requests per second.
(4) KUSANAGI Benchmark: Nginx + HHVM
Next, switch the middleware to Nginx + HHVM.
kusanagi nginx
The command to switch the middleware to Apache + HHVM (kusanagi hhvm was left out because we did it in step 3 already).
Execute the following ab command three times at ten second intervals.
ab -n 300 -c 30 http://ec2-xxx.xxx.compute.amazonaws.com/
In my environment, the third ab command produced 218.7 requests per second.
(5) KUSANAGI Benchmark: Adding pagecache to Nginx + HHVM
Next, we will turn on page caching for the environment from (4). We will activate “bcache”, the custom plugin for KUSANAGI.
kusanagi bcache on
The command to activate page caching in the Nginx + HHVM environment.
Execute the ab command. In order to alleviate variation in our measurements, we increase the requests from 300 to 10,000 and simultaneous connections from 30 to 100. Execute the command three times at ten second intervals.
ab -n 10000 -c 100 http://ec2-xxx.xxx.compute.amazonaws.com/
In my environment, the third ab command produced 2048.26 requests per second.
(6) KUSANAGI Benchmark: Enable Nginx FastCGI Cache
We will now enable Nginx FastCGI Cache and perform our last benchmark test. Use the following command to activate Nginx FastCGI Cache.
kusanagi fcache on
The command to enable Nginx FastCGI Cache
Execute the following ab command three times at ten second intervals.
ab -n 10000 -c 100 http://ec2-xxx.xxx.compute.amazonaws.com/
In my environment, the third ab command produced 19,160.72 requests per second.
Let’s compare these results to those of our previous tuning efforts.
Benchmark Results: Requests per Second | Previous tuning results | KUSANAGI |
---|---|---|
Apache+PHP 7 | 148.08 | 172.06 |
Nginx+PHP 7 | 151.07 | 178.42 |
Apache+HHVM | 195.05 | 193.12 |
Nginx+HHVM | 205.20 | 218.7 |
With page caching | 2566.17 (WP SiteManager) |
2048.26 When using custom KUSANAGI plugin “bcache” |
With Nginx FastCGI Cache | 12672.30 | 19160.72 (fcache) |
With some slight discrepancies, we were able to produce very similar results to our previous speed-tuning benchmarks. Each one of the tuning techniques we introduced is not difficult to implement on its own, however implementing all of them requires some time and effort. Skipping all of this work and creating a WordPress environment that is instantly ultra-fast and up-to-date is one of KUSANAGI’s big merits.
Next time, we will go beyond the basics and explain more about how to use KUSANAGI, installing the currently popular Always-On SSL, the high-speed transfer protocol HTTP/2, and using Let’s Encrypt for free SSL certificates. Stay tuned!