About the Author

Chris Shiflett

Hi, I'm Chris, a web developer and a founding member of Analog. I live and work in Brooklyn, NY.


PHP and Scalability (Again)

There's an interesting blog entry on O'Reilly's web site discussing Digg's PHP Scalability and Performance. As part of his research, the author (Brian Fioca, a Java developer) interviewed Owen Byrne, cofounder and Senior Software Engineer at Digg, and built his own PHP application, Jobby.

Here are some quotes and interesting notes:

  • He used the WASP PHP framework.
  • Digg gets 200 million page views per month. (Yahoo gets billions per day.)
  • Digg uses 3 web servers and 8 database servers.
  • "None of the scaling challenges we faced had anything to do with PHP." (Owen Byrne)
  • "In fact, we found that the lightweight nature of PHP allowed us to easily move processing tasks from the database to PHP in order to deal with that problem." (Owen Byrne)
  • Digg uses APC and MCache.
  • "It turns out that it really is fast and cheap to develop applications in PHP." (Brian Fioca)
Note: See PHP Scales for some related content and discussion.

About This Post

PHP and Scalability (Again) was posted on Tue, 11 Apr 2006 at 01:30:22 GMT.

8 Comments

1. Nate Klaiber's GravatarNate Klaiber said:

Thats pretty incredible. It says alot about the power of PHP. I believe that with ANY language you choose - it takes a proper system to make it work. So, to those who always complain about PHP - the same could be said of those using ASP, CFM, or JSP - when used improperly it will result in poor performance.

I especially liked the statistics about their traffic and yahoos traffic - both sites receiving that much traffic, yet still very powerful and scalable.

Thanks for the good read...

Peace,

Nate

Tue, 11 Apr 2006 at 02:34:51 GMT Link


2. Chris Shiflett's GravatarChris Shiflett said:

By the way, I got the Yahoo statistics from Michael Radwin's talk at ZendCon:

http://shiflett.org/archive/162

In case you want a more reliable source. :-)

Tue, 11 Apr 2006 at 03:13:34 GMT Link


3. Mike Willbanks's GravatarMike Willbanks said:

One thing that I find extremely interesting is how server setup can make PHP applications either run into the ground or shine.

This also depends on the developer as well, sometimes a developer can write a PHP application and find that it will not scale due to the code logic and design.

Besides this there are definitely things to help in keeping the server(s) running great and fine tuned.

Squid-Cache is an excellent tool to keep the load down and having some HTTP Cache on the frontend.

PHP - Using MCache, APC and only compiling extensions that are needed. Also running it as an apache dso helps :)

Apache - Using a small webserver such as lighttpd to proxy image requests or static pages to will cut down apaches load. Loading only the modules needed. Tuning the performance settings properly for the environment that you will be encountering. Making the robots.txt file and excluding search engines from scanning your image directories.

MySQL - Performance tuning the configuration for your traffic amount and application needs, Rewriting queries that hit the slow-query log (this is not enabled by default), installing mtop (mtop.sf.net) and checking what mysql is doing during peak times to help optimize the configuration. Using indexes on fields that are routinely searched/limited by. etc...

I might have to write a blog entry later on all the different issues that normally come up as traffic increases!

Chris as always thanks for the link to this :)

Tue, 11 Apr 2006 at 12:20:16 GMT Link


4. Izman Haidi's GravatarIzman Haidi said:

There we go!!!

Yet another cool story about our lovely PHP.

But I still believed, to make a really good system, it does not mainly depend on the programmer, but combination of hard work from programmers, network guys and systems engineers.

It is not fair to blame PHP for all the mistakes in web apps.

But I'm wonder, why Friendster is so damn slow :)

Wed, 12 Apr 2006 at 08:35:53 GMT Link


5. Chris Shiflett's GravatarChris Shiflett said:

Brian's blog entry has now been Dugg:

http://digg.com/software/Good_Article_for_PHP_lovers

Wed, 12 Apr 2006 at 12:25:36 GMT Link


6. Stefan's GravatarStefan said:

I am trying to scale some of our servers and am finding the greatest problem we have is that after a good while our apache processes run at between 30-50 megs usage a process. This is quite the killer on the server. I have already started work to seperate the images and static content to a lighter server, however is there a way to track and findout which of our scripts, or files are causing apache to use the most amount of memory? This could be very helpful in cleaning up bloated code.

Wed, 12 Apr 2006 at 16:18:04 GMT Link


7. Mike Willbanks's GravatarMike Willbanks said:

Stefan,

You could always install X-Debug and run a profiling script on this. Also with MySQL you could use a slow query log which might make your processes run longer.

Also you should only enable extensions in php and modules in apache that you are using. Anything else is just taking up extra memory.

You also might want to think about using apache 1.x and compiling php as a static module if you want some more speed :)

Wed, 12 Apr 2006 at 18:40:48 GMT Link


8. Tom's GravatarTom said:

PHP Rocks!

Sun, 11 Jun 2006 at 06:03:37 GMT Link


Post A Comment

Personal Details and Comment

Style Guide

Line breaks are converted to paragraphs. Also use:

  • <a href="" title="">text</a>1
  • <em>text</em>
  • <blockquote><p>text</p></blockquote>
  • <code>2  <?php  if ($foo) {      $foo = TRUE;  }  ?></code>
  1. Note: <code> can be used inline (e.g. in paragraphs) or in a block as shown. Include whitespace and newlines in blocks.

Please enter Chris (my first name) below. This is a primitive spam prevention technique, and I apologize for the inconvenience.

Preview and Submit

Upcoming Talks

ConFoo

10 - 12 Mar 2010

At Hilton Montréal Bonaventure, Montréal, Canada.

South by Southwest

12 - 16 Mar 2010

At Austin Convention Center, Austin, Texas.

Dutch PHP Conference

10 - 12 Jun 2010

At TBD, Amsterdam, Netherlands.

O'Reilly Open Source Convention

19 - 23 Jul 2010

At Oregon Convention Center, Portland, Oregon.

New Comments

Chris Shiflett wrote:

Glad it helped, Niall!

Posted in Git on Snow Leopard
Niall Kelly wrote:

Having tried other methods without success and looked through plenty of bloated documentation, th...

Posted in Git on Snow Leopard
liukang wrote:

I have problem with this example. In my php.ini magic_quotes_gpc is off so i'm using only addsla...

Posted in addslashes() Versus mysql_real_escape_string()
RyanTheGreat wrote:

Well, I'm not Chris, but I will do my best to address the questions raised in the comments by Ian...

Posted in Security Corner: Cross-Site Request Forgeries
Chris Shiflett wrote:

Thanks for the kind words, Simon. I'm glad you liked the tutorial. In case it's helpful, here'...

Posted in Webstock

Browse Comments


Work and Books

Analog Essential PHP Security HTTP Developer's Handbook