NYCPHP Meetup

NYPHP.org

[nycphp-talk] advice on scaling up

Rob Marscher rmarscher at beaffinitive.com
Wed Jul 18 15:36:44 EDT 2007


Hi Marc,

Pretty much all of my work is with social networking type sites... so  
I can chime in a little bit.  First off, in my experience the number  
of requests per second that can be handled by these apps is usually  
much less than your typical web app.  With it running on one server  
without major caching, we have a tough time handling more than 60-80  
requests per second.  This is because so many pages (at least for us)  
provide a portal of information that is very dynamic.

So... if you're not using APC... I'd recommend popping that in on  
your server for good measure... however, you might not notice much of  
an increase in the requests per second though because it is most  
likely database/disk i/o bound.  The main thing that will speed up  
your application is caching those database queries and objects.  If  
you're not doing any of this right now, I'd recommend making the leap  
straight to memcache (rather than a file based caching system)  
because ultimately this is the way to scale caching in a large  
setup.  Another step that will quickly alleviate stress while you're  
building out your caching solution is to separate your web server  
from your database server.  I think the number one thing you want  
with a database server is fast disk i/o.  Memory is nice on a db  
server to increase the various caches... however, (we're talking  
mysql here?) the mysql query cache gets invalidated so fast on a lot  
of your tables do to all the updates that usually happen in a social- 
networking system that you need a programmed cache solution that you  
can control when data is stale (hence the memcache recommendation).   
Another thing to consider is denormalizing certain parts of your  
database to eliminate certain complex joins and calculations you  
might find yourself having to do... this has really sped up parts of  
our applications.

The suggestion to have a static server is a good one as well as you  
can use a light web server tuned to serve the static content rather  
than the heavy apache processes loaded up with the php module +  
extensions.  It can also serve as a master server for all user  
uploaded content (i.e. user uploads content, regular server handles  
it, then moves the file to the static content server).

Good luck and post any findings/issues that come up because I'm sure  
a lot of us are interested in this topic.

-Rob




More information about the talk mailing list