The 13% Penalty: Why Synchronous APIs Still Scale Better Than You Think
Description and use
mouse‑php shows that synchronous PHP APIs can scale efficiently by dropping ORMs, using hash‑based routing, and a one‑way middleware pipeline, achieving 1.41 ms average latency at 2000 Req/s.
Problem
Developers believe PHP is inherently slow, synchronous APIs cannot scale, and that performance requires sacrificing developer experience.
Outcome
mouse‑php achieved an average latency of 1.41 ms at 2000 Req/s and maintained 99% of requests below 5 ms up to 15 000 Req/s, demonstrating that synchronous PHP APIs can scale efficiently with low‑level simplicity.
Workflow
- 1. Strip framework bloat and keep execution linear.
- 2. Replace ORM with a structured PDO wrapper to avoid hydration tax.
- 3. Implement associative‑array first routing to bypass regex parsing.
- 4. Adopt a one‑way middleware pipeline for early exits and context injection.
- 5. Benchmark with wrk2 on bare‑metal hardware using controlled load profiles.
- 6. Analyze latency metrics to identify saturation points.
Evidence
I built a lightweight framework to act as a data marshal for my decoupled single page apps…
Traditional MVC frameworks push heavy ORMs… In mouse‑php, I inverted this relationship and completely ditched the ORM…
Industry standard routers rely heavily on complex regex engines… In mouse‑php, the routing engine uses associative array hash lookup first…
Most modern frameworks use an “onion model”… I moved mouse‑php to a strict one way pipeline…
Benchmarking modern HTTP APIs accurately is surprisingly nuanced… I migrated the test bench to wrk2…
All benchmarks were executed locally on bare‑metal hardware…
Using these test parameters, our control run targeted a route that returned a static JSON payload…
At 15,500 Req/s, P99 jumps from 4.53 ms to 11.88 ms…
- Record date: 2026-10-21T05:56:09.964Z