php performance
In a recent post about PHP, Tim Bray mentions PHP’s upsides:
…it’s written for the web, it’s easy to deploy and get running, and it’s pretty fast.
“Pretty fast”, in my opinion, is an understatement. I was working on a (Java-based) messaging gateway a few years ago — not massive loads like you’d get in the US, Europe or Asia, but pretty impressive for this neck of the woods. My app was intended for messages with more complicated & dynamic workflow, while a colleague was working on a simpler PHP system, for raw throughput, where the logic was fixed, and less complicated. My recollection was that even for simple processing, I was never able to push the throughput higher than about 180 messages per second on the (single) target server. That was with the best examples I was able to find on java nio, a lot of profiling, load testing, optimisation (where it made sense), and comparison of different approaches (nio, standard sockets, alternate libraries, etc). On the other hand, my colleague’s application was about 10-20% faster almost without him trying and I recall the final result being close to 40% faster once he’d figured out the best way to do it.
Okay the goals were different, my app inherited a lot of overhead by providing more functionality, but it was still an eye opener at the time. Under the right conditions (and for certain purposes) PHP is more than just “pretty fast”. A better adjective is “blistering”…
(Small print: I still prefer Python…
)



So it *is* “pretty fast”. Sheesh.
So you are saying, PHP is blistering fast, because it out-performs a Java application that is having more overhead to provide more functionality? That does not sound very scientific to me.
I am not pro-Java, but I just find your approach to prove PHP’s speed amusing. However I do find, when you start adding more complicated logics into an existing PHP application, its performance will drop dramatically without heavy hacking and refactoring. Especially in applications that will benefit from lots of in-memory shared resources.
–Scott
> I am not pro-Java, but I just find your
> approach to prove PHP’s speed
> amusing.
Hello? You do realise this is a weblog entry? Who said anything about it being “an approach” to prove anything (or needing to be scientific, for that matter)?
I was merely providing a bit of anecdotal evidence that PHP is more than just pretty fast under certain conditions.
As it is, I don’t think I explained the circumstances properly anyway — what I meant to illustrate was that for simple processing (where the overhead of the additional functionality actually didn’t amount to much more than a hill of beans), the message throughput was still higher on the PHP application (which at that point hadn’t been vigorously optimised).
Like I said though: certain conditions.
[...] [...]