Skip to content

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

Meta Engineering 11 min read Case study hardMaster

Transparent memory offloading: more memory at a fraction of the cost and power

TMO offloads cold memory to compressed RAM (zswap) or NVMe SSD swap. It uses the kernel's Pressure Stall Information (PSI), which measures time lost to CPU, memory and I/O shortage, and a userspace agent, Senpai, that applies mild proactive reclaim through a new stateless cgroup2 memory.reclaim knob. A reworked Linux swap algorithm engages swap in proportion to file-cache refaults, so cold anonymous pages get evicted at low pressure instead of only near OOM. In production across millions of servers, TMO saves 20–32% of memory per server, and SSD backends suit poorly compressible data like quantized ads models.

Related posts

  • Scaling Kubernetes Workloads with Node Swap

    Kubernetes Blog mediumAdept

    Kubernetes node swap, GA since v1.34 and backed by fast NVMe Local SSDs, lets nodes page out dormant anonymous memory and pack far more pods. Benchmarks show a Linux kernel build running at half the memory limit (300 MB vs 600 MB) with no slowdown, gVisor headless Chrome doubling from 80 to 160 pods, Kata rising from 40 to 50, and gVisor Python sandboxes tripling from 80 to 240. At peak density, latency rises mainly from CPU contention rather than swap I/O, but squeezing limits into the active working set (200 MB for the build) cost over 40% runtime, so swap is burst insurance, not a RAM replacement. To use it, enable LimitedSwap in the kubelet config on cgroup v2 and run workloads as Burstable QoS.

  • A case for QLC SSDs in the data center

    Meta Engineering easyNovice

    QLC flash can form a storage tier between HDDs, whose bandwidth per TB keeps falling as density grows, and TLC SSDs, which remain too costly to scale. It targets read-heavy workloads in the 10–20 MB/s/TB range, with infrequent writes and lower power use. Meta favors U.2-15mm (up to 512TB) and Pure Storage DirectFlash Modules (up to 600TB) over E1.S and E3, aiming for 6x the byte density of its densest TLC server. Adapting the software requires io_uring and ublk with zero copy, plus tuned rate controllers and I/O schedulers so latency-sensitive reads aren't serialized behind much slower writes.

  • The effect of switching to TCMalloc on RocksDB memory use

    Cloudflare mediumAdept

    Quicksilver's memory roughly doubled after its storage moved to RocksDB, climbing from about 15GB to 30GB over several days. Heap profiling showed the heap was about a third of RSS, which pointed to the allocator rather than a leak. glibc malloc gives threads independent per-thread arenas (60-80 arenas for about 25 threads), and memory cannot move between them, so fragmentation multiplies. Mitigations such as MALLOC_ARENA_MAX, periodic malloc_trim and M_MMAP_THRESHOLD each cost lock contention or syscalls, while TCMalloc's middle-end moves freed memory between per-core caches and cut memory use by 2.5x.

  • Improving Lakebase Postgres Compute Cache on Neon, Part 1

    Neon hardMaster

    On large fixed-size Lakebase Postgres computes, Neon now disables its NVMe-backed local file cache and sets shared buffers to 75% of DRAM (up from a 1 GB cap), backed by explicit 2 MB HugeTLB pages provisioned through host, hypervisor and guest VM. Huge pages cut per-backend page table overhead by 512× and reduce TLB misses, lowering tail read latency by up to ~40% and CPU by up to ~30% in benchmarks. Production endpoints saw up to 2× throughput, 5× fewer storage GetPage requests and 5× lower CPU, with near-100% cache hit rates. Autoscaling computes with dynamic shared buffers are planned for part 2.

  • Mastering Long Contexts in LLMs with KVPress

    Hugging Face mediumAdept

    KV cache memory grows linearly with context length: Llama 3-70B at 1M tokens in bfloat16 needs about 330GB of KV cache, roughly 70% of total memory. NVIDIA's KVPress is a Python toolkit of "presses" that prune low-importance KV pairs during prefill via forward hooks on attention layers. Examples include KnormPress, SnapKVPress and ExpectedAttentionPress, each tuned with a compression_ratio and usable through a custom transformers pipeline. On Llama 3.1 8B at 128k context, 50% compression cuts peak memory from 45GB to 37GB and raises decoding from 11 to 17 tokens/s on an A100, while RULER benchmarks show accuracy dropping as compression rises.

The quest for software engineering knowledge.

Look:
Layout: