Skip to content

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

Neon 6 min read Case study mediumAdept

Improving DNS performance with NodeLocalDNS

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

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.

  • Breaking down OpenAI's outage: How to avoid a hidden DNS dependency in Kubernetes

    Render mediumAdept

    CoreDNS doesn't need the Kubernetes API server to answer queries, but it does need it to initialize. So when CoreDNS runs on control plane nodes (the kubeadm default), a control plane overload or node restart can take DNS down and break running services, as likely happened in OpenAI's outage. Render hit the same failure in 2022 after an etcd memory spike. It fixed the problem by changing tolerations so CoreDNS schedules only onto tainted worker nodes, and by moving etcd to dedicated nodes. The post also explains why telemetry daemonsets overload API servers: per-node list-pods calls bypass the cache and do consistent etcd reads. Setting resourceVersion="0" and monitoring for expensive list requests are the recommended mitigations.

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

    Datadog Engineering mediumAdept

    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.

  • June 25th, 2023 Deno Deploy Postmortem

    Deno easyNovice

    A DDoS attack on one site hosted on Deno Deploy drove traffic to about 10x normal and took down Deploy projects, deno.com and deno.land for 44 minutes on June 25, 2023. Rapid autoscaling brought many processing nodes online at once. Each node pulled start-up metadata from a central database, which was rate-limited and overloaded, and nodes that timed out rebooted and added to the load in a feedback loop. Fixes include more database capacity, globally cached boot payloads to remove the single point of failure, letting nodes run on slightly stale data, and load testing for similar spikes.

  • How we halved DNS build delay and cut memory use by 85%

    Cloudflare hardMaster

    Cloudflare's DNS Zone Builder now uses a targeted build planner that picks the smallest provably safe build (resources only, resources plus metadata, apex plus metadata, purge, or full zone) and a unified per-zone scheduler that merges queued work. Zone setting changes no longer rebuild zones with tens of millions of records. The change cut peak memory by 85% and halved the time from a DNS change to its write to Quicksilver. Correctness comes from enriched Kafka events, re-planning against a fresh replica snapshot, careful handling of metadata keys shared across same-name zones, soft Kafka offset commits, byte-for-byte equivalence tests, and a mirror pipeline whose output is diffed against production.

The quest for software engineering knowledge.

Look:
Layout: