Re: EmbPerl, PHP continued...

1999-11-23 Thread Rasmus Lerdorf

> RESULTS:
> 
> - Results are "Requests per second".  I'm not sure how to
>   interpret the numbers on an absolute scale, but the relative
>   comparisons should be somewhat meaningful.
> 
> - Each test was conducted 5 times and the average is shown.
> 
> - "ab" was used from the same machine as the web servers because
>   something "strange" happened when I ran it on another machine.
>   (I'll send a separate email regarding this.)
> 
> 
>1000 requests, 1 concurrent
>   ab -n 1000 -c 1 
>   --
>   Test1  Test1(b) Test2 Test3Test4Test5
> ---
> Apache w/ 
> modperl/  852.86 99.53217.2516.9678.1218.32
> EmbPerl  
>   
> Apache w/ 836.47100.06560.7816.1598.7618.80
> PHP  
> 
> AOLServer 100.01 99.72100.0612.89   156.3014.29
> 
>   
> 
>1000 requests, 10 concurrent
>   ab -n 1000 -c 10 
>   --
> 
>   Test1 Test1(b)  Test2 Test3Test4 Test5
> 
> Apache w/ 
> modperl/  890.37248.00262.4730.31158.5045.17
> EmbPerl   
> 
> Apache w/ 957.30492.55559.7123.81268.3434.64
> PHP  
> 
> AOLServer 758.54227.76816.65 5.97141.19 7.45

Well, I think it shows nicely that mod_perl-EmbPerl and PHP are in the
same ballpark.  This has always been my impression as well.  PHP tends to
be quicker on short simple scripts which your results also show while PHP
3 was not very efficient at handling large loops.  This is reflected in
your Test 3/5 numbers there where PHP is a little bit slower.  But,
certainly not by a factor of 10-20 as some people like to say.  And this
looping deficiency has been fixed in PHP 4.  PHP 4 also brings an optional
interpreted script cache along with an optimizer which can help out with
really complex and time-consuming scripts.

By the way, PHP 4 also works as a module in aolserver now (Zeus coming 
soon).  Would be interesting to see if PHP could beat aolserver's built-in
tcl engine.

One thing that might be interesting to see would be the peak memory and
cpu usage for each one.  That would give some indication of scaleability
issues.  I have no idea how PHP will fare here.  ;)  Some improvements
were made in PHP 4 in this respect though.

-Rasmus



EmbPerl, PHP continued...

1999-11-23 Thread Robert Locke


Hi all,

I was looking for some performance data for EmbPerl, PHP, etc. but
could only find "Hello World"-type tests.  So, I decided to add a few
other tests to the mix and post the results.

These test results are still very crude.

Any feedback/analysis/criticism would be appreciated.

Thanks!

Rob


MACHINE:
Dual Pentium III 500 MHz
256 MB RAM
RedHat 6.0 (Linux 2.2.5-15smp)


DATABASE SERVER:
Postgres 6.5.2


WEB SERVERS:
Apache w/ mod_perl, EmbPerl (using Apache::DBI)
- Apache/1.3.9 (Unix) mod_perl/1.21

Apache w/ mod_php (using persistent DB connection call)
- Apache/1.3.9 (Unix) PHP/3.0.12

AOLServer 2.3.3 (supports persistent DB connection)
- NaviServer/2.0 AOLserver/2.3.3
- threw this one in just for kicks


RELEVANT APACHE SERVER SETTINGS:
MinSpareServers 20
MaxSpareServers 35
StartServers 20
MaxClients 150
MaxRequestsPerChild 0
PerlSetEnv  EMBPERL_OPTIONS 8082
PerlSetEnv  EMBPERL_ESCMODE 0
PerlSetEnv  EMBPERL_DEBUG   0


TESTS:
Test 1- Static HTML
Test 1(b) - Static HTML with special extension
Test 2- Hello World
Test 3- Big Print
Test 4- Small Database Query
Test 5- Big Database Query

Test 1: Static HTML
- This is a 6K HTML file called "test1.html".
- No embedded code here.

Test 1(b): Static HTML with extension
- Identical to the static HTML file in every way
*except* that extension is changed to ".epl",
".php3", or ".adp" according to web server.
- No embedded code here.

Test 2: Hello World
- Simple test to print "Hello World".
- For each of EmbPerl, PHP, AOLServer:
[+ "Hello World" +]

<% ns_puts "Hello World" %>

Test 3: Big Print
- 1000 iterations of incrementally printing "a":
a
aa
aaa

a
aa
...

- As an example: here's the EmbPerl code:
[-
for($i=0;$i < 1000;++$i) {
$a = $a . "a";
print OUT $a, "";
}
-]  

- Returned page was approximately 500 K.

Test 4: Small Database Query
- Fetch and display 1 record from a products database of about 300
  records, searching for an exact match on an indexed field.
- Returned page was approximately 5K.
- Used persistent db connection in all cases.

Test 5: Big Database Query
- Fetch and display 24 records from a product database of about
  300 records, using a "like" search on a text field.
- Returned page was approximately 118K.
- Used persistent db connection in all cases.


RESULTS:

- Results are "Requests per second".  I'm not sure how to
  interpret the numbers on an absolute scale, but the relative
  comparisons should be somewhat meaningful.

- Each test was conducted 5 times and the average is shown.

- "ab" was used from the same machine as the web servers because
  something "strange" happened when I ran it on another machine.
  (I'll send a separate email regarding this.)


 1000 requests, 1 concurrent
ab -n 1000 -c 1 
--
  Test1  Test1(b) Test2 Test3Test4Test5
---
Apache w/ 
modperl/  852.86 99.53217.2516.9678.1218.32
EmbPerl  
  
Apache w/ 836.47100.06560.7816.1598.7618.80
PHP  

AOLServer 100.01 99.72100.0612.89   156.3014.29

  

 1000 requests, 10 concurrent
ab -n 1000 -c 10 
--

  Test1 Test1(b)  Test2 Test3Test4 Test5

Apache w/ 
modperl/  890.37248.00262.4730.31158.5045.17
EmbPerl   

Apache w/ 957.30492.55559.7123.81268.3434.64
PHP  

AOLServer 758.54227.76816.65 5.97141.19 7.45