SCALETECH MONOLITH MIGRATION
Next-Gen Routing Engine
Re-architecting legacy HTTP router → achieved 10x throughput scaling.
THROUGHPUT
50,000 rps
ALLOCATIONS
0 B/op
P99 LATENCY
0.8ms
IMPROVEMENT
10x
CHALLENGE
The legacy HTTP router — inherited from the original monolith — bottlenecked at 5,000 requests per second. Profiling revealed that per-request memory allocation was the dominant cost: each request allocated ~1 KB across 7 heap objects, forcing the garbage collector into a tight loop that consumed 40% of CPU time under load.
SOLUTION
Implemented a trie-based router in Go utilizing sync.Pool to reuse memory buffers across requests. Route matching operates on the raw request byte slice with zero string allocations. Path parameters are extracted into stack-allocated buffers and only promoted to the heap when the handler explicitly requests them.
RESULT
Throughput scales to 50,000+ requests per second on equivalent hardware. Per-request allocation dropped to 0 B/op. P99 latency reduced from 12ms to 0.8ms. The router now handles 100% of ScaleTech's edge traffic.
STACK