Hacker News new | ask | show | jobs
by pbh 5379 days ago
I'm not an expert, but this is what I've cobbled together as a fellow Ruby/Rails startup person.

Fault Tolerance: Just use Heroku. We've seen maybe an hour of downtime in a few months?

Speed (and fault tolerance): Cache everything you can, assets on S3/CF.

Testing: Rails Test Prescriptions by Noel Rappin [http://pragprog.com/book/nrtest/rails-test-prescriptions]. Then you can choose what you like, but I like Test::Unit, Mocha, FactoryGirl.

Code Abstraction: Rails is already pretty sensibly organized, and if MVC + tests + static assets is not a good fit for your webapp, you really should not be using it in the first place. One minor point: Noel and others will tell you to use skinny controllers.

Curious what other people consider best practice for Ruby/Rails startups.

1 comments

"Cache everything you can"

This is terrible advice. Telling developers to cache everything is like walking into a rehab clinic with Lindsay Lohan's purse.

Cache what you can measure as having a performance problem, which can't be optimized in another way. It should always be used as a last resort.

Sure, of course, premature optimization is the root of all evil and all that. I presume you're reacting to a bad experience in the past you had with some young developer not understanding database indexes or memoizing everything unnecessarily or something. I certainly don't want to create another one of those experiences!

That said, he asked about how to get web application speed. One major answer (as discussed elsewhere in this thread) tends to be "add a cache somewhere." Of course, you have to architect things right so the cache works (possibly with a layer of indirection like app servers, or figuring out where a cache would be helpful, etc.) and the code that the cache is obviating needs to be slow in the first place.

That said, the general rule (add a cache for speed and scalability) has been the case from Slashdot to MovableType/Wordpress to Facebook to App Engine.

Caching is probably one of those things that if you have to be told to do it, you probably shouldn't be doing it.