Monday, February 23, 2009

12 Good Ideas for Scaling Rails

Building and Scaling a Startup on Rails: 12 Things We Learned the Hard Way

The HTTP protocol lets you tell browsers what static content they can cache. You set this in apache. Rails automatically will put timestamps in the IMG / javascript / CSS tags, assuming you're using the helpers. The Firefox plugin YSlow coupled with Firebug are your friends here. The improvement is significant and well worth your time, especially if you add gzip'ing. 100KB initial page load can be brought down to 5K (just the HTML file) on subsequent clicks around your site.
Fix your DB bottlenecks with query_reviewer and New Relic
This basically saves your ass completely. Everyone complains that Rails is slow. Rails is not slow, just like Java Swing is not slow. Rails makes it easy to shoot yourself in the face. If you do follow-the-textbook-example bumbling around with Rails ActiveRecord objects, you will end up with pages that drive 100 queries and take several seconds to return.

Very good post, definitely worth reading.

Related: Ruby on Rails Tutorials - Joy in Work for Software Developers

1 comment:

Mike Malloy said...

Thanks for the shout about the RailsLab site. We hope you and your readers enjoy the videos about scaling and performance improvement.
Mike Malloy - New Relic