Skip to content

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

Meta Engineering 4 min read Case study mediumAdept

Meta’s Full-stack HHVM optimizations for GenAI

Meta moved GenAI inference traffic, which is long-running, I/O-heavy and latency-sensitive, onto a dedicated HHVM web tenant with its own runtime tuning, cutting latency by 30%. The isolated tier raises the usual 30-second request timeout and runs about 1,000 worker threads per host, sized by dividing host memory by the per-request memory limit, instead of a couple hundred. It also seeds the JIT cache with Jump-Start profiles from the main web tier and runs dummy warm-up requests to pre-fill config and service-discovery caches. Shadow traffic keeps the JIT cache covering code paths that open up later through real-time feature gating.

Assumes: JIT compilation basicsthread-per-request web servers

Related posts

  • Boosting the performance of virtual machines with Jump-Start

    Meta Engineering easyNovice

    Jump-Start cuts JIT warm-up overhead in HHVM by having a small slice of the fleet collect profiling data during Facebook's phased rollout. That data is shared with the remaining servers, so they skip the profiling compile-and-run step. Profile data from the ~2% of servers restarted in phase C2 is reused by the servers restarted in phase C3. Deployed across Facebook's data centers, it reduces HHVM warm-up overhead by 54.9% and, because the profiling can be more thorough, also improves steady-state performance by 5.4%.

  • Meta’s Infrastructure Evolution and the Advent of AI

    Meta Engineering easyNovice

    Meta's infrastructure grew from a LAMP stack with per-university databases to a global fleet of millions of machines. Along the way it added Memcache and TAO, edge POPs, a backbone network, cache-invalidation systems for cross-region consistency, and fleet systems such as Twine, Tectonic, ZippyDB, Shard Manager, Kraken, Taiji and Maelstrom. AI workloads changed those assumptions. Recommendation models brought GPUs into the fleet, and LLM training pushed synchronous jobs from 128 to thousands of GPUs, where one failure halts the whole job; Meta reports cutting the interruption rate by about 50x. It went on to build two 24k H100 clusters (InfiniBand and RoCE), a 129k-H100 cluster made by emptying five data centers, air-assisted liquid-cooled GB200 racks, AMD MI300 deployments, and its own MTIA silicon for ranking and ads inference.

  • How Meta trains large language models at scale

    Meta Engineering easyNovice

    Training LLMs at Meta shifted workloads from many small recommendation jobs to a few enormous GPU jobs, forcing changes across hardware, data center layout, reliability, networking and storage. Meta adapted its Grand Teton H100 platform (700W TDP, HBM3, still air-cooled), repacked data halls for GPU density, and tracks common failure modes such as GPUs dropping off PCIe, DRAM/SRAM uncorrectable errors and network cable faults. Instead of choosing between fabrics, it built two 24K-GPU clusters, one RoCE and one InfiniBand, and tuned both to equivalent performance for Llama 3 training. The tuning relied on topology-aware placement of parallelism traffic, custom collectives such as recursive doubling/halving in place of rings, and load balancing to handle fat flows.

  • Run FLUX.1-dev three times faster

    Modal mediumAdept

    FLUX.1-dev image generation on Modal drops from ~6.75s to under three seconds per 1024x1024 image. About 1.5x comes from standard optimizations: torch.compile with max-autotune, fused QKV projections and channels-last memory layout. Another 2x comes from First Block Caching (via ParaAttention, based on TEACache), which skips denoising steps whose early-block residual change falls below a threshold. A threshold of 0.12 gave a good quality/speed tradeoff. The tens of minutes of compile time added to cold starts were cut roughly 30x by persisting Inductor, Triton and CUDA caches on a volume and using Modal memory snapshots.

  • 2,000 robots walk into a shop...

    Shopify Engineering hardMaster

    SimGym runs simulated A/B tests on Shopify storefronts by sending up to 2,000 concurrent LLM-driven shopper agents through Browserbase cloud browsers. Because browsers bill per minute, inference latency directly drives cost: a ~20% latency cut lowered cost per merchant run by ~10%. The team self-hosted gpt-oss-120b on 48 B200 GPUs with vLLM and FlashInfer, using MXFP4 experts, an FP8 KV-cache, custom long-context speculative decoding kernels (EAGLE-3) and combined async/guided/speculative decoding. MIG partitioning cut latency ~20% and prefix-cache-friendly prompts added ~12% throughput, while lowering reasoning effort was rejected because error rates rose to as much as 10.9%.

The quest for software engineering knowledge.

Look:
Layout: