Ruby on Rails is a great framework for startups, but we often hear people talk about Rails scalability issues when a startup project grows too large (read: becomes very popular). One of the key events that triggered the discussion that Rails can’t scale was when Twitter switched to Scala in order to handle their growing number of user requests. But as counterexamples, we would like to mention that Shopify is an advanced Rails application that has scaled quite well many years in a row. So who’s right? Do you need to ditch Rails if your app goes big?

Let’s take a look at how to scale a Ruby on Rails application to find out.

What Is Rails Scalability?
A framework’s scalability is the potential for an application built with this framework to be able to grow and manage more user requests per minute (RPM) in the future. Actually, it’s incorrect to talk about framework scalability or Ruby on Rails scalability, because it’s not the framework that must, or can, scale, but rather the architecture of the entire server system. But we should acknowledge that, to a certain extent, Ruby on Rails application architecture does have an impact on scalability.

Let’s take a look at the example below. This is what the entire server architecture looks like at the very beginning of a Rails project.

What we usually have is a single server, on which we install the following software:

This server computer will be able to cope with, say, 1,000 or even up to 10,000 requests per hour easily. But let’s assume that your marketing is very successful, and your Rails application becomes much more popular; your server starts getting 10 or 100 times more requests. When the load increases to a high enough level, a single server architecture cracks under pressure. That is, the Rails application becomes unresponsive to users.

That’s why we’ll explain how to resolve this scalability issue – serving data to users – with Ruby on Rails.

Let’s scale your Rails application! Vertical scalability with Rails
Scaling vertically is the simplest way to make the server handle an increased number of RPMs. Vertical scaling means adding more RAM, upgrading the server’s processor, etc. In other words, you give your server computer more power. Unfortunately, this approach doesn’t work in many situations, and here are a couple of reasons why.

Vertically scaling a server running a Rails app gives a positive effect only at the initial stage. When your traffic increases yet again, you eventually come to the point when upgrading the processor or adding more RAM is technically impossible.