Rails Performance Audit: A 30‑Point Checklist (LCP/INP/CLS)

Everything we measure when we tune Rails apps—database, caching, background jobs, and the Core Web Vitals that users actually feel.

Posted By: Ahmad Hassan, Founder & Principal Consultant, September 2, 2025

Rails Performance Audit: A 30‑Point Checklist (LCP/INP/CLS)

Introduction


Performance is product. Here’s our battle‑tested checklist for Rails apps that want LCP ≤ 2.5s, INP ≤ 200ms, and CLS ≤ 0.1—without guesswork.


1) Measure First


  • CrUX & PageSpeed field data for key pages
  • APM traces (New Relic/Datadog): p95 latency per endpoint
  • Error rate and slow queries; sample traces

2) Database


  • Add missing/composite indexes; remove duplicates
  • Kill N+1s (bullet, rack-mini-profiler)
  • Partition/archive hot tables; tune autovacuum
  • Read replicas carefully—watch staleness

3) Caching & Assets


  • Page/fragment caching with cache keys (avoid time‑based expiry)
  • Redis TTLs & memory policy sanity check
  • CDN for static assets; correct Cache-Control & ETag

4) Background Work


  • Move heavy work off request cycle (Sidekiq)
  • Idempotent jobs with retries/backoff
  • Dedicated queues for critical paths

5) Frontend Vitals


  • Inline critical CSS; self‑host fonts with font-display: swap
  • Image width/height + lazy loading (except hero); use next/image
  • Break up long tasks; avoid hydrating huge bundles

6) Release Engineering


  • CI < 10 min with test splitting & caching
  • Canary deploys + feature flags + error budgets
  • Build once; promote between envs

A Minimal NGINX/Cache Header Tweak


location ~* \.(js|css|png|webp|jpg|svg)$ {
  add_header Cache-Control "public, max-age=31536000, immutable";
  try_files $uri =404;
}
location / {
  add_header Cache-Control "no-store";
}

30‑Point Checklist


  • All hot queries have indexes; N+1s fixed
  • Redis keys scoped; eviction policy appropriate
  • Hero images ≤ 120 KB, WebP/AVIF used
  • Fonts self‑hosted; display: swap
  • Core Web Vitals monitored in RUM (p75)
  • Canary deploy path + rollback verified
  • APM traces sampled with error budgets
  • Queues sized for peak; dead letters empty

Conclusion


Performance isn’t a sprint; it’s a habit. Start with measurement, fix the biggest regressions, and guard the wins in CI/CD and observability.




Written by Ahmad
Ahmad Hassan, Senior Ruby on Rails expert with 10+ years of experience. He builds web and mobile applications using React, Next.js, and TypeScript, and contributes to backend development using Python and Ruby on Rails.