Wednesday, December 24, 2008
Uh-oh! Can Rails (RoR) Handle the Load?
People have always been talking about Rails and its ability to handle scaling (here, here, and here). I was a skeptic of these haters. Because I had always made the assumption that good design would lead to good performance. I might be putting my foot in my mouth shortly.
We ran some preliminary stress tests on our site this past week. And the results were, well, unimpressive to say the least. In fairness, we're not caching everything at this point and haven't done everything we can to tweak performance, but we should have had a better go of it.
The main problem seems to be the sheer volume of database accesses. Rails just loves to talk to the database. In fact, almost everything is in the database, which is the major problem. MySQL has turned out to be our biggest bottleneck, which I guess you can blame on Rails, right?
A few things to note: We're running our DB and our application on the same box for the time being. We're using a server in the cloud, which is not really a dedicated server. So those play into the cards.
We're currently implementing memcache, starling, and workling as ways to help us boost our performance. But implementing caching requires a reworking of a lot of our code. So that's not cool.
All in all, I love developing on Rails. Is it enterprise ready? Jury will remain out on that one - for now. But I tend to think it is if you're a good architect. Twitter seems to have solved their problems. Which I initially thought was probably based on their design rather than RoR. So, did Twitter drop RoR? Nobody seems to know. Again, I remain in the camp that thinks scaling Rails is doable. I'm just not a pro at it yet. And we're going to have some growing pains, as we would with any technology.