Engineering Note
Why our Ruby on Rails app slowed down after 50k users (it wasn’t the DB)
Our Rails app slowed down after 50k users.
It wasn’t the database.
Traffic was growing.
DB metrics looked stable.
Still, response times were increasing.
The real issues were:
- Heavy callbacks slowing request cycle
- N+1 queries hidden inside serializers
- Large JSON responses for simple endpoints
- Background jobs doing sync work in request path
Not a DB bottleneck. Application layer inefficiency.
What we did:
- Removed unnecessary callbacks from critical flows
- Fixed N+1 queries and optimised serializers
- Reduced response payload size
- Moved blocking tasks to Sidekiq
- Added caching for repeated reads
We didn't upgrade the database. We fixed the request path.
Outcome:
- Faster API response time
- Lower request latency under load
- More predictable performance at scale
Important learning:
Scaling issues don't always start where you expect.
In Rails systems, performance problems often live above the database.
It wasn’t the database.
Traffic was growing.
DB metrics looked stable.
Still, response times were increasing.
The real issues were:
- Heavy callbacks slowing request cycle
- N+1 queries hidden inside serializers
- Large JSON responses for simple endpoints
- Background jobs doing sync work in request path
Not a DB bottleneck. Application layer inefficiency.
What we did:
- Removed unnecessary callbacks from critical flows
- Fixed N+1 queries and optimised serializers
- Reduced response payload size
- Moved blocking tasks to Sidekiq
- Added caching for repeated reads
We didn't upgrade the database. We fixed the request path.
Outcome:
- Faster API response time
- Lower request latency under load
- More predictable performance at scale
Important learning:
Scaling issues don't always start where you expect.
In Rails systems, performance problems often live above the database.