Rails performance resources

Rails Performance Optimization Resources

Practical Rails performance optimization guides, measured case studies, and consulting for slow requests, PostgreSQL queries, N+1s, jobs, and memory.

Slow Rails applications rarely have one universal fix. The bottleneck may be repeated Active Record queries, a PostgreSQL plan that no longer fits the data, expensive Ruby work, overloaded background jobs, excessive allocations, or time spent in an external service. Effective Rails performance optimization starts by measuring the affected workload and locating where the time or capacity is actually going.

This page collects my practical Ruby on Rails performance articles and case studies in one place. The lists below are generated from content tagged with both Ruby on Rails and Performance, so newly published material appears here automatically.

What these Rails performance resources cover

The technical guides explain how to investigate specific problems, including N+1 queries, PostgreSQL query plans, counting large datasets, and profiling Ruby call stacks. The case studies document changes made in real codebases, with the original bottleneck, implementation approach, validation method, and upstream source where the work is public.

Use the guides when you are investigating the problem yourself. Use the case studies to see how similar issues were measured and corrected in existing applications. Results from one workload should not be treated as a promise for another: data shape, traffic, infrastructure, and application behavior all affect the outcome.

A reliable optimization process is straightforward even when the diagnosis is not: define one user-visible symptom, capture a comparable baseline, profile the complete path, implement the smallest well-supported change, and measure again. Query count, request latency, database execution time, queue latency, throughput, allocations, and memory are useful metrics only when they match the problem being solved.

Technical writing

Rails performance guides

6 resources
Guide

Using speedscope.app to Profile Ruby and Rails

A request that takes 900 ms tells us that something is slow, but not where the time went. A call-stack profiler supplies the missing data, and speedscope turns that data into an …

Ruby on RailsRubyPerformanceProfiling
Guide

Understanding The Output of EXPLAIN As a Rails Developer

Rails Active Record is a powerful ORM that simplifies database operations, but complex queries can sometimes lead to performance issues. We can use EXPLAIN to find out details …

Ruby on RailsPostgreSQLPerformanceQuery Plans
Guide

Cheat Sheet for Rails + PostgreSQL Count Performance

The convenience and power of Active Record allows you to interact with your database in a more Ruby-like way, making it easier to write efficient and readable code. However, as …

Ruby on RailsActive RecordPostgreSQLPerformance

Measured work

Rails performance case studies

8 case studies
Forem

Reducing role queries across Forem’s role-heavy paths

An open source Rails performance optimization that made role checks association-aware across Forem’s admin member list, CSV export, async user payload, and reCAPTCHA service.

Ruby on RailsPerformanceOpen SourceN+1 Queries
Forem

Making Forem’s cold analytics backfill 10× faster

An open source Rails performance optimization that replaced per-article analytics recomputation with bulk SQL aggregation, cutting median backfill time by 90.1%.

Ruby on RailsPerformanceOpen SourcePostgreSQL
Gumroad

Cutting Gumroad Sales API response time in half

An open source Rails performance fix that removed N+1 queries from Gumroad’s sales endpoint while preserving its API response.

Ruby on RailsPerformanceOpen SourceN+1 Queries