How I Pushed Laravel to 20k RPS with Octane, Redis & Queue Sharding
From 900 RPS to 20k RPS on the same AWS bill. Octane workers, partitioned queues, Redis multi-tier cache and the PostgreSQL indexes that actually mattered.
Route::middleware(['cache.headers:public;max_age=60'])
->get('/feed', [FeedController::class, 'index']);
// RoadRunner worker warmup
'warm' => [ConfigRepository::class, RouteService::class],
'sticky' => env('OCTANE_STICKY', false), // stateless FTWThe bottleneck was never PHP
Every Laravel performance audit I run starts the same way: the team blames PHP, and the flame graph blames N+1 queries and synchronous HTTP calls. On this SaaS project serving 1.2M monthly users, p95 was 890ms and workers were saturated at 900 RPS.
Switching to Laravel Octane (RoadRunner) removed the bootstrap tax — around 40ms per request — but the real wins came from treating the request lifecycle like a pipeline: cache first, queue everything non-critical, and never hit Postgres for data Redis already knows.
The 4-layer recipe
1. Octane + OPcache + preloading: persistent app state across requests. Watch out for static singletons leaking tenant context — I wrap tenant resolution in Octane tick callbacks.
2. Redis multi-tier: L1 in-memory array cache per worker, L2 Redis with tagged invalidation, L3 CloudFront for public feeds. Hit ratio went from 61% to 94.3%.
3. Queue sharding by tenant tier: high-value tenants get dedicated Horizon supervisors so a bulk import never starves checkout webhooks.
4. Postgres partitioning + covering indexes: partitioned the events table by month, replaced 7 indexes with 3 covering ones. Median query time dropped from 34ms to 4ms.
Numbers after 3 weeks
p50 26ms, p99 180ms (down from 2.1s), 20k sustained RPS on 4x c6i.xlarge, zero-downtime deploys via blue/green ECS. Same monthly AWS bill — we just stopped wasting compute on repeated work.
verifiedKey takeaways
- arrow_rightOctane gives ~30% free throughput, caching gives 10x.
- arrow_rightShard queues by business priority, not just job type.
- arrow_rightMeasure p99 per tenant — averages hide noisy-neighbor pain.