CentOS 6, httpd-2.2 and php-fpm

When your webserver is receiving a lot of traffic and began slow your website down, you might be consider to switch mod_php with php-fpm. First get mod_fastcgi from rpmforge Install php-fpm Configure php-fpm Rename mod.php to mod.php.bak that will disabled mod_php. Configure mod_fastcgi in /etc/httpd/conf.d/fastcgi.conf. add these lines at the…

Graphing ApacheBench Results Using GnuPlot

Ab / ApacheBench is a tool commonly used to perform benchmark by many people. unfortunately, the results are displayed somewhat difficult to read by most people. but it can be tricked by turning it into a plot image. this time, I will make examples how to change the results of apachebench into a form of image plots using gnuplot. although apachebench’s report is very helpful, we need to output the data in a parse-able format. To do this we use the -g switch which will output a gnuplot-friendly tab delimited table of data.

First we need to installed gnuplot if we don’t have it yet.

$sudo yum -y install gnuplot

In this example i’ll benchmark request on static png file.

Run first webserver benchmark

$ ab -k -n 50000 -c 100 -g server1.txt http://server1/server1.png

Run second webserver benchmark

$ ab -k -n 50000 -c 100 -g server2.txt http://server2/server2.png

Example result server1.txt/server2.txt

starttime       seconds ctime   dtime   ttime   wait
Tue May 10 16:42:28 2011        1305020548      0       2       2       2
Tue May 10 16:42:28 2011        1305020548      0       2       2       2
Tue May 10 16:42:28 2011        1305020548      0       3       3       2
Tue May 10 16:42:28 2011        1305020548      0       3       3       3
Tue May 10 16:42:28 2011        1305020548      0       3       3       3
Tue May 10 16:42:28 2011        1305020548      0       3       3       3
Tue May 10 16:42:28 2011        1305020548      0       3       3       3
Tue May 10 16:42:28 2011        1305020548      0       3       3       3

Apache stress test

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. [bash] $ ab -kc 10 -t 30 http://localhost/ [/bash] That will open 10 connections, use Keep-Alive…