CareerCase StudyNov 8, 2026

Why we migrated our Next.js App Router API routes to connection-pooled MySQL and saved 60% latency

A
Ananya Kapoor@Ananya K.
When scaling concurrent users on serverless endpoints, opening fresh database connections on every serverless lambda invocation quickly hits the max_connections limit. We implemented a singleton pool with 10 connection limits and keepAlive=true. Average query times dropped from 180ms to 8ms. If anyone is running into connection exhaustion with MySQL2 or Prisma on Vercel, feel free to ask questions here!
4
1 comment

Responses (1)

D
Dev Patel@Dev P.• 2d ago
2
Great breakdown! We also enabled TCP keepalive at the OS level on our Ubuntu instances and that solved intermittent dropped sockets under spike traffic.