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
What are the numbers for Apache 1.3 for the same tests?
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
Hi Guys.
just a couple of questions about the test.
-
was the code-base exactly the same except for the sapi handler (ie..
your not comparing 4.3.1 against cvs-head) I'm assuming this is true -
how many machines were you using to run your test. if you were
running the test from the same machine, then you can't really trust the
results. -
what testing tool where you using ?
-
can you do me a favor, and re-run the same benchmark on a php file
which has NO php inside of it.
my guess is that we are being too streamy. (ie.. passing the output as
soon as we get it, instead of just pushing it in a big chunk)
#4 should show this if it were true.
BTW.. most of the code for the apache2 sapi's are identical, it's only
the creation of buckets which is different.
also.. while I've got your guys attention.. there are a lot of bugs
coming up about using a threaded version of apache2 hanging on startup
with cvs-head... I thought this was working ok on 4.3.1.. any idea on
what might have changed in TSRM ?
Regards
Ian
(ps..grabbing a snapshot now and trying the tests out on a couple of
boxes over here)
Rasmus Lerdorf wrote:
What are the numbers for Apache 1.3 for the same tests?
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
also.. while I've got your guys attention.. there are a lot of bugs
coming up about using a threaded version of apache2 hanging on startup
with cvs-head... I thought this was working ok on 4.3.1.. any idea on
what might have changed in TSRM ?
This problem was resolved this morning and I believe we've began generating
working ZTS Apache 2 sapi for win32 based on the handler sapi.
Ilia