Infrastructure
Meta's ZGateway Proxy Slashes Database Connections 19x While Processing Over 1B Operations Daily
Meta has deployed a new proxy layer for ZippyDB that dramatically reduces connection overhead while maintaining support for billions of operations, addressing scalability challenges across its infrastructure.
InfoQ
Meta has rolled out ZGateway, a proxy tier sitting between application clients and ZippyDB, its distributed key-value database. The system processes more than one billion operations per second while routing roughly 40% of ZippyDB's total traffic, and architectural modeling shows it can reduce persistent connections across the system by approximately 19x.
The Connection Challenge#
ZippyDB underpins much of Meta's infrastructure, storing product metadata, counters, configuration data, and other critical state across geographically distributed systems. In the original direct-access design, clients open connections to every database host containing a shard they need to reach. This creates a many-to-many connection mesh where a single application might connect to tens of thousands of shards spread across hundreds of thousands of database machines. The resulting density generates connection storms that risk file descriptor exhaustion and memory pressure on database nodes.
How ZGateway Works#
The gateway introduces a managed proxy layer that consolidates client connections. Rather than each application maintaining direct links to database hosts, clients establish sticky connections to regional gateway instances located nearby through Meta's ServiceRouter service mesh. The gateway then multiplexes those connections to ZippyDB servers, transforming a dense mesh into a simpler topology.
ZGateway operates as a stateless proxy built on Meta's existing C++ ZippyDB client library. It can function as a pure pass-through proxy or include a read-through caching layer. Per-host connection counts drop by 97–98%, while total persistent connections fall by roughly 19x. The additional network hop—a deliberate architectural choice—actually improves latency by removing connection-management overhead from database nodes.
Centralized Control and Features#
Beyond connection pooling, ZGateway centralizes several critical functions:
- Authentication and authorization of requests
- Per-tenant admission control to manage resource allocation
- Shard resolution and routing
- Request batching and coalescing that individual client libraries cannot achieve
- , cross-region resilience, and overload protection

