| I hate when people tell me that Rails doesn't scale because I have scaled Rails and it has nothing to do with the framework. The reason why websites can't scale is ALWAYS the DB. To fix the DB it is always master/slave, memcached, then sharding. For EVERY language. Good article, sums up a lot of the tools I used to scale my stuff. I'd like to add a little more. 1. Turn on slow-query logging in your DB and tail -f the slow query log. Find slow queries and kill them in your code through indices or using several fast queries to make up for 1 long-one. 2. Cache most reads. Both from application caching and memcached. 3. Turn off associations, they don't play well with caching. 4. If you're using memcached, don't use the plugins. 5. If you're a serious startup, use Engine Yard, they're life savers. |
This isn't necessarily a killer, but it means there's sometimes more work than you might like in scaling. There are patches to tune the garbage collector, and JRuby etc. may help, but ultimately you need to be much more aware of memory allocation than you might think.