Real-world concurrency and performance problems you'll face running Ruby in production with hands-on challenges and solutions.
Ruby developers who want to go beyond CRUD and learn how to handle high traffic, concurrency, and distributed systems, the stuff that breaks at scale.
| Problem | Description | Difficulty |
|---|---|---|
| Cache Stampede | Prevent 1000 concurrent requests from hammering your DB when cache expires | Medium |
| Rate Limiter | Atomic sliding window rate limiting under high concurrency | Medium |
- Read the challenge file
- Implement your solution
- Run the test to verify
- Compare with the provided solution
bundle installUpdate config/database.yml with your PostgreSQL credentials, then:
rake db:create
rake db:migratebin/server# Unit/Integration specs
rspec --tag ~system
# System tests (interactive, requires running PostgreSQL and Redis)
spec/system/bin/cache_stampede_test
spec/system/bin/rate_limiter_test| Dependency | Purpose |
|---|---|
| PostgreSQL | Simulates expensive database queries |
| Redis | Cache store and distributed lock backend |
| Ruby | 4.0+ |
Tests delete specific Redis keys before running. They do not call flushdb - your other Redis data is safe but make sure you don't run it on critical infra.
For a full technical deep-dive on the cache stampede problem, solutions, and tradeoffs: Thundering Herd: The Problem That Kills Ruby Apps at Scale
