Even when now running a WordPress installation with a (from my point of view) very fancy and clean design I was a bit dissapointed by the loss of speed compared to my former CMS installation of Contao (former Typolight).
In this post I like to shortly introduce you to the actions I performed to regain some performance again.
But first, please find a result of the Apache Benchmark (AB) that Markus just performed against my domain:
ab -n 10 -c 2 https://seiler.it/
[…] Requests per second: 1.52 [#/sec] (mean)
Time per request: 1316.331 [ms] (mean)
Time per request: 658.165 [ms] (mean, across all concurrent requests)
Transfer rate: 0.45 [Kbytes/sec] received
Connection Times (ms)min mean[+/-sd] median max
Connect: 25 27 2.0 27 31
Processing: 1251 1289 43.1 1277 1372
Waiting: 1251 1289 43.1 1277 1372
Total: 1277 1316 42.9 1303 1399Percentage of the requests served within a certain time (ms)
50% 1303
66% 1305
75% 1305[…] 100% 1399 (longest request)
You can start with enabling WordPress caching plugins. To come to first results, I suggest to just take easy-to-manage plugins. I installed „WP Super Cache“ and „Use Google Libraries“ for speeding up the hosted website. Compared to the first Apache benchmark, the response time of seiler.it is now eight times faster:Enabling WP caching
ab -n 10 -c 2 https://seiler.it/[…] Time taken for tests: 0.915 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 365890 bytes
HTML transferred: 362350 bytes
Requests per second: 10.92 [#/sec] (mean)
Time per request: 183.079 [ms] (mean)
Time per request: 91.540 [ms] (mean, across all concurrent requests)
Transfer rate: 390.34 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 45 45 0.1 45 45
Processing: 138 138 0.5 138 139
Waiting: 47 47 0.2 47 47
Total: 183 183 0.5 183 184Percentage of the requests served within a certain time (ms)
50% 183[…] 80% 183[…] 100% 184 (longest request)PHP APC
I am using a Ubuntu 12.04 LTS (Precise Pangolin) on my server. Somehow in your case the following steps might be different, depending on your server settings.
- Install PHP Pear and LibPre3 via:
sudo aptitude install libpcre3-dev php-pear
- Install APC via php-pear
pecl install apc
I used the standard options to all questions asked during this process. If everything went the right way, you should see something similiar to:
Build process completed successfully
Installing ‚/usr/lib/php5/20090626+lfs/apc.so‘
Installing ‚/usr/include/php5/ext/apc/apc_serializer.h‘
install ok: channel://pecl.php.net/APC-3.1.9
configuration option „php_ini“ is not set to php.ini location
You should add „extension=apc.so“ to php.ini
root@matrix:/daten#- In the next step, we are adding a basic configuration to your PHP installation. In my case, I touched a apc.ini in /etc/php5/conf.d/,
cd /etc/php5/conf.d
touch apc.phpadding the following content:
extension = apc.so
apc.enabled = 1
apc.include_once_override = 0
apc.shm_size = 256- After that you have to restart your webserver, checking if everything works fine.
service apache2 restart
- You can check the current status, by copying a status webpage to a web readable folder in your installation (please change the password in the file!)
cp /usr/share/php/apc.php /a/webdir/on/your/server/apc.php
And here are the result with both plugins enabled and the PHP APC added to the server configuration
ab -n 10 -c 2 https://seiler.it/[…] Benchmarking seiler.it (be patient)…..done
Server Software: Apache
Server Hostname: seiler.it[…] Concurrency Level: 2
Time taken for tests: 0.377 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 365890 bytes
HTML transferred: 362350 bytes
Requests per second: 26.52 [#/sec] (mean)
Time per request: 75.406 [ms] (mean)
Time per request: 37.703 [ms] (mean, across all concurrent requests)
Transfer rate: 947.71 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 17 21 2.4 21 25
Processing: 44 51 7.6 48 62
Waiting: 21 22 1.7 22 26
Total: 61 72 9.2 69 85Percentage of the requests served within a certain time (ms)
50% 69
66% 77
75% 81
80% 85[…] 100% 85 (longest request)Conclusion
Compared to the WordPress Caching, I got additonal 2,2 times faster by enabling PHP APC. Taking into account some inaccuracy during the multiple tests I did during the speed up process of the webpage, the average speeding up between no caching at all and PHP APC, „WP Super Cache“ and „Use Google Libraries“ enabled is about 16 times faster (when taking the „longest requests“ into account). Even, when this might not be true for all webs I am hosting on my server, there is still a significant increase in performance that you can „feel“.
What I did, was downloading the apc object cache drop in file and used it in my functions.php for my theme.
The apc.php was not found on my server at your direction. I am still searching for it
[root@hosting relaunch]# find / -type f -name apc.php
Anyways thanks for your article, I am going to try the plugin, which you do recommend.