PSPadam S.// Engineering Notes
arrow_backAll articles
BackendSep 12, 2026 • 12 min read • 48.2k reads

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.

PS
Padam ShankhadevPrincipal Full-Stack Engineer • 10+ yrs production
OctaneStack.php
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 FTW

The 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.
Found this useful? Share it with your team.

Keep reading

alternate_emailThe Ship Log — Newsletter

One production lesson, every 2 weeks. No fluff.

Join 4,200+ engineers getting deep-dives on Laravel scaling, Python workers, Postgres tuning and frontend performance. Read by engineers at SaaS teams shipping to millions.

check_circleFree forevercheck_circleUnsubscribe anytime

TLS encrypted • 4,200+ subscribers • 48% open rate