Skip to content

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

Render 7 min read Case study mediumAdept

How We Found 7 TiB of Memory Just Sitting Around

Render's Kubernetes clusters have an unusually large number of namespaces, and daemonsets that listwatch them, such as Vector's kubernetes_logs source, used gigabytes of memory per node and put load on the apiserver during rollouts. Render added an opt-in config option to Vector (insert_namespace_fields) that disables namespace watching, since its config only used namespace labels to identify user pods. A missed second kubernetes_logs source initially hid part of the savings. Per-pod memory fell from nearly 4 GiB to tens of MiB, which freed about 1 TiB on the largest cluster and just over 7 TiB across the fleet.

Related posts

  • Node.js and the tale of worker threads

    Zalando Engineering mediumAdept

    A Node.js service using cluster mode called os.cpus().length inside a Kubernetes container, which returns the host's core count, not the pod's CPU allocation. On a 48-core node it forked 48 processes inside a 2GB pod. Each needed about 120MB, so the processes were killed under memory pressure and immediately re-forked by the exit handler, flooding a translation service with startup requests (1,000 to 20,000 rpm) and causing cancelled connections and read timeouts. The initial diagnosis of a retry feedback loop caused by process.exit() on fetch failure turned out to be wrong. The fix was to drop cluster mode and let Kubernetes handle scaling, and the incident motivated adding event-loop lag and other signals through an internal Node.js observability SDK.

  • Debugging Systems in the Cloud: MySQL, Kubernetes, and Cgroups

    Shopify Engineering hardMaster

    Slow MySQL Pod startup and degraded query performance on long-running GKE nodes in Shopify's KateSQL platform traced back to a Linux kernel memory cgroup leak: roughly 50K zombie memory cgroups made mem_cgroup_commit_charge slow, so each 128MB mmap during InnoDB buffer pool initialization took about 100 ms. The investigation used strace, perf flamegraphs, slabtop and /proc/cgroups, and Google kernel engineers confirmed it as a side effect of slab reparenting on cgroup removal. Forcing kubepods memory.force_empty cut cgroups to about 1800, and an 80G buffer pool then initialized in five seconds. The permanent fix was upgrading to GKE 1.18 (COS 85, kernel 5.4). Interim options included recycling nodes, dropping caches and isolating short-lived Pods.

  • Kubernetes v1.37: etcd RangeStream Cuts Memory Use on Large List Reads

    Kubernetes Blog mediumAdept

    Kubernetes v1.37 promotes etcd RangeStream to beta and enables it by default via the EtcdRangeStream feature gate. When paired with etcd v3.7, the API server reads whole collections, such as during watch cache initialization and uncached list fallbacks, through a streaming RPC instead of key-count-paginated Range calls. Previously a full page sat in memory on both etcd and the API server at once. With RangeStream, chunks are sized adaptively by bytes and are decoded and freed one at a time, which lowers peak memory and OOM risk. The API server falls back to paginated Range automatically on older etcd, and a non-zero etcd_request_duration_seconds_count{operation="listStream"} metric confirms the streaming path is in use.

  • How We Rebuilt Our Log Storage and Search Infrastructure for Scale

    Railway mediumAdept

    Railway replaced per-request Docker log polling (every 2 seconds, straining the Docker daemon across 500,000+ deployments) with a centralized log pipeline. Docker's syslog driver forwards container logs to a per-node Vector agent, which ships them to a central Vector instance that writes hourly filesystem buckets for real-time tailing and short-term queries and batches them to Google Cloud Storage for long-term retention. A Go gRPC streaming service serves logs through GraphQL subscriptions to the React frontend, enabling historical deployment logs and keyword filtering, with Vector's Datadog sink used for pipeline monitoring.

  • May 30 incident update

    Deno easyNovice

    A 70-minute Deno Deploy outage on May 30, 2022 was caused by the etcd service discovery cluster running out of memory after a network-wide load test: scale-up and scale-down generated a burst of updates, etcd daemons exceeded VM RAM, the Linux OOM killer terminated several at once, and quorum was lost. Instances then crash-looped on restart until the cluster was recreated on larger-memory VMs and services re-registered. Remediation includes bigger instances, extra etcd health checks, and alerts on etcd memory usage; no data was lost and Subhosting traffic was largely unaffected.

The quest for software engineering knowledge.

Look:
Layout: