I started to title this as ‘approaches to scaling rails’, but realized
it’s not really a rails specific problem.
I’m currently working with a small team designing the architecture for
our application. A previous version of this product was rolled
out to a smaller user base using another framework, so we have a
pretty good idea of the basic traffic patterns, data models, etc…
But now we are going to expand it to a much larger scale, and we
already have clients committed to using it.
So basically we are debating how much scalability to put in now versus
later, and naturally we don’t all agree. I’m very much in favor of
retaining what’s good in rails as much as we can, even if we have to
do some extra work on the backend to make that happen. My attitude is
that keeping the benefits that we get from a framework like rails
should be a primary goal, not an afterthought. The folks who have
worked a lot on distributed systems and spent less time on the web
side tend to see it differently. They are quicker to build in the
scaling right from the start and toss out whole chunks of rails such
as activerecord and a good part of the template/rendering system.
Doing things like fetching 90% of the data via ajax calls directly to
the backend, and not having rails deal with much of the data/content
at all. They don’t want to use an rdbms at all and think very little
of MVC. In their eyes these are just natural sacrifices you have to
make if you want to scale.
My approach is pretty much the opposite. Use rails as it’s designed
to be used from the start, and add in scalability later. If you need
to design certain things to scale from the start, then put some time
into seeing how you can make it work with rails instead of tossing out
rails if it doesn’t work with what you know.
A couple of concrete examples of the different ways we are approaching
some scaling issues.
The backend folks want to start with a flattened/hierarchical data
store and not use an rdbms at all. Some of this isn’t even a scaling
issue, they don’t even like using a relational system to represent
data models. While I agree that eventually it will make sense to move
some data out of the database, I don’t agree with just dumping the
rdbms entirely from the start.
Then we have the guys who want to do everything in javascript. The
rails template system would pretty much just spit out the template and
async ajax calls would go directly to the backend. Javascript would
not only be used for fetching the data, but for most of the display
logic.
So anyways it’s a challenging debate for me. It’s difficult to convey
the advantages of a coherent framework like rails to guys that haven’t
spent much time using a web framework, and I think that’s a big part
of the problem.
Chris