Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Datadog Engineering 8 min read Incident mediumAdept

Not just another network latency issue: How we unraveled a series of hidden bottlenecks

Recurring high-startup-latency pages on every deployment of Datadog's usage estimation `counter` service traced back to four stacked bottlenecks rather than one. The fixes were raising CPU for a throttled Envoy sidecar, patching a Linux kernel bug that pinned all traffic to the first of eight AWS ENA transmit queues, and moving to network-optimized EC2 instances after bandwidth-allowance-exceeded metrics revealed hypervisor packet drops. A Kubernetes preStop hook with a maintenance-mode key then kept Envoy from routing requests to terminating remote-cache pods. With p99 latency back under 100 ms, the team scaled the remote cache down 6x, saving hundreds of thousands of dollars a year, and now alerts on ENA bandwidth and pod- and host-level network drop metrics.

Related posts

  • It’s always DNS . . . except when it’s not: A deep dive through gRPC, Kubernetes, and AWS networking

    Datadog Engineering hardMaster

    Errors 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.

  • Thundering herd of circuit breakers

    Zalando Engineering mediumAdept

    A client's circuit breaker stayed open for hours because its half-open probes hit a service that the HPA had scaled down to three pods. The sparse probes succeeded, the breaker closed, and the withheld traffic arrived at once, queued for over 100 ms per request, timed out and re-opened the breaker. Each cycle lasted only about three seconds, too short for CPU-averaged autoscaling to notice. Zalando found the cycle by exporting OpenTelemetry traces as CSV into a bespoke uPlot visualizer that plots hundreds of traces at once. Suggested fixes are autoscaling on queue depth or concurrency, longer or heavier half-open probes, pre-scaling before the breaker closes, load shedding, and propagating cancellations.

  • 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.

  • 2023-03-08 incident: A deep dive into the platform-level recovery

    Datadog Engineering hardMaster

    Recovering 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.

  • Improving DNS performance with NodeLocalDNS

    Neon mediumAdept

    Neon deployed node-local-dns as a DaemonSet across its EKS clusters running hundreds of thousands of ephemeral Postgres pods, moving the 95%+ cache-hit DNS traffic off the network and onto each node. CoreDNS p99 latency fell from ~1.5ms to 240µs and p99.9 from 10–20ms to under 2ms, while CoreDNS load dropped 97% (~2k to ~60 req/s) and now scales with node count rather than Postgres instances. The lower load exposed NXDOMAIN amplification from a bad /etc/hosts entry, which they blackholed with the CoreDNS template plugin. A race between kube-proxy installing iptables rules for kube-dns-upstream and the DaemonSet forwarding to it caused TCP timeouts, avoided by deploying the Service before the DaemonSet (or the reverse order with Cilium Local Redirect Policy).

The quest for software engineering knowledge.

Look:
Layout: