Priya Patel
Senior Backend Engineer
As our user base grew, we noticed increasing tail latency across our API gateway. While median response times remained healthy, p99 latency had crept up to 85ms — unacceptable for real-time applications.
We set a target: reduce p99 latency to under 50ms without compromising reliability or increasing infrastructure costs.
After extensive profiling, we identified three primary bottlenecks: database connection pooling under load, inefficient JSON serialization in our middleware stack, and suboptimal cache hit ratios on frequently accessed endpoints.
We implemented a multi-pronged approach: migrated to connection pooling with PgBouncer, replaced JSON serialization with a faster custom serializer, and introduced a write-through cache layer with Redis.
p99 latency dropped from 85ms to 48ms — a 43% improvement. Median latency improved from 12ms to 7ms. All this with zero downtime during the rollout.
We've published our benchmarking tools and configuration as open source. Check them out on GitHub.
Keep Reading
Learn how to create a real-time analytics dashboard using Nexbic's WebSocket API and reactive data pipelines.
June 12, 2025
We are excited to announce Organizations — a new feature that brings multi-tenant support with role-based access control.
June 5, 2025
How Nexbic implements a zero-trust security model across infrastructure, APIs, and user access.
May 20, 2025