Benchmarking 3 PHP Accelerators
jfbus writes "PHP, like all scripting languages, suffers from having to parse all script files each time a page is displayed. Accelerators (opcode caches) are necessary to speed PHP enough for large websites. Here is a benchmark of the major PHP accelerators (Zend platform, apc and eAccelerator)."
How does a function defined inside a condition get changed into opcode? Does it place a copy of both functions everywhere where Example() is called?
Registered Linux user #421033
from TFA: "Zend Platform has roughly the same performance as eAccelerator and apc (you'll have to believe me, I don't have any numbers to give you), but is the only one to have an official support (provided you pay for it...). Unless you need a real support, unless you need the specific features of Zend Plaform or you really want to pay for the software (one never knows...), you probably do not need Zend Platform. I don't like Zend setup process : it does change a lot of things within php.ini, does many hidden things. " and so on...
Is it just me or do they only benchmark eAccelerator vs apc (vs bare php), only mentioning Zend here and there? Not as useful as it might be..
This isn't something common to all scripting languages. For example, when Python scripts are executed, they are compiled to byte-code, and the result is saved for faster execution next time. Of course, in typical web hosting situations, the web server doesn't have permission to write to the filesystem, but you can quickly and easily compile the bytecode yourself. ASP.NET also compiles once only.
In fact, I believe it's an oddity of PHP that it needs add-ons in order to do this, and I think the next version of PHP will have fixed this. I don't know where they got the idea that all scripting languages must always parse the script on every invocation.
Bogtha Bogtha Bogtha
What about Turck MMCache?
So, to recap, folks, PHP is...
Speak for yourself, PHP weenie. My Perl code is parsed and "compiled" only when I restart the FastCGI handler(s) for my Catalyst web app(s). My templates are (I'm sure) parsed on each invocation though. The situation is probably similar for other real scripting languages e.g Python and Ruby.
MOD THIS POST UP.
Geminatron
I would very much like to see a comparison of the three against established performers in different languages. For example: mod_perl.
1;
For a few glaring examples where PHP doesn't give you even the most basic requirements for first-generation web language, there's no equivilant to ASP's Response.Redirect(). There's no equivilant to ASP's Server.MapPath(). The handling of forms with multiple fields of the same name (like checkboxes) is so hideously broken I don't know if I should laugh or cry.
I want to avoid saying that most PHP sites are amazingly insecure. Certainly, this must be a function of the pathetic losers who use PHP, instead of some function of the language. But after spending even a week on BugTraq, one begins to wonder exactly what most PHP developers are smoking when they write sites.
In short, I think PHP sucks. It's little suprise to me that the editors on this site find it so endearing.
http://nekovm.org/
I've tried to use these PHP accelerator thingies (except Zend's) on a large Horde/IMP installation. It turns out we started getting random bugs and disconnections, as well as corrupted data. Do these things even work? Specially with PHP5, object-oriented code and in a large system with thousands of simultaneous users?
But, it doesn't work with 5.1. And, 5.1's performance is pretty close to that of PHP 5 with eAccelerator(not php4 w/), and close to PHP 5 with. I can't wait for eAccelerator to come out for php5.1, but until then, APC compiles cleanly and works well. With a kickass control panel.
Zend's tragedy core dumps apache every 20 minutes.
Eh? I'm running Wikimedia 1.6.3 with PHP 5.1.4 and eAccelerator 0.9.5.b2 http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/ea ccelerator/ ...
OH I see.. I'm using a version that works fine with PHP 5.1+. Fairly quick on this quad-550Mhz Dell.
The only stupid part is updating from PHP 5.1.2 required a recompile of eAccelerator.
Variables global by default? Default variable $_? Auto-converting arrays to array_size in scalar context? Parentheses hell when using multi-dimensional arrays?
The most heavily used PHP/apache/mysql-type server on my network (probably never used by more than tweny hosts at a go) never seems to have any speed issues.
It's a modest machine. Dual 600mhz p3, 256mb of ram. How bad/good/busy do things have to get before a php accelerator becomes necessary?
Your bottleneck would be database load which varies per page (or per request). Typically, you wouldn't run into PHP performance issues with hundreds of users and your machine will probably run up against hard limits in your httpd.conf well before then. If you want a better answer, you can use the Apache benchmark tool ( $APACHEROOT/bin/ab ) to test your specific application and fill up your httpd logs.
what a waste of webspace.
And if you want to confuse lowly developers just omit that in a module and start throwing around implicit function compositions too:
sub fix_bad_words {
shift;
my $BADWORDREGEX = shift || "(fuck|shit|cunt)";
join map split $IFS, {/$BADWORDREGEX/ ? "*bleep*" : $_;}, $,;
}
Bonus points: So what does it do?
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
Ruby is not compiled like perl, python, PHP, pike, etc, etc, etc. It's interpreted line by line just like a shell script. This is one of the reasons why it is so incredibly slow.
(*: Which seems to be what PHP copied itself from, which actually explains a lot about PHP.)
:)
PHP was *not* copied from ASP. PHP was originally started in (late?) '94, and was growing in popularity by 1996, when MS introduced their HTC stuff. IIRC "ASP" wasn't in real use until some time in 1997, by which time PHP was widely used.
http://en.wikipedia.org/wiki/Active_Server_Pages says ASP 1.0 was out in Dec 1996. IIRC Rasmus has mentioned that some Microsoft engineers were on an early PHP dev mailing list soliciting input on what people liked/wanted in a web scripting system. However, I can't find any reference to that story anymore, and I might have just made it up in my head.
creation science book