Benchmarking our new Bun + Hono LLM gateway (and cutting CI from 18 min to 6)

This September we ran a side-by-side comparison between our new in-house TypeScript/Bun/Hono/Drizzle AI inference gateway (V4) and the legacy gateway it is gradually replacing, and also spent a week cleaning up our monorepo CI pipeline.
I like writing down real numbers while the exact test conditions are still fresh, because half the performance benchmarks on the internet forget to mention what they actually measured.
Matched-hardware mock-upstream A/B tests
To measure pure gateway overhead (auth, rate limiting, routing, SSE stream parsing, quota reservation, logging) without upstream LLM variance muddying the numbers, we ran both gateways on matched hardware and databases against a deterministic mock upstream.
Two workloads stood out:
| Benchmark | Concurrency | Prompt size | Legacy gateway | New Bun + Hono gateway | Delta |
|---|---|---|---|---|---|
zero-c50 | 50 | Short prompt | 351.0 req/s | 457.7 req/s | ~30% higher |
long32k-c10 | 10 | 32,768 tokens | 14.4 req/s | 233.55 req/s | ~16x throughput |
The ~30% gain on short prompts came mostly from leaner request middleware, Bun's lower HTTP overhead, and avoiding redundant JSON serialization round-trips.
The 16x jump at 32K context was the much more interesting finding. On large prompts, the legacy gateway was buffering, cloning, and regex-scanning huge request bodies multiple times across middleware layers, hammering GC and CPU on every single 32K payload. In the new gateway we kept request parsing single-pass, avoided unnecessary string copies on the hot path, and streamed SSE chunks through cleanly without blocking the event loop.
(To be clear: those are matched-hardware mock-upstream A/B numbers measuring gateway overhead, not end-to-end real GPU generation speed, and customer migration off the legacy stack is still staged rather than flipped overnight.)
Cutting PR CI from ~18 minutes down to ~6 minutes
While we were shipping V4 fast, our PR checks had quietly bloated to 16 to 19.7 minutes per push. Waiting nearly 20 minutes just to find out a lint rule or typecheck failed kills momentum.
Looking at the CI timing waterfall, almost all the wasted time came from a few avoidable mistakes:
-
Serializing independent checks: typecheck, lint, unit tests, and build steps were chained instead of running in parallel jobs.
-
Re-building unchanged workspace packages instead of scoping Turborepo caches properly across the monorepo.
-
Slow Docker layer invalidation: copying the whole repo before installing dependencies busted the dependency layer on every commit.
After splitting independent checks in parallel, fixing layer ordering, and pairing that with immutable image releases and explicit pre-deploy database migration gates, PR check times dropped to 5m25s - 7m09s (roughly a 60% reduction from the August baseline, measured on normal within-V4 PR runs rather than synthetic warm-cache no-ops).

Faster CI plus immutable image tags with automated pre-deploy validation and alerting sounds boring compared to model benchmarks, yet day-to-day it probably saved the team more hours than any single runtime micro-optimization.
Share this article
Reactions