5 ms·
Ask HN: How can I ensure my Ruby on Rails App will be scalable?
What steps can I take while I write my web app from scratch right now, to ensure that it scales beautifully when it is launched?
- MediaSquirrel 13y agoThis is the wrong thing to worry about. Scaling problems are EXCELLENT problems.
- pmtarantino 13y agoProbably because my 1st language is Spanish, but what do you mean by EXCELLENT? (in Spanish, "excelente" means "admirable")
- sillysaurus 13y agoIt's an execlente problem. If you're bringing in enough customers to cause you scaling problems, then that's a good position to be in.
- bhauer 13y agoIf you are worried about performance because it nags at you and not because you have a specific known performance pain, I would suggest selecting a higher-performance platform and framework so that you can defer scale concerns until much later. With a high-performance framework, you can build your application with the peace-of-mind that performance won't be a problem unless your product has decent market traction. A common problem I've observed several times with low-performance frameworks is that you can run into performance pain before you've adequately vetted your project's ability to convert customers. By comparison, a high-performance framework allows you to be experimental and relatively reckless with your application logic. Your application code can be closer to brute-force with a high-performance platform, meaning you can optimize the application code later when the time comes, rather than bringing out the big guns of scalability.
- tjr 13y agoWhich platforms / frameworks would you recommend over Rails ?...
- p_4lexander 13y agoI'd argue in favor of javascript based platforms/frameworks. Angular.js is a very powerful MVC (front-end) framework that's rapidly gaining popularity. If you combine that with a Node.js server written with something like express, you'll be cooking with gas in no time.
- iends 13y agoJVM languages.
- MattStopa 13y agoWhat are you suggesting is a higher performance platform? You may get 2-3 times faster with some other framework but you aren't going to see an order of magnitude increase and you are probably going to be sacrificing ease of development. Rails isn't the answer to every programming problem, but I don't think that Rails has any more of a scalability issue than any other framework.
- dragonwriter 13y ago> What steps can I take while I write my web app from scratch right now, to ensure that it scales beautifully when it is launched? That question is far to generic to have a useful answer. If you want to know how to design for scalability, you need to be more specific about what needs to scale and how than just "a Ruby on Rails web app". There are a number of different things that can scale in an application, and what you need to make one of them scale well may be counterproductive to scaling another one. OTOH, you are probably worrying about scalability at exactly the wrong time. You either should have a clear problem to address (which you haven't yet reached), or if you know what your scalability concern is before you've started writing your app (much less encountered an actual pragmatic problem), you should be asking that question before you choose the implementation language and framework (since particular choices there may be part of the solution.)
- artellectual 13y agoThere are a few rules I follow at the beginning of building an app. - avoid n + 1 queries - shorten response time as much as possible without caching (focus on good code, avoid logic etc..., least db queries as possible) - anything that takes longer than 100ms to process I use async processing to handle it.
- agibsonccc 13y agoI see this come up every so often. http://www.techempower.com/benchmarks/#section=data-r5 http://www.techempower.com/benchmarks/#section=data-r5 https://www.hnsearch.com/search#request/all&q=web+framework+benchmarks https://www.hnsearch.com/search#request/all&q=web+framework+... Performance really is relative. As they say: "If you always optimize for the future, you will never get there" Many high end sites are run on rails. Load balancing/clustering will handle most traffic problems you might run in to.
- MattStopa 13y agoThe main thing you need to do in order to prevent scaling issues are making sure you aren't making an absurd amount of queries per page request. I once worked on a project that was taking close to 10 seconds at scale. Turns out it was making close to 1000 DB queries per request because they were doing iterative logic and making 3-4 db calls per iteration (which was also being done in the view...) I moved it all into the controller and it was sub 1 second, and had about 80 queries left over. This is actually very common to see in Rails apps, even with some of the more prestigious consultancies out there. If you avoid doing things that absolutely won't scale you will be fine. Rails has no issues scaling, for 99.9% of the use cases. Regardless of the framework you use you will still have plenty of scaling issues if you have Twitter/Facebook level of success. But again that is a great problem to have.