Linked by David Adams on Wed 14th Dec 2011 16:01 UTC, submitted by fran
Internet & Networking PHP's popularity and simplicity made it easy for the company's developers to quickly build new features. But PHP's (lack of) performance makes scaling Facebook's site to handle hundreds of billions of page views a month problematic, so Facebook has made big investments in making it leaner and faster. The latest product of those efforts is the HipHop VM (HHVM), a PHP virtual machine that significantly boosts performance of dynamic pages . And Facebook is sharing it with the world as open-source.
Thread beginning with comment 500201
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Database
by tony on Thu 15th Dec 2011 18:51 UTC in reply to "RE: Database"
tony
Member since:
2005-07-06

Well, the front end PHP servers are usually (always?) stateless, which means they can be scaled trivially by running clusters of mirrored web servers in parallel. The same sort of scalability is not nearly as trivial for databases, and for that reason they tend to be much more problematic.

However that said, PHP is extremely inefficient. It's worse than java or .net by a factor of roughly 100 according to the "average" row in the following benchmark:

http://www.csharp-architect.com/images/benchmarksJan2009Final.gif

So, with some hand-waiving, we'd expect a VM version of PHP to significantly reduce the quantity of PHP servers required to service a given load, and the excess servers no longer needed could be redeployed as less heavily loaded database servers.

This makes a lot of sense for an entity like facebook and shared hosting providers where they run servers at max capacity.


Those functions in the benchmark, how often is PHP required to do computationally complex operations? Most of the time it's rendering HTML and pulling data from or pushing into a database. Very simple stuff. We're not calculating Pi to the millionth digit or calculating jump coordinates with PHP. I can't imagine you see any difference in a basic web page with a DB back-end using PHP or compiled C.

And Java has always seemed slower to me in implementation. Such a resource hog, and what's worse as a sysadmin I have very little idea of what's going on inside the Java engine. Neither do the developers, either it seems. So when stuff goes wrong, it goes way wrong.

Reply Parent Score: 2

RE[3]: Database
by Alfman on Thu 15th Dec 2011 20:56 in reply to "RE[2]: Database"
Alfman Member since:
2011-01-28

tony,

"Those functions in the benchmark, how often is PHP required to do computationally complex operations?"

Consider things like dynamically generated graphics (like captcha). If PHP is the wrong language for that, what is the right language? Is that language available in your hosting package?

Most PHP pages do very little at a time, like maintaining shopping carts and constructing SQL strings, but aggregately the inefficiencies do add up, especially when the level of inefficiency is great.

I'm a little surprised that I'm the only soul here who seems to care about language efficiency. Oh well, it's a sign of the times.

Reply Parent Score: 2

RE[4]: Database
by tony on Fri 16th Dec 2011 00:17 in reply to "RE[3]: Database"
tony Member since:
2005-07-06

tony,

"Those functions in the benchmark, how often is PHP required to do computationally complex operations?"

Consider things like dynamically generated graphics (like captcha). If PHP is the wrong language for that, what is the right language? Is that language available in your hosting package?

Most PHP pages do very little at a time, like maintaining shopping carts and constructing SQL strings, but aggregately the inefficiencies do add up, especially when the level of inefficiency is great.

I'm a little surprised that I'm the only soul here who seems to care about language efficiency. Oh well, it's a sign of the times.


Image generation typically uses a linked module compiled into PHP, written in C or C++, so there's no slow down there.

Again, all the heavy lifting is done in the database. Language efficiency isn't much of an issue in those cases. For instance, you can write a PHP-based web page that creates self-signed certificate and keys. The actually SSL happens in a binary module, not in PHP itself.

If you move the heavy lifting (sorting, etc.) into the application layer, then Java would be a more appropriate language. Or some functions written into C modules attached to PHP or other language.

Reply Parent Score: 2