Scaling rails apps

Published on Feb 13, 2025

Should I end up forgetting the firefights I’ve been through, or the months of planning anticipating the big marketing event, I can always come back to this post and remember the lessons I’ve learned.

Scaling Rails apps

1. Measure, measure, measure

It’s just absolutely stupid to try to scale up your rails app without knowing what’s going on. At the very outset one needs to measure:

  1. Latencies
  2. Resource usage
  3. Throughput

1.1 Latencies

Quickest measurement is to meausre the time taken for page loads on browser. Keep in mind: Real life traffic is many users using your app all at once. This means, time taken to serve a page varies depending on the load on your server. 95th percentile is a good measure to see how your app is performing under load. Latency distribution – a graph with x axis as latency and y axis as number of requests. Shows you visually if all requests are slow or just a few are slow.

1.2 Resource usage

Measure CPU and Memory usage on your server. If things look odd – also look at the DISK I/O and Network I/O performance of your servers. Higher IO can cause higher CPU Wait times - and increase CPU load.

1.3 Throughput

How many requests can your server handle at a time? Learn basics of queuing theory.