The other day i had a discussion with someone about how fast Java-powered website are, because the code is compiled and serving a page takes a breeze. The point of discussion was me writing code using php, which is a scripting language and compiles code on-the-fly every time you make a request to the website.
So i decided to take a little experiment involving current LEMP (php-fpm/mySQL Linode VPS host) setup for the client’s WordPress blog and add eAccelerator to it.
Before the switch i turned off WP-Cache and recorded time it took my server to produce the same page three times to get the feeling of the average:
Same thing after the install was complete, again the WP-Cache is off:
Wow! Great numbers! Got surprised even more when the host load average reduced as well from say 0.20 to 0.12, even 0.07.
How to install eAccelerator on your host:
1. Download and unpack it:
cd /usr/src wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2 tar -xvjf eaccelerator-0.9.6.1.tar.bz2 cd eaccelerator-0.9.6.1 phpize ./configure make make install
2. Create a temporary folder for eAccelerator and let it write there:
mkdir /tmp/eaccelerator chown -R www-data:www-data /tmp/eaccelerator/
3. Find your php.ini and add the following in the end:
extension="eaccelerator.so" eaccelerator.shm_size="16" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"
4. Restart your php server:
/etc/init.d/php-fpm restart
That’s all! Let me know, if this helped to speed up your site.
1 Comment
Thank you, Oleksiy. Great instructions. I’ve been working on reducing load times. Going to give this a shot tonight. Thanks again.