views:

126

answers:

3

Is there a good modern comparison (last couple years) of how Java performs and scales relative to PHP in a modern web application environment (Twitter, Facebook, COMET push)

Is there any type of canonical web application that would be best to compare the 2 languages?

(Full disclosure: I'm primarily a Java developer and I've worked with some high performance Java web application servers like Jetty and NETTY and I have the gut feeling that it blows away the basic PHP Apache stack in terms of number of connections and low-latency response especially in COMET server push applications).

Obviously when really attempting to compare the two in a massively scalable environment you would need to include other persistence and cache tiers (MySQL, Memcached, Terracotta, MongoDB).

I'm curious pound for pound how many HTTP requests/connections can a single Java web application server (Grizzly/JETTY) versus a PHP web application server (I'm not sure what high performance options there are for Apache).

I'm also curious if the front end web application technology matters in the scalability equation or does caching and persistence play a bigger role in the scalability equation.

+1  A: 

I cant really answer your question, as I do not know much about Java web development. But to think that PHP can't scale is a big misunderstanding.

To prove my point here are some high traffic websites that are built with PHP:

  • Facebook
  • Wikipedia
  • Yahoo
  • Photobucket
  • Digg
  • and the list could go on
Petah
Well facebook uses PHP BUT their hiphop utility compiles most of the php code into native code which gives them resourcesavings of about 50%
ITroubs
Yes that's true, but raw PHP execution speed is not normally the biggest problem. It comes down to a lot of different factors, such as the number of HTTP requests (per page), database accesses, caching, etc...
Petah
+4  A: 

You can have a look here, at shootout benchmark, for performance comparison.

As far as scalability is concerned, I like you to visit this SO thread.

Adeel Ansari
I like the fact how Java is significantly faster but uses significantly more memory and code. Mind you memory and code are relatively cheep compared to speed (in some cases).
Petah
igouy
A: 

a web server on a commodity machine should be able to server 1000+ requests/second with no problem. note that that's a very low number - it's about ~ one ~ million ~ CPU cycles just for one request.

Java or PHP shouldn't matter here. However, I doubt Ruby and alike can reach 1000 req/sec.

But 1000 req/sec is way too high anyway for underlying layer. On facebook, each webserver serves 10 page/sec on average. One page may involve multiple requests, but still, the performance of the web layer doesn't seem to be the bottleneck.

irreputable