Avatar

Harper Reed's Blog

Rails woes. The slow that is keeping twitter down.

· 955 words · 5 minutes

Please note: This post was written some time ago (17 years ago). My perspectives, knowledge, and opinions may have evolved significantly since then. While the content might still offer valuable insights, I encourage readers to consider it in the context of its publication date.

I have a love and hate relationship with Ruby on Rails. I love what it does. I love the activerecord, I love how it makes designers and other non-software engineers into raving MVC lunatics. I really like coding in ruby and seeing how much work can get done by so little code. All of that is really exciting. However, I hate a lot about rails as well. I do not like that it is so slow. I don’t like that you use a reverse proxy and mongrel (I can’t put a finger on why I don’t like this - but for some reason I want to punch it). I really don’t like the fan bois who won’t listen to any reason when you criticize their first and probably only love. I don’t like how hard it is to scale. I really don’t like that the best known way to scale a rails app is by throwing more money at it. I am also still bitter about the not so smooth migration from .95 to 1.0.

In my book, I am more annoyed than happy with rails. So I stopped using it.

When I did stop using it, my servers were happier. After converting all my applications I converted to rails back to PHP - my server load dropped amazingly. I didn’t even have big applications. Maybe one app that had a couple 1000 visits a day. nothing too fancy. but the little traffic it had really abused my server. annoying. One side effect of the PHP migration is that my applications responded a bit snappier - which in turn generated more pageviews. It was magical.

I do have to say that I was sad to be back in the wild west of scripting that PHP is. I missed my MVC and my activerecord. However, I wasn’t about to sacrifice what rails took from me.

Twitter growthWith all this said, It is kind of sad that twitter is getting owned so hard because they decided to use rails as their weapon of choice. It seems that they have assembled the biggest and most successful rails app on the Internet and are sustaining quite a number of pageviews. This is awesome. But ever since SXSW, where twitter seemed to pick up some seeming unstoppable steam, their growth has been the bane of their existence. I can’t imagine that new users are as impressed and interested in twitter when their experience is tainted by slowness and missing features. I wonder how this is affecting their continued growth?

So the other day, one of the twitter engineers had a really great interview about twitter, their growth and their future. It is very insightful and covers some interesting ground. It is always helpful to hear how other people are solving problems and it always helps the community to hear criticism and success. The interview had both of this. It explained how they had basically outgrown their ideas of growth and were dealing with scaling issues. He said that their issues were related to having too many mongrel connected to the database which was then killing things. This is not a new problem in the world of webapps. In fact, this very problem is where we at Threadless are having problems. And we are running PHP. OMG.

So obviously there is a performance hit when using rails. But there is a performance hit when using any interpreted language. And even more a performance hit when using a framework. and then it doesn’t help that ruby is slower. but these things don’t really mean that a site can’t scale. It just means that you have to solve the problems a bit more interesting (and being interesting might very well be moving to python).

This is rails chance to show the world that they can scale a real world app. That they are not second place to some weird guitar named framework. But I don’t think they will do that.

Personally, I think that the rails community blows. I think that they are not helpful and I don’t think they are willing to take criticism positively. I mean look at what erupted from this great developers smart interpretation of who his beloved application had scaling problems. The community rebelled and basically said that twitter needs to do the work themselves.

This is type of reaction is exactly my experience when dealing with rails. The difference that I experienced when I dealt with rails versus when I dealt with PHP, is that PHP people are like

"Oh yea. this is why this happened. check out the solution."
or maybe they are like
"Oh shit. That is weird. Maybe try this. if you figure anything out let us know."
but regardless of what the response nobody says:
"Obviously you are doing it wrong. Its probably your database. fix it. "
However, this is exactly how the rails community has responded to twitter's issues. Nobody really constructively addressed the twitter issue. They all just waited until DHH said his word. and then blindly followed. They called the people who questioned trolls and then jumped into line behind DHH. The twitter people even came to DHH's blog and apologized for possibly misconstruing that rails was slow. however, rails is slow.

I think some of the best points on this whole thing is the following (paraphrased from somewhere 1, 2, 3):

Rails is great because it trades developer performance for framework performance. Rails is good enough for almost every application. However, if you get big enough - rails will suffer. If you are writing an app that may get big, you may want to choose a different framework.
With that said, I am going to go play with web.py.

#ruby-on-rails #performance #scalability #software-engineering