good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I guess everyone here knows what merlyn thinks about
PHP: "Training wheels without the bike". This is easy to say
for someone like him, but in fact PHP is really popular, and
there must be a reason for this.
Today I took some benchmarks to see how PHP compares against mod_perl, and the results are quite interesting. (I probably wouldn't have posted them here, but some folks on the chatterbox demanded them.) I have two scripts, that do the same thing: they connect to a MySQL address database and show a list of entries. They produce the same output. One is written in PHP, the other one is written in Perl, using CGI.pm and running as an Apache::Registry script under mod_perl. The benchmarking tool I used is "ab", the Apache Benchmark that comes with the Apache distribution. I didn't tune the server at all, leaving default entries for configuration details like MinSpareServers (5), MaxSpareServers (10), StartServers (5), MaxClients (150), MaxRequestsPerChild (0). I simulated 10 users, where each user will make 10 requests, so we have a total of 100 requests. Each script was tested several runs, and these are the average numbers of requests per second that Apache could handle:
This was quite a shock to me. It means that the PHP script is almost twice as fast than the Perl script! Where has the famous performance of mod_perl gone? I didn't want to believe this, so I hacked a third script, all in all a copy of the Perl script, only different in that I didn't use CGI.pm this time, but vanilla Apache methods for parameter handling, headers setup and so on. The results look like this:
Wow, this is a big performance gain, isn't it? Almost the same script, but without CGI.pm. I'm curious if it can get faster when I make it a real content handler instead of an Apache::Registry script, but I didn't have the time for that.
Used hard- and software: In reply to Training wheels again by le
|
|