Not sure if anyone has noticed this – might or might not be a good thing – but I have upgraded the server hosting this blog. Externally, nothing much has changed but underneath, things have changed quite a bit. The reason for the upgrade was due to the last server, constantly choking under any slight increase in load. The new server is cheaper too.
The specs for the new server are not all impressive, but it is good enough for hosting a simple blog. There is 128MB of RAM and 256MB of swap. It runs 32-bit Debian Lenny as the OS and has MySQL with Lighttpd and PHP5. It runs smoothly with two threads of PHP managing all the connections. I have stress tested it with siege and it gracefully handles about 10 concurrent connections with a response time of under 3 seconds.
Maybe this is a good time for me to describe my methodology for tuning a web server.
Firstly, I run
siege -g example.com to see if the site is working correctly. This is useful for debugging the entire web stack because it will also display the HTTP headers sent and received.
Next, I simulate a random series of connections by using
siege -i -c 5 example.com to simulate a number of concurrent connections. While I am doing this, I am also running
htop on the server to monitor the server load and resource consumption.
Finally, I hammer the server with increasing number of concurrent connections using
siege -b -c 10 example.com while continuously monitoring the server load and the response times. I tweak the numbers until performance drops.
That gives me some statistics that I can use as a benchmark. Then, I tweak the server settings and repeat the siege to get new numbers. Rinse and repeat until the desired concurrency and response times are achieved.
Lifting the server siege... done.
Transactions: 502 hits
Availability: 100.00 %
Elapsed time: 151.08 secs
Data transferred: 6.40 MB
Response time: 1.50 secs
Transaction rate: 3.32 trans/sec
Throughput: 0.04 MB/sec
Successful transactions: 502
Failed transactions: 0
Longest transaction: 6.09
Shortest transaction: 0.76