| Vijay Ramachandran ( @ 2009-05-05 14:11:00 |
Scaling software
I recently went through the very interesting description of Facebook's photo hosting stack. It reminded me, yet again, how scaling web software is both simple (in concept) and difficult (to practice) at the same time. Here's a simple conceptual framework to follow which will solve an estimated 80% of web scaling problems:
:)
Some tips while fixing bottlenecks -
Of course, there are probably lots of unique cases which can't be solved so easily conceptually.
More resources - Cal Henderson - ex-flickr, yahoo - has a great presentation on web scalability. There are lots of others available as well.
Comments welcome!
Of course, there are probably lots of unique cases which can't be solved so easily conceptually.
I recently went through the very interesting description of Facebook's photo hosting stack. It reminded me, yet again, how scaling web software is both simple (in concept) and difficult (to practice) at the same time. Here's a simple conceptual framework to follow which will solve an estimated 80% of web scaling problems:
- Identify your bottleneck. Is it cpu, disk, memory, network bandwidth?
- Fix it!
- Repeat
:)
Some tips while fixing bottlenecks -
- Memory access is orders of magnitude faster than disk access.
- Your memory should be enough to hold your working data set (which typically follows extreme power laws - say, 99-1 - compared to actual data set), so its important to determine your working data set size.
- Design your system to be able to scale various layers independently.
- Watch out if you've configured your web server (apache is the one that I use) to be able to use too many server processes. Context switching and swapping will kill you under high load
- Do high load tasks as infrequently as you can. For instance, load some back lookup table once at startup time. Or, open a MySQL database once per http request, and reuse it for all db access during that request.
Of course, there are probably lots of unique cases which can't be solved so easily conceptually.
More resources - Cal Henderson - ex-flickr, yahoo - has a great presentation on web scalability. There are lots of others available as well.
Comments welcome!
Of course, there are probably lots of unique cases which can't be solved so easily conceptually.