Oct 152009

Php default behaviour is always re-compile our script everytime accessed by users/browsers. eaccelerator can increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Here’s how to install eaccelerator extension

$ wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6-rc1.tar.bz2
$ tar xjf eaccelerator-0.9.6-rc1.tar.bz2
$ cd eaccelerator-0.9.6-rc1
$ phpize
$ ./configure
$ make
$ sudo make install
$ cd /var/cache
$ sudo mkdir eaccelerator
$ sudo chown -R apache:apache eaccelerator

Continue reading »

Sep 102009

Apache includes a very useful tool for hammering the server. It’s called Apache Benchmark “ab” is the binary’s name and it can really hand a server it’s own ass if you don’t watch it.

$ ab -kc 10 -t 30 http://localhost/

That will open 10 connections, use Keep-Alive on them, and then hammer localhost for 30 seconds through those connections. When done,  you get a pretty little chart telling you what broke and how long it took to start screaming. you can increase number of connections or the duration time.

For best results, use it from another machine. You want to not only test the network connection but also leave the server’s CPU and OS to think about serving, not about pulling it down as well.