Based on bug #22815, which talks about unsatisfactory performance of the 
apache 2 sapi, I've decided to conduct several benchmarks to determine the 
depth of the problem.

Based on my tests (ran using 4.3.2-cvs on 1Ghz celeron) it appears that the 
apache2handler is indeed slower.

The test script used was
<?php
for ($i=0; $i<100;$i++) {
        echo $i;
}
?>

This script resulted in a 270 byte header being generated in addition to 190 
bytes of actual content.

Apache 2 filter (the original apache 2 sapi) was able to handle 143 
requests/second, while Apache2handler (newer & more stable sapi) could handle 
only 133 requests/second. This represents aproximately 7% performance loss 
for rather small request.

My next test was an attempt to determine the performance difference for larger 
requests that one may encounter in real life situations.

Test script #2
<?php
        $str = str_repeat('a', 4096);
        for ($i=0; $i<8; $i++) {
                echo $str;
        }
?>

With Apache 2 filter I was able to send between 150-167 requests per second, 
each request comprising of header 270 bytes and content 32768 bytes, with a 
Net I/O: 4895.8 KB/s. The increase in perfromance can be explained by a 
significantly lower number of calls to the output function and tunning the 
output to benefit the most from output buffering.

Same test with Apache 2 handler resulted in:

Request rate: 132.0 req/s (7.6 ms/req)
Reply rate [replies/s]: min 117.4 avg 132.0 max 152.3
Net I/O: 3915.6 KB/s
CPU time [s]: user 7.63 system 38.92 (user 10.1% system 51.4% total 61.5%)


All tests were conducated 10 times a piece and a total of 10000 requests were 
sent during each test instance.

Ilia

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to