Clouds, caches and connection conundrums
After migrating to Google Cloud, sporadic Postgres and memcached connection timeouts on GKE turned out to be node-wide, not process-local. Bursts of rapidly opened TCP connections, from concurrent cache sets, GCS URL generation and a runaway query fanning out external calls, spiked CPU in the Dataplane V2 anetd agent and caused dropped packets. Partial mitigations helped: static Postgres pools with a longer connection lifespan cut new connections from ~200/s to ~1/s, and raising memcache MaxIdleConns from 2 to 20 also reduced timeouts. The lasting fix is connection reuse plus limits on outbound network concurrency rather than disabling Dataplane V2. Network timeouts should be investigated at the node level, not just per pod.
Related posts
- Incident Report: April 23rd, 2025
Railway mediumAdeptA Google Cloud SQL maintenance window took Railway's networking control plane Postgres read replica offline for about 10 minutes, destabilizing edge, private networking and TCP proxy traffic across all regions, worst in Asia. Control plane instances crashed on database connection errors because of improper error handling, and each restart evicted the in-memory routing cache, which could not be refetched while Postgres was down. Slow cache warming delayed recovery until 09:28 UTC. Planned fixes include regional control planes to limit blast radius, graceful handling of DB errors, a persistent routing cache as a fallback, faster startup, and Cloud SQL maintenance settings that keep primary and replica from being maintained at the same time.
- 2023-03-08 incident: A deep dive into the platform-level recovery
Datadog Engineering hardMasterRecovering from Datadog's March 8, 2023 multi-region outage, triggered by a systemd-networkd patch on Ubuntu 22.04 that cut network connectivity for nodes running Cilium, required restoring Kubernetes clusters in a strict order: parent control planes, then child control planes hosted on parent nodes, then application nodes. In EU1 (Google Cloud), impacted nodes could simply be rebooted. Scaling out to drain the backlog then hit a 15,500-instance network peering group limit and full pod subnets in three clusters, which normally run at around 40% IP usage. In US1 (AWS), Auto Scaling groups replaced tens of thousands of instances, so every node had to re-register through Vault, the Kubernetes API, and Cilium ENI/IP allocation via EC2 APIs, stressing those services and slowing the return to Ready capacity.
- Using Neon’s Scale to Zero with Long-Running Applications
Neon mediumAdept
Neon's scale to zero suspends a Postgres compute after an idle window (only when no WAL senders are active and autovacuum isn't running), which severs connections held by long-running servers. A naive node-postgres Client crashes on the resulting unhandled error event. A client-side pg.Pool with an error handler tolerates the dropped connections and reconnects on demand, waking the database. In Apache Bench tests the pool beat per-request connections by more than 10x (about 46ms vs 678ms average latency, 370 vs 26 req/s), with the same pattern shown in a Fastify, Drizzle and HTMX example app.
- It’s always DNS . . . except when it’s not: A deep dive through gRPC, Kubernetes, and AWS networking
Datadog Engineering hardMasterErrors during rollouts of Datadog's metrics query service looked like DNS failures, but the root cause was VPC connection tracking saturation on AWS ENIs. Clients kept sending SYNs to deleted pods' IPs. Because Cilium had removed the pod's route and IP rule, Linux reverse path filtering treated the packets as Martian and dropped them silently, even though it was configured in loose mode. With no RST or reply, clients' gRPC reconnect logic generated around 90,000 SYNs per old IP in 90 seconds, filling the hypervisor-level VPC conntrack while the Linux conntrack stayed low. The investigation shows how ENA conntrack_allowance_exceeded metrics, VPC Flow Logs aggregated by TCP flag, and kernel route lookups exposed the interaction between NodeLocal DNSCache, Cilium ENI mode, rp_filter and gRPC clients.
- Postmortem: Delayed Start Compute Operations
Neon mediumAdept
A query plan change overloaded Neon's control plane database in AWS us-east-1, which stopped it from suspending idle databases. Running pods climbed to about 8,000, and those pods used up the IP addresses in two of the three subnets, so customers couldn't create or wake scale-to-zero databases for 5.5 hours across two days. Mitigation meant upscaling the control plane database, adding temporary proxy rate limiting, and setting the AWS CNI WARM_IP_TARGET and WARM_ENI_TARGET to 0. Restoring WARM_IP_TARGET=1 three days later caused IP allocation to fail again even though free IPs were available, and that was eased by doubling prewarmed compute pools. Follow-ups include doubling the VPC subnets and a new Kubernetes 'Cells' architecture.