惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
小众软件
小众软件
爱范儿
爱范儿
Y
Y Combinator Blog
博客园 - Franky
美团技术团队
博客园 - 【当耐特】
The Cloudflare Blog
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Ruby on Rails Has Scalability Issues. Here's How We Solve...
devansh · 2026-04-28 · via DEV Community

Every few months someone declares Rails dead. Then Shopify reports another record Black Friday. In 2025, Shopify's Rails monolith handled 489 million requests per minute at peak with over 53 million database queries per second. That's not a framework that fails to scale Ruby on Rails.

But the "Rails can't scale" myth keeps coming back because the Ruby on Rails scalability issues people hit in production are real. They just aren't framework problems. They're architecture and discipline problems. Here's what we kept hitting in our own apps and what actually worked.

N+1 Queries Quietly Kill Your Database

This one shows up early and silently. You loop through 100 posts and call post.author.name, and ActiveRecord fires 101 queries. The page feels fine in dev with 5 records. In production with 50,000, it falls over. Slow queries are the most common Ruby on Rails scalability issues we see when auditing older codebases.
ruby
Slow: 1 + N queries
posts = Post.all
posts.each { |p| puts p.author.name }

Fast: 2 queries
posts = Post.includes(:author)
posts.each { |p| puts p.author.name }

We added the Bullet gem in development to flag every N+1 before it shipped. After cleaning the worst offenders across our top 10 endpoints, P95 response time dropped roughly 40%.

Memory Bloat and Ruby's Garbage Collector

Long-running Rails workers eat memory. Default malloc fragments quickly under heavy allocation, and worker RSS drifts up until restarts kick in. Memory pressure is one of the most expensive Ruby on Rails scalability issues to ignore.

Two fixes that paid off fast:

  • Switch the system allocator to jemalloc. Most teams report 20-40% lower RSS per worker.
  • Enable YJIT on Ruby 3.3+. Shopify reported a 15% speedup just by enabling YJIT on Ruby 3.3 in production storefront code. Rails at Scale

For batch jobs, swap Model.all.each for find_each(batch_size: 1000). That single change has saved us more outages than any monitoring tool.

Concurrency: Puma, Sidekiq, and Knowing What Blocks

Out of the box, a Puma worker on default settings handles a handful of concurrent requests. Fine for an MVP. Brutal for production traffic.

What worked for us:

  • Tuned Puma to 5 threads × 2 to 4 workers per dyno based on actual CPU and memory headroom, not defaults.
  • Moved every blocking task (PDF generation, third-party API calls, email, image processing) to Sidekiq.
  • Split Sidekiq into queues by latency tolerance: critical, default, low. A bulk export shouldn't starve a webhook.

These three Ruby on Rails scalability issues account for maybe 80% of the production fires we've seen.

The Real Lesson About Scaling Rails

Rails scales when the architecture scales. The framework gives you the rails. You still have to lay them right. Profile before you optimize, eager-load before you cache, and move slow work off the request cycle.

If you're stuck on these walls and need help refactoring without burning a quarter, hire ruby on rails developers who've shipped through them. Most Ruby on Rails scalability issues are old problems with well-known fixes. The trick is figuring out which one's biting you today.