Someone asked me for numbers when I mentioned the other day that Apache 2-prefork was really not a viable drop-in replacement for Apache 1.3 when it comes to running a PHP-enabled server.
Apache 1.3 is still significantly faster than Apache2-prefork for both static and dynamic content. Now, part of the blame goes to PHP here for the dynamic case. We are compiling PHP in threadsafe mode when building the PHP DSO for Apache2-prefork which is not necessary. It would be nice if there was an apxs flag that would return the MPM type. Right now we would need to parse the output of httpd -l or -V to figure out which MPM is being used. Being able to go non-threadsafe in PHP does speed us up a bit. But none of this has anything to do with the fact that Apache 1.3 is faster for static files. It's going to be very hard to convince people to switch to Apache2-prefork if we can't get it to go at least as fast as 1.3 for simple static files. Platform: Linux 2.4.19-pre8, glibc 2.2.5, gcc-2.96, P3-800, 128M Tested using ab from the httpd-2.0 tree with these flags: -c 5 -n 50000 -k 1024-byte file which looked like this: <html> <head><title>Test Document.</title> <body> <h1>Test Document.</h1> <p> This is a 1024 byte HTML file.<br /> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br /> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br /> cccccccccccccccccccccccccccccc<br /> dddddddddddddddddddddddddddddd<br /> eeeeeeeeeeeeeeeeeeeeeeeeeeeeee<br /> ffffffffffffffffffffffffffffff<br /> gggggggggggggggggggggggggggggg<br /> hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh<br /> iiiiiiiiiiiiiiiiiiiiiiiiiiiiii<br /> jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj<br /> kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk<br /> llllllllllllllllllllllllllllll<br /> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm<br /> nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn<br /> oooooooooooooooooooooooooooooo<br /> pppppppppppppppppppppppppppppp<br /> qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<br /> rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr<br /> ssssssssssssssssssssssssssssss<br /> tttttttttttttttttttttttttttttt<br /> uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu<br /> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv<br /> wwwwwwwwwwwwwwwwwwwwwwwwwwwwww<br /> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br /> </p> </body> </html> The PHP version was: <html> <head><title>Test Document.</title> <body> <h1>Test Document.</h1> <p> <?='This is a 1024 byte HTML file.'?><br /> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br /> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br /> cccccccccccccccccccccccccccccc<br /> dddddddddddddddddddddddddddddd<br /> eeeeeeeeeeeeeeeeeeeeeeeeeeeeee<br /> ffffffffffffffffffffffffffffff<br /> gggggggggggggggggggggggggggggg<br /> hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh<br /> iiiiiiiiiiiiiiiiiiiiiiiiiiiiii<br /> jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj<br /> kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk<br /> llllllllllllllllllllllllllllll<br /> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm<br /> nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn<br /> oooooooooooooooooooooooooooooo<br /> pppppppppppppppppppppppppppppp<br /> qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq<br /> rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr<br /> ssssssssssssssssssssssssssssss<br /> tttttttttttttttttttttttttttttt<br /> uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu<br /> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv<br /> wwwwwwwwwwwwwwwwwwwwwwwwwwwwww<br /> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br /> </p> </body> </html> Note the fact that the Apache2 static test produced the wrong number of total bytes. 3072 bytes too many??? Where in the world did they come from? The PHP test on Apache2 produced the correct number as did both static and PHP on Apache1. Apache 2 PreFork ---------------- KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 15 MaxRequestsPerChild 0 ---------------- STATIC ---------------- Concurrency Level: 5 Time taken for tests: 23.793270 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 49511 Total transferred: 66681859 bytes HTML transferred: 51203072 bytes <=========== Uh? Requests per second: 2101.43 [#/sec] (mean) Time per request: 2.379 [ms] (mean) Time per request: 0.476 [ms] (mean, across all concurrent requests) Transfer rate: 2736.87 [Kbytes/sec] received ---------------- PHP ---------------- Concurrency Level: 5 Time taken for tests: 125.831896 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 0 Total transferred: 63250000 bytes HTML transferred: 51200000 bytes Requests per second: 397.36 [#/sec] (mean) Time per request: 12.583 [ms] (mean) Time per request: 2.517 [ms] (mean, across all concurrent requests) Transfer rate: 490.87 [Kbytes/sec] received Apache 1.3 ---------- Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 15 MaxRequestsPerChild 0 ----------- STATIC ----------- Concurrency Level: 5 Time taken for tests: 19.735772 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 49507 Total transferred: 66127818 bytes HTML transferred: 51200000 bytes Requests per second: 2533.47 [#/sec] (mean) Time per request: 1.974 [ms] (mean) Time per request: 0.395 [ms] (mean, across all concurrent requests) Transfer rate: 3272.08 [Kbytes/sec] received ----------- PHP ----------- Concurrency Level: 5 Time taken for tests: 81.240240 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 49508 Total transferred: 62777865 bytes HTML transferred: 51200000 bytes Requests per second: 615.46 [#/sec] (mean) Time per request: 8.124 [ms] (mean) Time per request: 1.625 [ms] (mean, across all concurrent requests) Transfer rate: 754.63 [Kbytes/sec] received -Rasmus
