# Preliminary Apache 2 benchmarks

- Thread: https://externals.io/message/272
- Original archive: https://news-web.php.net/php.internals/272
- Started by Ilia A. on 2003-03-25T15:52:28+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #272 — Ilia A. — 2003-03-25T15:52:28+00:00

URL: https://externals.io/message/272#272

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

---

## #273 — Rasmus Lerdorf — 2003-03-25T15:54:05+00:00

URL: https://externals.io/message/272#273 · In reply to: #272

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

---

## #274 — Ian Holsman — 2003-03-25T16:31:10+00:00

URL: https://externals.io/message/272#274 · In reply to: #273

Hi Guys.

just a couple of questions about the test.

1. 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

2. 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.

3. what testing tool where you using ?

4. 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?
> 
> 
> 
> 
> > […]

---

## #280 — Ilia A. — 2003-03-25T21:12:52+00:00

URL: https://externals.io/message/272#280 · In reply to: #274

> 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
