After installing RH61 on a new box yesterday along with apache and
mod_perl I decided to test cgi-bin vs mod_perl again.. here are the
results:
the perl file, t.pl was:
--------------------t.pl-------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body bgcolor=\"#ff5050\">";
print "this is a test";
-------------------------------------------
I called it 10000 times, using 300 concurrent connections to a stock
Redhat installation of Apache (I didn't change the number of Apache
children or tune it in any way).
cgi-bin:
The load on the machine went up to 73.26 and the tests took 53 seconds.
Out of the 10000 requests, 4471 failed. It did 185.36 requests per
second, and transfered 87.68 kb/s.
Mod_perl:
The load on the machine went to 5.9 and the tests took 35 seconds. All
requests completed.
It did 285.19 requests per second, and transfered 61.32 kb/s.
PHP3:
As a comparision, I created the same script in php3.
The load on the machine went up to 18.69 and the tests took 35 seconds.
All requests completed. It did 284.62 requests per second, and
transfered 61.20 kb/s.
Notes:
Perl on its own has always been known as a dog under heavy loads as the
perl interpreter has to be loaded on every request.
mod_perl has always impressed speed wise.
PHP3 is very fast, but not up to mod_perl speeds. PHP4 is supposed to be
much faster.
The tests were carried out over a 100Mbit switched LAN, the server is a
PIII500 with 256MB RAM, with an IDE disk.
Don't trust benchmarks :)
There you go, choice is a wonderful thing. I'll still code a web
application in PHP but for stuff that gets a heavy pounding I'd look
seriously at mod_perl.
Donncha.
PS. recording this for my own benefit as well..
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!