Modern Ruby on Rails is Fast

| Shey Sewani | Toronto

Ruby on Rails does not have a reputation for performance, but modern Rails is fast. I recently ran a load test against HTTPScout, my Rails-based uptime monitor, and the results were unexpected– p99 latencies under 35ms for the landing page which included a call to the database to load the pricing plans.

The Setup

HTTPScout runs on a VPS with 2 vCPUs at 3.79 GHz. It uses Puma, configured with 2 workers and 2 threads per worker, and Nginx with 2 workers. HTTPScout is a Rails 7.1.x app, running on Ruby 3.2 with YJIT enabled and jemalloc for memory optimization. The app uses PostgreSQL 15 as its database, and both the app and the database are hosted on the same server.

Load Test Results

Using Vegeta, I simulated 70 requests per second for 60 seconds from my local machine. Rails processed 4200 requests to the landing page, with a mean latency of 12.5ms and p99 at 33.9ms!

A decade ago, getting a landing page to load in under 100 ms with similar traffic was impressive, and having a p90 of 300ms meant you were a Rails master.

Vegeta Load-test Results

Host Metrics

htop

During the test overall CPU utilization remained around 25%, leaving plenty of room for additional traffic without needing to upgrade the server.

Why This Matters

These load test results show that modern Rails handles heavy traffic with low latency and efficient CPU use. A p99 latency under 40ms shows Rails can perform well. With optimizations like YJIT, jemalloc, and improvements in Ruby, Rails is no longer slow and resource-heavy.

In short, modern Rails is fast and no longer the slow framework it once was.