January 26, 2007
Digg, Facebook, Scaling, and PHP
I made two web site performance observations today:
- Digg is slow. Try searching for anything during the day. Half the time you get a "try again later" message.
- Facebook is lightning fast. Always has been.
Let's see. Both sites are Web 2.0. They both have a high average hits/visit mark. And, by virtue of spending way too much time on the internet, I know they both run PHP and MySQL. If apples were apples, both sites would behave the same. There is something greater at work here.
I decided to poke around the internet a bit. I found a blog criticizing Digg for not properly engineering their system (cites howstuffworks.com). Then we have oreilly.net reporting Digg has no scalability issues. Interesting. We'll let Digg's load times speak for themselves.
On the flip side, we know that PHP scales. There is also Facebook's load time.
What's the difference? The Facebook engineers are better. How do I know this? Because they use and contribute to such applications as memcached, APC, and xdebug. If you are a serious PHP programmer, you know that these tools are critical for optimization and scalability. Not only was Facebook smart enough to use these tools, they were able to identify weaknesses and shortcomings in the current tools and improve upon them! When the tools said no more could be done, they didn't take "no" for an answer and squeezed out more power. Amazing.
Although I'm sure Digg uses some of these tools and has some excellent engineers, if I had to hire a group of engineers, I would start by shopping for Facebook employees.
Bottom line: When using the right tools, PHP can transition from an easily-maintained-scripting-language to an easily-maintained-scripting-language-that-can-scale-easily-and-save-you-a-lot-of-money. To make this happen, you need to employ some handy tools. Without these, your site will surely succumb to the "Digg Effect" and you will be forced to buy new hardware. Employers, if you are going to hire a PHP programmer, it is a good idea to ask them the open-ended question, "how do you build and optimize a large-scale PHP system?" If they don't mention 2 of the 3 tools from above, don't even consider them (other notable answers include using a HTTP cache and fine-tuning Apache config parameters).
Finally, if anybody from Facebook is reading, thank you for contributing to the invaluable tools that us serious PHP programmers use every day.
Trackback
You can ping this entry by using http://blog.case.edu/gps10/mt-tb.cgi/12439 .