Perl vs PHP speed?

J

Jan

We expect about 570 new visitors every minute on our web page
containing a form, 17 of these will press a submit button to invoke the
PHP (alternatively CGI perl).

Would you expect the performance hit to noticeable at this volume, thus
we should consider a cgi-bin perl instead of PHP (parser is loaded).
Perl is after all never invoked unless submit is pressed.

We would also like to store the referrer in a cookie when someone
enters the page, this could be done with PHP. Maybe javascript is
quicker (avoiding PHP parser)?
 
J

J. Gleixner

Jan said:
We expect about 570 new visitors every minute on our web page
containing a form, 17 of these will press a submit button to invoke the
PHP (alternatively CGI perl).

Would you expect the performance hit to noticeable at this volume, thus
we should consider a cgi-bin perl instead of PHP (parser is loaded).
Perl is after all never invoked unless submit is pressed.

We would also like to store the referrer in a cookie when someone
enters the page, this could be done with PHP. Maybe javascript is
quicker (avoiding PHP parser)?

Nothing to do with perl, however any time you can serve a static page,
it'll be faster than anything else.

No one can accurately answer your question, with the information you
provided, besides this is the wrong newsgroup to discuss your Web site's
performance. Your best bet is to benchmark your design yourself. Apache
comes with a nice benchmark application called 'ab', which might prove
useful.
 
M

Matt Garrish

Jan said:
We expect about 570 new visitors every minute on our web page
containing a form, 17 of these will press a submit button to invoke the
PHP (alternatively CGI perl).

Would you expect the performance hit to noticeable at this volume, thus
we should consider a cgi-bin perl instead of PHP (parser is loaded).
Perl is after all never invoked unless submit is pressed.

17 form submissions a minute? Doesn't sound like a lot, but it would depend
on how well/poorly written your script is, how much data and validation is
involved, etc., etc. etc.

As for Perl vs. PHP, life's not that simple. Are you talking about starting
a new instance of the perl interpreter for each request? Or is this a
mod_perl environment? PerlIS? Perl with FastCGI? And for PHP are you using
mod_php? Are you using the Zend Platform? Are you...

And are there multiple servers handling these requests? And what kind of
servers are they? And...

Do you see why you're not likely to get any kind of meaningful response? You
should do your own benchmarking of both if you really want to know (if
you're just testing one form, it shouldn't be too onerous to construct a
Perl and PHP equivalent).

Matt
 
J

Jan

17/minute is not that much when using CGI-BIN (not mod_perl). Perl
interpreter is only invoked for the 17 submit requests. While the PHP
parser is invoked for all 570 visitors, with some cookie manufacture,
the PHP will perform even more work.

We will not use any databases and the page itself is static HTML, only
cookie creation and form submit are the "active" elements. If PHP is
not noticibly slower or less stable, it seems like a functionally easy
solution (cookies with javascript does not work with browsers with
scripts turned off).
 
B

Bart Lateur

Jan said:
We expect about 570 new visitors every minute on our web page
containing a form, 17 of these will press a submit button to invoke the
PHP (alternatively CGI perl).

Would you expect the performance hit to noticeable at this volume, thus
we should consider a cgi-bin perl instead of PHP (parser is loaded).
Perl is after all never invoked unless submit is pressed.

Note that a Perl CGI script has an overhead of about 200ms (on my
computer) just to get a script started. Even if it's nothing but a
"hello world" script. That's an advantage that PHP has.

If you want comparable results, think of using modperl, or, for a
lighter and very specific setting, things like pperl or SpeedyCGI, or
fastCGI, which all keep a copy of the script in memory. (The former 2
are on CPAN, for the latter, search for CGI::Fast. Maybe there are more
alternatives I don't know of.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top