View Single Post
Old 03-25-2009, 10:24 PM   #17 (permalink)
dschreck
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
dschreck is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
If by correctly, you mean making the intensive functions in C and adding them on, I would agree. But PHP is in and of itself slow because it is a interpreted scripting language. Even when cached, it is less efficient than hand written compiled code. The reason for this is that PHP code commands the PHP engine, not the machine.
No, I mean straight out PHP.

I've worked with PHP to serve millions of users a day. If by "slow" you mean in comparison C, then you're wrong again. If you're going for straight out speed, then just write it in ASM.

The reason for this is because the linux kernal will cache the data being served. You even have the ability to save the compiled PHP - so you don't need to continously recompile your scripts.

If you believe PHP is a "slow" language, maybe you're in the wrong business. PHP is extremely fast and flexible.

Now, don't get me wrong. In order to serve MILLIONS of users a day, you need several web servers, a couple memcache servers, and a few database servers.

You'll usually set up your Master / Slave DB's, and use them correctly (balancing the selects, using a bucket list)

Then you'll need a couple memcache servers, where you handle which users use which memecache server. (Aka: hashing)

Your web servers will need to all share the same code base, and have a load balancer pool them.

You can impliment things like caching, but I'm able to serve hundreds of thousands of requests without any caching (Daily).
__________________
Where I Ramble: http://www.iwilldomybest.com/
What I do: Zynga Game Network
Senior Software Engineer at CityVille
dschreck is offline  
Reply With Quote