Rails Scales!
Practical Techniques for Performance and Growth
by: Cristian Planas
Published | 2025-05-15 |
---|---|
Internal code | cprpo |
Print status | In Print |
Pages | 270 |
User level | Beginner |
Keywords | ruby, rails, performance, optimization, scalability, software architecture |
Related titles | “Ruby Performance Optimization”, by Alexander Dymo |
ISBN | 9798888651025 |
Other ISBN | |
BISACs | COM051410COM011000COM011000 |
Highlight
Rails doesn’t scale. So say the naysayers. They’re wrong. Ruby on Rails runs some of the biggest sites in the world, impacting the lives of millions of users while efficiently crunching petabytes of data. This book reveals how they do it, and how you can apply the same techniques to your applications. Optimize everything necessary to make an application function at scale: monitoring, product design, Ruby code, software architecture, database access, caching, and more. Even if your app may never have millions of users, you reduce the costs of hosting and maintaining it.
Description
Optimize every aspect of your Ruby on Rails applications for world-class performance. Tweak your Rails app for snappy responsiveness. Find bottlenecks that slow your code. Scale an app for massive data sets.
This book introduces techniques, patterns, and tricks to make your Rails application become more performant and scale to billions of requests per day. And it does it in an entertaining and fun way, sharing real-life stories of all kinds: tales from the trenches of working on massive Rails apps, and anecdotes from working on much smaller projects in tiny organizations of a handful of engineers. Through all these experiences you will learn that scaling Rails applications is a multifaceted task, including aspects such as monitoring, query tuning, and memory-aware coding.
This book is for programmers of all levels of experience, from beginners to experienced Rails veterans. You can even show your nontechnical colleagues the features and limitations of Rails at scale.
Reading this book will help you make Rails applications that fly. And it will make you enjoy the process.
Contents and Extracts
- Introduction
- We Need to Talk About the Rails Learning Curve
- Techniques for a Rails Renaissance
- About This Book
- Setting Up Your Machine
- Understanding the Application Database Setup
- Downloading the Application
- Setting Up Ruby
- Installing the Database(s) and the Caching Stores
- Setting Up Rails
- Loading the Example Dataset
- Summing Up
- Optimizing Data Access with ActiveRecord excerpt
- Managing Data the Rails Way
- Removing n+1s and Preloading Data
- Discovering Wide Fetching and Narrow Fetching
- Explaining EXPLAIN
- Indexing
- Summing Up
- Understanding All the Faces of Caching
- Caching and Denormalizing
- Using counter_cache in Rails
- Setting Up Your Caching
- Using Fragment Caching
- Using Russian Doll Caching
- Writing Your Own Caching
- Using Write-Through Caching excerpt
- Implementing Fan-Out Writing
- Using Action Caching and Page Caching
- Adding a Cache Layer to ActiveRecord
- Choosing a Storage System for Your Cache
- Using Denormalization
- Summing Up
- Designing a Scalable API
- Paginating Your Endpoints
- Discovering Cursor-Based Pagination
- Splitting Your Model Data
- Implementing Sideloads
- Using GraphQL
- Summing Up
- Tracking the Lifecycle of a Request
- Crossing the Internet with One Request
- Using HTTP Headers to Speed Up Your Application
- Introducing CDNs
- Summing Up
- Thinking Architecture for Performance
- Designing Product for Performance
- Setting Product Limits
- Managing the Life of Your Data
- Doing Things That Don’t Scale
- Increasing Your Usability Time
- Summing Up
- Monitoring Performance to Build Scalable Systems excerpt
- Choosing and Installing Your Observability Platform
- Monitoring (Almost) All the Things!
- Building Your Own Dashboards
- Setting Up Performance Error Budgets
- Being Wary of How Much You Spend
- Summing Up
- Scaling, Beyond Performance
- Setting Up Ownership for Your Application
- Modularizing Your Application
- Using Feature Flags for Better Rollouts
- Summing Up
- The Next 20 Years with Rails
- Scaling with Human-First Technology