Our metadata endpoint spent more time in the runtime than in SQLite
At ViralVidVault we track viral video trends across European markets, and our hottest internal endpoint is a batch metadata API. You hand it 50 to 200 video IDs and it returns normalized records: title, channel, origin region, 24-hour view velocity, and the GDPR consent flags that decide whether a clip can be personalized for a given visitor. The system of record is SQLite in WAL mode, fronted by PHP 8.4 on LiteSpeed, with Cloudflare Workers handling edge caching and geo-routing. That part is fast and boring, which is exactly how I like infrastructure.
The problem lived in a small Node.js service that sits between the edge and the database. It hydrates records, merges trend signals from two tables, and streams JSON back to the Workers layer. Under load its p99 was 40ms. When I profiled it, the actual SQLite read was around 2ms. The other 38ms was JSON serialization, HTTP framing, and garbage-collection pauses. The database was not the bottleneck — the JavaScript runtime was. So before rewriting anything I spent a week benchmarking Bun against Node.js on this exact workload. If you run a read-heavy JSON API and want measured numbers instead of launch-day tweets, this is what I recorded on ViralVidVault's infrastructure.






