In response to the on going flame war pertaining to the stability and usability of Apache 2 in comparison to Apache 1 I've decided to conduct a series of benchmarks to try to determine exactly how the two Apaches compare. The purpose of the test was to determine which server is faster at serving static HTML pages, who's real-time compression implementation is better and of course which is more suited for running PHP applications. The full details of the test are available below, but here is a quick summary of the results.
1) Apache 2 is about 4% faster then Apache 1 at serving static pages.
2) Apache 2's mod_deflate is over 60 percent faster then Apache 1's mod_gzip at real time compression of static HTML pages.
3) Serving PHP via Apache 2 is 27 percent slower then via Apache 1 DSO and 31 percent slower then Apache 1 static.
How the test was conducted?
For the purpose of the test I've used clean installations of PHP 4.3.10 compiled with the following common flags "--disable-cgi --disable-cli --without-pear". The sapi options ranged from --with-apxs (Apache 1 DSO), --with-apxs2 (Apache 2 DSO apache2handler), --with-apache (Apache 1 static).
The Apache1 was compiled with --enable-module=so and --enable-module=rewrite, --activate-module=src/modules/php4/libphp4.a was added for static build PHP build. Apache 2 was compiled with --with-mpm=prefork --enable-rewrite --enable-so --enable-deflate. During the compilation of all software -O2 optimization flag was used.
Apache configuration used are the stock configs from the regular build, with modifications to add PHP and mod_gzip (Apache 1) support and making Apache 2 bind to port 8080.
The "victim" server was Celeron 1ghz with 768 megs of ram running Linux 2.6.8-rc2. For each test a total of 10 runs were performed each making 10000 requests, concurrency level ranging from 10 to 100 requests. The test software used is ab (Apache Bench) revision 1.73.
Here is a PDF with a chart of the
raw results and a graph for comparison purposes. The raw results, test scripts, etc... can be found in
this archive.
廖宇雷的weblog on : Apache1 å’Œ Apache2 的性能差è·â€”—PHP 在 Apache2 ä¸æ€§èƒ½é™ä½Ž 27%,惊人啊ï¼
:: onpk :: blog PHP, MySQL, développement web & connexe(s) on : Du côté de PHP en 2004