---
title: "ZGateway: Learnings from Putting a Proxy in Front of ZippyDB"
description: "ZGateway is a stateless proxy tier introduced to unify traffic from ZippyDB’s large, diverse client fleet and address the reliability limits of direct access. By terminating TLS, authorizing requests, applying admission control and shaping, and routing through regional tiers, it replaces a many-to-many connection mesh with bounded client-to-gateway and gateway-to-server hops. Its embedded thick C++ client batches and coalesces shard requests, while a shared pipeline supports pure-proxy and read-through-cache tiers; per-use-case metrics, traces, and quota usage provide operational visibility. The gateway handles more than 1 billion operations per second, carries about 40% of ZippyDB traffic, and adds about 6% computational overhead to an average use case, with traffic projected to exceed 60%; production work also consolidated transaction state handling across 100% of transaction traffic without a reliability regression."
---

# ZGateway: Learnings from Putting a Proxy in Front of ZippyDB

[Meta](https://yomu.fyi/company/meta) · By Rittik Banik, Yunhao Cao · Sep 3, 2026

**Type:** Explainer

## Summary

ZGateway is a stateless proxy tier introduced to unify traffic from ZippyDB’s large, diverse client fleet and address the reliability limits of direct access. By terminating TLS, authorizing requests, applying admission control and shaping, and routing through regional tiers, it replaces a many-to-many connection mesh with bounded client-to-gateway and gateway-to-server hops. Its embedded thick C++ client batches and coalesces shard requests, while a shared pipeline supports pure-proxy and read-through-cache tiers; per-use-case metrics, traces, and quota usage provide operational visibility. The gateway handles more than 1 billion operations per second, carries about 40% of ZippyDB traffic, and adds about 6% computational overhead to an average use case, with traffic projected to exceed 60%; production work also consolidated transaction state handling across 100% of transaction traffic without a reliability regression.

## Context

ZippyDB’s direct-access model created a dense many-to-many TLS connection mesh: clients could touch tens of thousands of shards, while database hosts accepted connections from the growing client population. Connection storms had caused file-descriptor exhaustion, out-of-memory failures, and reboot loops, while the diverse client fleet was difficult to change quickly.

## Approach / What changed

ZGateway places a managed, regional, stateless proxy tier between clients and ZServer. It provides authorization, admission control, validation, shaping, routing, batching, coalescing, caching, and per-use-case observability, while using the thick C++ client as its engine. It also consolidated transaction bookkeeping onto a shared implementation and supports pure-proxy and read-through-cache tiers.

## Takeaways

- In the direct model, database-host fan-in grows linearly with the client population; with ZGateway, fan-in is approximately regions multiplied by shard density per host, independent of client and database fleet size.
- A model using 20 regions, 500,000 database hosts, 30,000 proxy hosts, 1,000,000 clients, and 50,000 shards per client estimates a 97–98% per-host connection reduction and roughly 19x fewer persistent connections overall.
- Transaction state handling was consolidated behind a flag in nine phases, reaching 100% of transaction traffic without a reliability regression and keeping gateway behavior aligned with server-side transaction evolution.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Caching](https://yomu.fyi/topic/caching), [Distributed Systems](https://yomu.fyi/topic/distributed-systems), [Load Balancing](https://yomu.fyi/topic/load-balancing)

- Source: [Meta](https://engineering.fb.com/2026/09/03/core-infra/zgateway-proxy-zippydb-meta)
- Source URL: https://engineering.fb.com/2026/09/03/core-infra/zgateway-proxy-zippydb-meta
- Ingested by Yomu: 2026-09-03T16:00:48.044Z

[Read original post](https://engineering.fb.com/2026/09/03/core-infra/zgateway-proxy-zippydb-meta)
