<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jagadish Mukku on Medium]]></title>
        <description><![CDATA[Stories by Jagadish Mukku on Medium]]></description>
        <link>https://medium.com/@jagadish.mukku?source=rss-ed3249d233dc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Jagadish Mukku on Medium</title>
            <link>https://medium.com/@jagadish.mukku?source=rss-ed3249d233dc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 23:24:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jagadish.mukku/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Inside the AI Agent Sandbox: Compute, Storage, and Lifecycle in the Architecture of Safe Autonomy]]></title>
            <link>https://medium.com/@jagadish.mukku/inside-the-ai-agent-sandbox-compute-storage-and-lifecycle-in-the-architecture-of-safe-autonomy-603738a96e98?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/603738a96e98</guid>
            <category><![CDATA[sandbox]]></category>
            <category><![CDATA[meta]]></category>
            <category><![CDATA[anthropic-claude]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Wed, 25 Nov 2026 17:23:47 GMT</pubDate>
            <atom:updated>2026-11-25T17:23:47.351Z</atom:updated>
            <content:encoded><![CDATA[<h4>How Google, Perplexity, Meta, and Anthropic build sandboxes for AI agents — and what happens when one pauses, resumes, or runs for days.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DPvxvM1A0x7FLaXfCOO6cA.png" /></figure><h3>TL;DR</h3><p>When an AI agent runs code, reads files, or browses the web for you, it does that inside a locked-down, temporary computer called a sandbox — so if it makes a mistake, the damage stays contained and doesn’t touch your real files or accounts. This article looks at how four companies — Google (Agent Substrate), Perplexity (SPACE), Meta (Muse), and Anthropic (Claude Code) — build these sandboxes, especially what happens to the agent’s work when it’s paused, resumed, or left running for a long time. Under the hood, they lean on a similar toolbox: lightweight “mini virtual machines” (Firecracker), stripped-down isolation layers (gVisor), and fast-cloning disk formats (btrfs, overlayfs) that let a sandbox start in milliseconds instead of minutes. Each company made a different trade-off with these tools: some bring the agent back almost instantly, some keep it running non-stop, and some just make sure there’s nothing sensitive inside to lose in the first place.</p><h3>1. Introduction — What Is an AI Agent Sandbox?</h3><p>Sometime in the last two years, “sandbox” quietly became one of the most important nouns in AI infrastructure. Every agent platform — Claude Code, Codex, Cursor, Devin, Perplexity’s Comet and SPACE, Google’s Agent Substrate, Meta’s Muse — now ships with one, and a crowded market of dedicated sandbox vendors (E2B, Daytona, Modal, Northflank, Vercel Sandbox, Blaxel) has grown up around the problem of building them well. An AI agent sandbox, at its core, is a controlled execution environment that isolates agent operations from production systems: when an agent runs code, reads files, or makes network requests, those actions happen inside the sandbox rather than against real infrastructure. A well-designed sandbox rests on three layers of protection: <strong>compute isolation</strong> (a separate process, container, or microVM with its own kernel, bounding what the agent can execute), <strong>network controls</strong> (bounding what the agent can reach over the wire), and <strong>storage</strong> (bounding what the agent can read, write, and persist). Section 3 covers compute, and Section 4 — the centerpiece of this article, and where some of the most interesting and least-discussed engineering tradeoffs live — covers storage.</p><p><strong>Where the sandbox sits in the agent architecture.</strong> It helps to be precise about what’s inside the boundary and what’s outside it, because there are two genuinely different ways to draw that line.</p><p>In the first pattern, the entire agent — the harness, the orchestration loop, model calls, memory, and tools — runs <em>inside</em> the sandbox, and it’s reached from the outside over the network, mirroring how one might run an agent locally on a laptop. The appeal is simplicity — the agent gets direct local access to its own filesystem and memories, which suits single-user, long-lived sessions well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UV6FIUigukk1YQF771Dlqw.png" /><figcaption>Simple, but a single blast radius: everything the agent can do and everything it can touch sit behind the same wall.</figcaption></figure><p>In the second, more common production pattern, the orchestration loop stays <em>outside</em> the sandbox, and the sandbox is treated purely as a tool the harness calls into. Most production agents are built around a harness — the orchestration loop and tool-execution plumbing that sits between the raw model and the outside world. For each tool call, the harness validates arguments, checks permissions, executes in a sandboxed environment, and captures results, which is exactly the point at which isolation decisions get enforced. In practice this means the model and the decision-making loop sit outside the sandbox boundary, while the sandbox is where the harness actually carries out whatever action the model decided on — running a shell command, executing generated code, writing a file, or making a network call. Only the result of that action crosses back across the boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZjjLTtfdjKGwMYJPTPXL4A.png" /><figcaption><em>Credentials and session state never cross into the sandbox. A compromised sandbox is simply thrown away and rebuilt.</em></figcaption></figure><p>The sandbox, then, is less a single piece of technology than a boundary assembled out of three overlapping layers — compute, network, and storage — each enforced at a different point in the stack. The next section looks at why that boundary needs to be so unforgiving; the rest of this article looks at how it’s actually built, layer by layer, starting with compute and moving into storage, where the most interesting and least-discussed tradeoffs live.</p><h3>2. Why Agents Need Sandboxes: The Threat Model</h3><p>An agent that can run code, read files, and make network calls is also an agent that can be tricked into misusing all three. A prompt injected into a webpage, a document, or a tool’s output can redirect the agent into running a command it was never asked to run, reading a file it was never meant to touch, or sending data somewhere it shouldn’t go — and because the agent is just following instructions it believes came from the user, it often can’t tell the difference between a legitimate task and an attack. Sandboxing doesn’t try to make the agent smart enough to always catch the trick. It assumes the trick will sometimes work, and makes sure that when it does, the damage stops at the boundary.</p><h3>3. The Compute Layer — Isolation Architectures</h3><p>Compute isolation answers one question: when the agent runs code, what is that code actually running on top of?</p><p>There are three common answers. A plain container. A gVisor sandbox. A microVM. Each draws the line between “agent” and “host machine” in a different place.</p><h3>3.1 Containers Aren’t Enough: The Shared Kernel Problem</h3><p>A normal container is just a walled-off set of processes. It still shares the host’s kernel.</p><p>That matters because the kernel is a large, complex program. It has bugs. A container can sometimes trick the kernel into doing something it shouldn’t — this is called a container escape.</p><p>For trusted code, that risk is usually fine. For AI-generated code, it isn’t. The agent didn’t write code you reviewed. It wrote code on the fly, based on a prompt. Treating that code as untrusted is the safer default, and a shared kernel is too thin a wall for untrusted code.</p><h3>3.2 gVisor: Isolation via User-Space Kernel</h3><p>gVisor adds a layer between the container and the real kernel.</p><p>Instead of letting the container talk to the host kernel directly, gVisor intercepts those calls itself. It acts like a kernel, written in user space, that only forwards the safe parts through.</p><p>The upside: strong isolation, without needing a full virtual machine. The downside: it still shares the same physical host kernel underneath, so it’s a thinner wall than a microVM. Some system calls are also slower, because every one passes through gVisor first.</p><p>Google’s Agent Substrate and several other agent platforms use gVisor as their default isolation layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMtRpFJf7Bj6O17USQwLUg.png" /><figcaption><em>gVisor’s one wall: every system call is intercepted and checked before it ever reaches the real, shared host kernel.</em></figcaption></figure><h3>3.3 MicroVMs: Isolation via Hardware Virtualization (Firecracker, Kata)</h3><p>A microVM is a tiny, stripped-down virtual machine. It has its own kernel. It does not share one with the host at all.</p><p>This is a stronger boundary than gVisor’s. A bug in the agent’s code would have to break out of its own kernel, and then out of the hypervisor, to reach the host. Two walls instead of one.</p><p>Firecracker is the best-known microVM for this use case. It boots in about 125 milliseconds and uses roughly 5 MB of memory overhead per instance. That’s fast enough to spin up a fresh microVM for almost every agent task. Firecracker powers AWS Lambda, E2B, and Vercel Sandbox.</p><p>The tradeoff is GPU access. Passing a GPU through to a microVM is harder than passing it through to a container. Platforms built on gVisor, like Daytona, block GPU passthrough entirely. Self-hosted Firecracker is one of the few paths that still allows it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nATZTqlKCxqamGfwAZ_YCg.png" /><figcaption><em>The microVM’s two walls: a bug has to escape its own guest kernel, then the hypervisor, before it ever touches the host.</em></figcaption></figure><h3>3.4 Choosing an Isolation Tier: Trust, GPUs, and Cold Starts</h3><p>There’s no single right answer. The choice comes down to three questions.</p><p><strong>How untrusted is the code?</strong> Code from a vetted internal tool needs less isolation than code an LLM just generated from a user’s prompt.</p><p><strong>Does the agent need a GPU?</strong> If yes, that narrows the options, since not every isolation tier supports GPU passthrough.</p><p><strong>How fast does a session need to start?</strong> Containers start fastest. MicroVMs like Firecracker are close behind. gVisor sits in between on raw speed but adds overhead on every system call.</p><p>A simple rule of thumb: the more untrusted the code, the thicker the wall should be — even if that wall costs a little more latency.</p><h3>4. The Storage Layer: Where State Lives</h3><p>Compute decides what wall surrounds the agent. Storage decides what’s left behind once the agent stops running.</p><p>This is the layer with the least agreement across the industry. Every major platform handles it differently. Some throw everything away between runs. Some keep a little. Some keep almost everything, forever.</p><p>That disagreement is the most interesting part of agent sandbox design — so this section spends the most time here.</p><h3>4.1 Why Agent Storage Is Harder Than Stateless Web Storage</h3><p>A normal web server is stateless by design. Each request comes in, gets handled, and the server forgets about it. Nothing needs to carry over to the next request.</p><p>An agent breaks that assumption. It often needs to remember what it did five minutes ago, or five days ago.</p><p>Think about what an agent accumulates during a single task: the repository it cloned, the packages it installed, the files it wrote, a half-finished shell history, maybe a running background process. None of that is a request. It’s a workspace.</p><p>And a workspace has more than one kind of state inside it, which is where this gets harder than it first looks.</p><p><strong>Filesystem state</strong> is the easy part to picture: source files, config, logs, anything written to disk.</p><p><strong>The installed environment</strong> is a second, separate layer: language runtimes, system packages, anything that took time to set up.</p><p><strong>Process state</strong> is a third, often-forgotten layer: whatever is running right now in memory — open network sockets, a long-lived server process, variables sitting in RAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NpHyqAq_qjuUh2y3eRcFCQ.png" /><figcaption><em>The three layers of an agent’s workspace. The further up the stack, the harder it is to save and restore.</em></figcaption></figure><p>Here’s the catch: these three layers don’t always survive together. Saving the filesystem is cheap and well-understood. Saving running process state is much harder, because memory changes constantly and a process can be mid-write when you try to capture it.</p><p>That gap is why “restore the sandbox” can mean very different things depending on the platform. Some restore only the filesystem, and the agent effectively reboots — installed packages and files are back, but anything that was running has to start over. Others restore filesystem and memory together, and the agent picks up mid-sentence, mid-process, exactly where it left off.</p><p>Which one a platform chooses is not a small implementation detail. It changes what a “session” even means to the agent. The rest of this section looks at how different platforms answer that question, and why they don’t agree.</p><h3>4.2 Storage Primitives: tmpfs, Volumes, Object Storage, Networked Filesystems</h3><p>Before looking at full platforms, it helps to know the basic building blocks. Most agent sandboxes are assembled from four of them, and real platforms almost always combine more than one.</p><p><strong>tmpfs</strong> lives in memory, not on disk. It’s the fastest option, because reading and writing it is just reading and writing RAM. The tradeoff is that it disappears the moment the sandbox stops. E2B’s sandboxes are built this way: the writable layer is a tmpfs mount that lives in RAM, while the base image underneath is read-only and kept separate.</p><p><strong>Volumes</strong> are ordinary block storage — the kind of disk attached to any virtual machine. A volume can be created once, then attached, detached, and reattached later, and it survives even if the sandbox itself is deleted. Modal uses this model for longer-lived data: its Volumes mount into the sandbox and expose a path the agent can read and write, with files persisting across sandbox restarts, separate from Modal’s checkpoint/snapshot mechanism.</p><p><strong>Object storage</strong> is different again — a flat store of named blobs, the same kind of storage behind S3 or Cloud Storage. Sandboxes don’t run directly off it; it’s too slow for that. Instead, it’s where a paused sandbox’s snapshot gets uploaded, so it can later be pulled down and restored on any machine. Both Google’s Agent Substrate and Perplexity’s SPACE use this pattern: Substrate saves a snapshot to Cloud Storage across three layers — memory, root filesystem, and durable directories — when an agent is suspended. SPACE does the same with its own object store: the VM is paused, a full snapshot is taken, and the sandbox is only marked restorable once every snapshot artifact has finished uploading.</p><p><strong>Networked filesystems</strong> sit in between. A filesystem like NFS can be mounted by more than one sandbox at once, which plain volumes usually can’t do. Google’s Agent Substrate offers this as an optional layer called Filestore agent volumes — a managed NFS service built specifically for agent sandboxes, with read-write-many access and file locking so multiple agents can safely collaborate on the same files. Modal, notably, moved away from this model: its older NetworkFileSystem primitive was limited to a single cloud region, so the company replaced it with Volumes, which read and write quickly across every region.</p><p>One more primitive is worth naming here, even though it gets its own full section next: <strong>copy-on-write</strong>. Rather than giving every sandbox a full copy of its starting filesystem, a copy-on-write filesystem gives it a cheap clone that only grows as the sandbox writes new data. Perplexity’s SPACE uses btrfs for exactly this reason — a sandbox’s root filesystem starts as a copy-on-write clone of a template already sitting on disk. E2B does something similar with an overlay filesystem, plus lazy, on-demand loading of memory pages as the sandbox actually touches them.</p><p>Put together, a simple pattern emerges: tmpfs for speed, volumes for single-sandbox persistence, object storage for durable snapshots that can move between machines, and networked filesystems for sharing across sandboxes. No platform uses just one. The case studies later in this section show how Google, Perplexity, Meta, and Anthropic each combine these differently — and why.</p><h3>4.3 Copy-on-Write: The Foundational Trick Behind Fast Sandboxes</h3><p>Section 4.2 mentioned copy-on-write in passing. It deserves more room, because it’s the single idea that makes fast sandbox creation possible at all.</p><p>Here’s the problem it solves. Every sandbox needs to start from somewhere — a base image with an operating system, some tools, maybe a language runtime already installed. The naive approach is to copy that entire image for every new sandbox. That copy takes time, and it takes disk space, multiplied by however many sandboxes are running.</p><p>Copy-on-write avoids the copy. A new sandbox doesn’t get its own full copy of the base image. It gets a clone that points at the same underlying data. Nothing is actually duplicated yet.</p><p>The “write” part is where it earns its name. The moment the sandbox changes a block of data — writes a file, modifies a config — only <em>that</em> block gets copied and changed. Everything the sandbox hasn’t touched still points back to the shared original.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*giX4Lpm-9y0mBFZmIRz3rg.png" /><figcaption><em>One base, many clones. Every sandbox shares the same read-only base and only stores the blocks it personally changed.</em></figcaption></figure><p>This is why it matters for speed. Creating a sandbox becomes a near-instant pointer operation instead of a slow disk copy. Perplexity’s SPACE relies on this directly: it uses btrfs as its on-node filesystem, and handing a new sandbox its own writable root filesystem is a copy-on-write clone rather than a full copy, which is also why SPACE can create a sandbox in about 60 milliseconds.</p><p>It also matters for storage cost. A hundred sandboxes cloned from the same base image don’t need a hundred copies of that image on disk — they share it, and only pay for the bytes each one individually changes.</p><p>E2B applies the same idea to memory, not just disk. Its sandboxes resume from a snapshot by loading memory pages lazily, only as the sandbox actually touches them, through the same page-fault mechanism an operating system already uses for virtual memory.</p><p>Modal shows this same trick on the filesystem side, using plain Linux overlayfs rather than btrfs. A sandbox’s filesystem is a read-only base layer merged with a writable layer on top, and the first time a file is touched, it gets copied into that writable layer before the change is applied.</p><p>Different platforms pick different copy-on-write filesystems to do this — btrfs, overlayfs, and ZFS are the three most common — but the underlying trick is the same everywhere: clone cheaply, copy only what changes.</p><p>If a sandbox’s storage is just a clone that tracks changes, then <em>snapshotting</em> that sandbox — freezing its state so it can be resumed later — is a natural extension of the same idea.</p><h3>4.4 Snapshot Anatomy: Memory, Filesystem, and the Consistency Problem</h3><p>A snapshot is how a sandbox gets paused and brought back later, and it has to decide which of the three state layers from 4.1 it actually captures.</p><p>There are two basic kinds.</p><p>Filesystem-only snapshotFilesystem + memory snapshot<strong>What’s saved</strong>Disk onlyDisk and running memory<strong>What’s lost</strong>Everything running in memoryNothing<strong>What resume feels like</strong>A rebootPicking up exactly where it left off<strong>Open files, sockets, processes</strong>Gone — must restartStill there<strong>Example</strong>A plain restored disk/volumeGoogle Agent Substrate, E2B</p><p>The second kind is harder to pull off: memory doesn’t sit still, so the sandbox has to actually be paused first — frozen in place — so nothing is changing mid-capture. Copy-on-write pays off here too. Google’s Agent Substrate freezes a suspended agent’s memory pages to storage and can restore them on a different machine in under 500 milliseconds; E2B loads memory pages back lazily on resume, the same way it does for disk.</p><p>Under the hood, there are two different ways to actually freeze memory. Firecracker, the microVM from Section 3.3, has this built in: it can pause a running microVM and dump its full memory image to a file in one step. E2B and Perplexity’s SPACE both use this directly — Firecracker does the freezing, and the resulting memory file is what gets uploaded and restored later. Google’s Agent Substrate takes a different path, because it’s built on gVisor rather than Firecracker: since gVisor already manages memory access itself, as described in Section 3.2, Substrate doesn’t need a hypervisor to freeze anything — it reads that memory state directly from gVisor and writes it to storage.</p><p>Perplexity’s SPACE shows the filesystem side of this process in detail. To suspend a sandbox, SPACE pauses the VM, takes a full snapshot, and uploads its artifacts to object storage — and the snapshot isn’t marked restorable until every one of those artifacts has finished uploading.</p><p>The four case studies coming up — Google, Perplexity, Meta, and Anthropic — each make a different choice about how much of this to do, and how often. That choice is really the question this whole section has been building toward: how much state does a sandbox owe the agent when it comes back?</p><h3>4.5 Case Study: Google Agent Substrate — Tiered Storage and Sub-500ms Resume</h3><p>Agent Substrate starts from one observation: most agents spend most of their time waiting — on a model, a human, a tool call — not doing anything that needs a machine running underneath them.</p><p>So Substrate splits the agent from the compute. An <strong>Actor</strong> is the agent’s identity and state. A <strong>Worker</strong> is the machine it happens to be running on. There are many more Actors than Workers at any moment.</p><p>When an Actor goes idle, Substrate snapshots its memory and disk to tiered storage and frees the Worker for someone else.</p><p>The clever part is how it wakes back up — and it isn’t the caller’s job to know. A lightweight proxy called atenet-router sits in front of every Actor. When a new request arrives for an Actor that&#39;s currently suspended, the proxy holds that request, tells the controller to wake it up, waits for the Actor to restore from storage onto an available Worker, then delivers the request as if nothing happened. The caller never checks whether the Actor was running or not. It just sends the request. The whole round trip, suspend-to-resume, takes under 500 milliseconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXVWH-s2JL-gdwzLZ2krgA.png" /><figcaption><em>Only a few Actors run on Workers at a time. Most sit suspended in Tiered Storage until a request wakes them.</em></figcaption></figure><p>That speed comes from gVisor, not a general property of sandboxes: because gVisor already manages its own memory and process tables (Section 3.2), Substrate can freeze and restore state without needing hypervisor-level VM snapshots at all. The tradeoff: GPU workloads aren’t supported this way, since gVisor can’t snapshot a live GPU context, and open connections — database sessions, MCP connections — don’t survive a suspend and have to reconnect on resume.</p><h3>4.6 Case Study: Perplexity SPACE — btrfs, Copy-on-Write Clones, and 60ms Creates</h3><p>Where Substrate optimizes for resuming an idle agent fast, SPACE optimizes for creating a brand-new one fast — and it’s open source, so the mechanics aren’t inferred from a blog post. They’re in the code.</p><p><strong>Every sandbox is a Firecracker microVM</strong>, the same isolation layer from Section 3.3. SPACE runs every task inside its own microVM, not a shared container.</p><p><strong>The filesystem is where Section 4.3’s copy-on-write idea shows up again, concretely.</strong> SPACE uses btrfs as the on-node filesystem for sandbox storage. A warm pool of pods already has common templates sitting on disk. When a new sandbox is requested, it binds to a matching pod, and its writable root filesystem is a copy-on-write clone of that template — not a fresh copy. That’s the direct reason SPACE can report a 60ms median create time, down from 185ms on its previous provider.</p><p><strong>Suspending a sandbox follows the same discipline described in Section 4.4.</strong> The VM is paused, a full snapshot is taken, and its artifacts are uploaded to object storage. The snapshot only becomes restorable once every one of those artifacts has finished landing. By default, a sandbox suspends automatically after six hours of no activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ko03sKmNvrUcI7TcbOHxw.png" /><figcaption><em>Suspension is automatic. Resumption always requires the caller to explicitly ask.</em></figcaption></figure><p><strong>Waking it back up is where SPACE makes a different choice than Substrate.</strong> Substrate’s proxy wakes a suspended Actor transparently — the caller never has to know (Section 4.5). SPACE doesn’t do that. Resuming a suspended sandbox means explicitly calling a :wake endpoint, and the caller is expected to then check that the sandbox is actually ready before sending it any more work. Suspension is automatic. Resumption is not.</p><p><strong>Credentials are kept outside the sandbox entirely.</strong> Secrets aren’t handed to the agent directly. They’re injected at the network layer instead, so the agent process itself never holds them — the same instinct Section 4.5 saw with Substrate keeping session state outside the Actor, applied with a different mechanism. Substrate hides the suspend/resume cycle from the caller; SPACE makes the caller participate in it. Neither is “more correct” — they’re optimizing for different things.</p><h3>4.7 Case Study: Meta Muse — Persistent Per-User VMs and the Runtime Cell</h3><p>Substrate and SPACE both treat a sandbox as something temporary — suspend it, snapshot it, throw it away, rebuild it elsewhere. Each user gets one VM, and it just stays alive.</p><p><strong>One dedicated VM per user, not a shared pool.</strong> Muse runs on a Muse Secure VM — a dedicated virtual machine that houses both the agent and a person’s data, contained so no one else’s agent can reach it. One person, one VM, indefinitely.</p><p><strong>Inside that VM, there are really only two zones.</strong> The agent itself — its harness, its tools, its workspace files — runs inside a systemd-nspawn container Meta calls the <strong>Runtime Cell</strong>, with the container’s root mapping to an unprivileged user on the host. This is the agent-in-sandbox pattern from Section 1 — the harness lives inside the isolation boundary, not outside it. Everything else that matters sits in the same VM, just outside that cell.</p><p><strong>Outside the cell, a component called Sentinel decides what the agent is allowed to do.</strong> The agent never talks to the outside world directly: every connector action and every byte of network egress has to pass through Sentinel first, and the agent has no way to override it. This is the enforcement point — not a passive log, an active gatekeeper the agent cannot talk its way around.</p><p><strong>Credentials follow the same outside-the-cell rule, with a twist: the agent never even sees a placeholder it could leak.</strong> A service called hatch-authd stores real credentials and mints surrogate tokens for the agent to use instead, so the agent operates entirely on substitutes — the real secret is only ever attached by Sentinel at the moment a request actually leaves the VM. Even a fully compromised agent process has nothing real to exfiltrate.</p><p><strong>Durable application state lives in Postgres, also outside the cell but still inside the same VM.</strong> This is the part worth being precise about: it isn’t stored on some separate external database service. It’s a sibling of Sentinel and hatch-authd, inside this one user’s VM. The browser broker, connector workers, and prompt-injection classifiers all sit in that same outer zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cuz4VIaYJIezT6DIPn3djg.png" /><figcaption><em>Only the Runtime Cell is untrusted. Everything that enforces, stores, or persists sits one layer outside it — but never leaves the VM.</em></figcaption></figure><p>It’s the most different of the three case studies so far: Substrate pools and snapshots, SPACE clones and suspends, and Muse just keeps one machine running per user and suspends if idle.</p><h3>4.8 Case Study: Anthropic — Two Different Sandboxes for Two Different Places</h3><p>Anthropic runs three agentic products — claude.ai, Claude Code, and Claude Cowork — and treats containment as the primary engineering answer to agent risk: rather than supervising what the agent does, they supervise what it’s able to do, by enforcing access boundaries through sandboxes, virtual machines, and egress controls.</p><p><strong>Anthropic explicitly distinguishes two defense strategies, and doesn’t rely on the first one alone.</strong> The first is human-in-the-loop supervision — Claude Code used to ask for permission at every turn. Anthropic found that approach fallible in practice: internal telemetry showed users approved roughly 93% of permission prompts, and the more approvals a user sees, the less attention they pay to each one. The second strategy, containment, exists specifically because of that failure mode — a deterministic boundary doesn’t get tired of asking.</p><p><strong>Locally, on your own machine, there’s no VM at all — just OS-level restriction.</strong> Anthropic’s own description: sandboxing is built on top of operating system-level features to enable two boundaries — filesystem isolation, which ensures Claude can only access or modify specific directories, and network isolation, which ensures Claude can only connect to approved servers. Both are necessary together: without network isolation, a compromised agent could exfiltrate sensitive files; without filesystem isolation, it could escape the sandbox and gain network access. The mechanism is open-sourced as sandbox-runtime, and it uses native OS primitives directly — sandbox-exec on macOS, bubblewrap on Linux — with no container runtime involved. In Anthropic&#39;s own internal usage, this safely reduced permission prompts by 84%.</p><p><strong>In the cloud — Claude Code on the web — it’s a different world entirely: a real Firecracker microVM.</strong> This isn’t documented in Anthropic’s public engineering posts, but it’s directly observable: inspecting a live Claude Code on the web session shows a kernel booted with --firecracker-init, and the kernel log reports Hypervisor detected: KVM underneath it. The root filesystem is plain ext4 on a virtio block device, not a copy-on-write filesystem — a real contrast to Google Substrate, Perplexity SPACE, and Meta Muse, all of which lean on copy-on-write or a dedicated persistent VM somewhere in their design. Several other volumes are mounted read-only as squashfs or ext4 (tool binaries, skill packages, the environment runner). Project files are reached through a FUSE-mounted volume handled by a custom rclone remote type, rclone-filestore, rather than a standard backend like s3: or gcs:. Independent reverse-engineering analysis — unverified by Anthropic, so treated here as a secondary, lower-confidence source — suggests this filestore mount doesn&#39;t talk to object storage directly, but instead routes file I/O over an internal RPC call back to Anthropic&#39;s own API, which presumably sits in front of some storage layer further down. What that backend actually is remains unconfirmed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2p8z6xu3jbxn1xRM4a5zg.png" /><figcaption><em>Two very different sandboxes, chosen by where the session needs to run — one is a restricted process on your own machine, the other is a full microVM in Anthropic’s cloud.</em></figcaption></figure><p><strong>Whichever boundary is in play, the credential rule is the same.</strong> For Claude Code on the web specifically, the sandbox is designed to ensure that sensitive credentials, such as git credentials or signing keys, are never inside the sandbox with Claude Code — so even if the code running in the sandbox is compromised, the user stays safe. Git access routes through a proxy outside the sandbox: the git client inside authenticates with a scoped credential, and the proxy attaches the real token only after verifying the request, before it reaches GitHub.</p><p>Anthropic’s answer to this section’s recurring question — how much state does a sandbox owe the agent when it comes back? — depends on which of two genuinely different sandboxes you’re in: a lightweight OS-level restriction on your own machine with nothing hidden, or a real microVM in the cloud with its own kernel, its own disks, and a credential that never arrives in the first place.</p><p>A caution worth repeating from Section 4.8: the Anthropic-cloud column mixes confirmed, directly-observed facts (the microVM, the filesystem types, the FUSE mount) with one unconfirmed detail — what sits behind rclone-filestore — which is flagged in the text and left blank here rather than guessed at.</p><h3>5. Conclusion: Where Agent Sandboxing Is Headed</h3><p>Every sandbox in this article is answering the same two questions differently: how much do you trust the code running inside, and how much should it remember when it comes back? Substrate, SPACE, Muse, and Anthropic each land in a different spot — pooled and resumable, cloned and suspendable, persistent and always-on, or minimal and nearly stateless — and none of them is wrong. The right answer depends on the agent you’re actually building, not on which pattern looks most sophisticated.</p><h3>References</h3><p><strong>Google Agent Substrate</strong></p><ol><li>Google Open Source Blog — <em>Sandboxing Untrusted AI Agents at Scale: Google Donates Agent Substrate and gVisor to the CNCF</em> — <a href="https://opensource.googleblog.com/2026/11/sandboxing-untrusted-ai-agents-at-scale.html">https://opensource.googleblog.com/2026/11/sandboxing-untrusted-ai-agents-at-scale.html</a></li><li>Google Cloud Blog — <em>Open infrastructure for autonomous agents comes to CNCF</em> — <a href="https://cloud.google.com/blog/products/containers-kubernetes/open-infrastructure-for-autonomous-agents-comes-to-cncf">https://cloud.google.com/blog/products/containers-kubernetes/open-infrastructure-for-autonomous-agents-comes-to-cncf</a></li></ol><p><strong>Perplexity SPACE</strong> 3. Perplexity SPACE GitHub repository — <a href="https://github.com/perplexityai/SPACE">https://github.com/perplexityai/SPACE</a></p><p><strong>Meta Muse</strong> 4. Muse.ai official blog — <em>How We Built Safety Into Muse</em> — <a href="https://muse.ai/blog/security-and-safety-for-ai-agents-our-approach-with-muse">https://muse.ai/blog/security-and-safety-for-ai-agents-our-approach-with-muse</a></p><p><strong>Anthropic</strong> 5. Anthropic Engineering — <em>How we contain Claude across products</em> — <a href="https://www.anthropic.com/engineering/how-we-contain-claude">https://www.anthropic.com/engineering/how-we-contain-claude</a> 6. Anthropic Engineering — <em>Making Claude Code more secure and autonomous with sandboxing</em> — <a href="https://anthropic.com/engineering/claude-code-sandboxing">https://anthropic.com/engineering/claude-code-sandboxing</a> 7. Anthropic — <em>Code execution tool</em> (docs) — <a href="https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/code-execution-tool">https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/code-execution-tool</a> 8. GitHub — <em>anthropics/sandbox-runtime</em> — <a href="https://github.com/anthropics/sandbox-runtime">https://github.com/anthropics/sandbox-runtime</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=603738a96e98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[vLLM Cold Start: What Storage Really Costs]]></title>
            <link>https://medium.com/@jagadish.mukku/vllm-cold-start-what-storage-really-costs-e7f434c1c5ca?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7f434c1c5ca</guid>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 17:48:14 GMT</pubDate>
            <atom:updated>2026-11-18T17:48:14.547Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What loading weights from a distributed file system costs, and what else slows a cold start.</em></p><p>Every time you start an inference server, the GPUs sit idle until the model is loaded. For a 72-billion-parameter model, that means moving 145 GB of weights from storage into GPU memory, and we set out to measure how long that step really takes.</p><p>We loaded Qwen2.5–72B-Instruct with vLLM, an open-source inference engine, onto 8 NVIDIA B300 GPUs. The weights lived on a distributed file system (3FS) running on 12 NVMe drives across three nodes. With default settings, a cold start took <strong>193 seconds</strong> (mean of three runs, range 188–200 s). After the changes described in this article it takes <strong>72 seconds</strong> (mean of five randomised runs, range 69–73 s). That is 63% less time, or 2.7x faster.</p><p>We expected storage to be the primary bottleneck. It turned out to be only one of several. Of the original 193 seconds:</p><ul><li>about <strong>60 s</strong> went to reading weights from storage,</li><li>about <strong>12 s</strong> went to vLLM’s engine initialisation,</li><li>about <strong>120 s</strong> went to starting processes, which has nothing to do with storage.</li></ul><p>The largest single improvement, about 60 seconds, came from moving one import line in our launcher script. The storage work mattered too: switching the weight loader cut the weight-loading phase from about 70 s to 9.6 s, and the cluster&#39;s peak read rate rose from 6.5 GB/s to 31 GB/s.</p><p>The rest of this article covers both halves. We show what the storage path was doing, how a different loader changed it, and how the start-up stall was found and removed. Throughout, we separate what we measured from what we think might explain it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkHKhDKdkJDyRCi8JpTmOQ.png" /><figcaption><em>Figure 1. Where the cold-start time goes, before and after. Bars show single representative runs (192.5 s and 71.8 s). Headline figures in the text are means: 193 s (n=3), 72 s (n=5).</em></figcaption></figure><h3>The setup</h3><p><strong>The hardware.</strong> Three servers, each with 8 NVIDIA B300 GPUs, 256 CPU threads, 3 TB of RAM and four 15 TB NVMe drives. That makes 24 GPUs and 12 data drives in total. The servers are connected by InfiniBand.</p><p><strong>The storage.</strong> 3FS runs on all three servers, using all 12 data drives. Each piece of data is stored three times, on three different servers, so losing one server does not lose data. Applications reach it through a standard filesystem mount (a FUSE mount), so to vLLM it looks like an ordinary directory. All our vLLM runs used the mount on the first server.</p><p><strong>The workload.</strong> Qwen2.5–72B-Instruct, a 72-billion-parameter model stored as 37 files totalling 145 GB. vLLM split the model across the 8 GPUs of one server (tensor parallelism of 8), so each GPU holds an eighth of every layer. Every GPU therefore has to read its own part of the files at start-up.</p><p><strong>What we measured.</strong> The headline number is the wall-clock time of vLLM’s LLM() constructor. It covers starting the worker processes, setting up GPU communication, loading the weights, and warming up the engine.</p><p>Every timed run was <strong>cold</strong>: immediately before each run we dropped the operating-system page cache on all three servers, so the weights had to come from the drives and not from memory. We ran the five main configurations five times each, in randomised order, and the original baseline three times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7MgoTpk0mTHTeb-6vFzdw.png" /><figcaption><em>Figure 2. The test cluster. All vLLM runs used Server 1’s GPUs and its FUSE mount; the weights were read from the drives of all three servers over InfiniBand.</em></figcaption></figure><h3>Why a distributed file system</h3><p>Reading 145 GB in about five seconds takes about 30 GB/s. No single drive delivers that, and a single server is unlikely to either. The point of putting model weights on a distributed file system is to let one load draw on every drive in the cluster at the same time.</p><p>3FS is built for that. It cuts each file into 1 MiB chunks and spreads them across the drives of all the servers, keeping a copy of every chunk on each server. So any server’s drives can serve part of the same file, and a single reader can pull from all of them in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsROYoplEDB7Akh6F0FuSA.png" /><figcaption><em>Figure 3. How a file is spread over the drives, simplified. Chunk numbers and placement are illustrative; each chunk also has copies on the other two servers, not drawn.</em></figcaption></figure><p>First, what can the file system deliver? We measured it with fio, a standard storage benchmark, across a sweep of block sizes, queue depths and access patterns. The best sequential-read result through the FUSE mount, which is the path vLLM uses, was 37 GB/s across the three servers. Through 3FS’s user-space API, which bypasses FUSE, it reached 51.6 GB/s. This is the most the file system can give, so it is the goal for our optimization: a vLLM model load should read as close to it as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n7I3rUAnJn5a84eFVH0MwQ.png" /><figcaption><em>Figure 4. Highest sustained read rate in the fio sweep (direct I/O, 1 MiB blocks, queue depth 128, 60-second runs), all three servers combined.</em></figcaption></figure><p>Then we measured what a model load gets. We sampled disk reads on every server once per second. With the best loader, the drives on all three servers were busy at once:</p><ul><li>each server’s drives peaked at about 10.6 GB/s,</li><li>the cluster peaked at about 31 GB/s,</li><li>the checkpoint was read in a single pass, at 0.96x its size, with no re-reads.</li></ul><p>With vLLM’s default loader, the same storage delivered a cluster peak of only 6.5 GB/s, about a sixth of the file system’s peak. Having the bandwidth available is not the same as using it. The next sections show why, and what we changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KH1HSh797LGOp7u61ra_9w.png" /><figcaption><em>Figure 5. Highest one-second read rate across all three servers during a model load, mean of five cold runs. Figure 4 is a sustained 60-second rate, so the two are close but not identical measures.</em></figcaption></figure><h3>Where did the 193 seconds go?</h3><p>With vLLM’s default settings, a cold start took 188, 192 and 200 seconds in three runs (mean 193 s). We wanted to know what the time was spent on, before changing anything.</p><p>vLLM logs a timestamp at each stage of start-up, so we used those to split one representative run into its parts. Here is what happened, in order, with the time each step took:</p><ul><li><strong>2 s:</strong> vLLM reads the model configuration.</li><li><strong>23 s:</strong> it starts its engine-core process, which manages the GPU workers.</li><li><strong>13 s:</strong> the engine core starts the first of eight worker processes, one per GPU.</li><li><strong>66 s:</strong> the other seven workers come up, one after another.</li><li><strong>15 s:</strong> the last worker is ready, and weight loading begins.</li><li><strong>61 s:</strong> weights are loaded from storage (the slowest of the eight workers).</li><li><strong>12 s:</strong> vLLM sets up its memory and warms up the engine.</li></ul><p>Loading the weights, the part that depends on storage, was 61 seconds, about a third of the total. Everything before it took 119 seconds, and none of that involves reading the model. The largest single block was not the weights at all. It was the 66 seconds it took for the eight workers to come up one at a time instead of all together.</p><p>That changes what is worth optimizing. A faster storage path can shrink the 61 seconds, but it cannot touch the 119 seconds before it. The next sections cover both: first the storage path, then the worker start-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gk_aoWnCTjOV8c3g9rMyNw.png" /><figcaption><em>Figure 6. One representative cold run with default settings. Step boundaries come from vLLM’s log timestamps.</em></figcaption></figure><h3>Same storage, very different speed</h3><p>With vLLM’s default loader, the cluster read at a peak of 6.5 GB/s, when the file system can deliver 37. This section looks at what the loader was doing, and at what the same storage does under a different access pattern.</p><p><strong>How the default loader reads.</strong> vLLM maps each model file into memory and lets the operating system fetch the data on demand. Nothing is read when the file is opened. The data moves only when each page is first touched while it is copied to the GPU, and every touch triggers a page fault that fetches a small piece of the file. In a real load, each of the eight workers took between 165,000 and 443,000 of these faults.</p><p><strong>What the file system saw.</strong> Because the data arrives one fault at a time, the mount handled only about 14 requests at once, and each one was small: 113 KiB on average and never more than 256 KiB, even though the mount allows 1 MiB.</p><p><strong>Same storage, different access.</strong> To check that the storage was not the limit, we read the model files with fio through the same FUSE mount, with no vLLM involved. Each job read a different shard once, from cold:</p><ul><li>buffered reads, 8 files: <strong>7.1 GB/s</strong></li><li>buffered reads, 32 files: <strong>13.8 GB/s</strong></li><li>direct I/O (bypassing the page cache), 8 files: <strong>10.4 GB/s</strong></li><li>direct I/O, 32 files: <strong>34.4 GB/s</strong></li><li>asynchronous direct I/O with 1 MiB reads, 8 files: <strong>37.4 GB/s</strong></li></ul><p>On the same client and the same drives, direct I/O delivered about 2.5x more than buffered reads, and asynchronous direct I/O about 5x more. The file system could deliver far more than the default loader got. The loader’s access pattern was the limit. That is the target for the next section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XOXcX5Xf4gYkOnvD-9gxGA.png" /><figcaption><em>Figure 7. fio reads of different model shards through the FUSE mount, from cold. Each configuration is a single run.</em></figcaption></figure><h3>Picking the right loader</h3><p>vLLM can load model weights in several ways. We tested five on the same storage. To compare them fairly, all five ran with the same launcher script (a version that fixes a separate start-up problem, covered in the next section), from cold, in randomised order.</p><p>Because of that launcher, the default loader’s numbers here differ from the baseline above. Its start-up is 139 s, not 193 s, and its weight loading is about 70 s, not 60 s. The default loader also varies from run to run. Across eight runs its weight loading took anywhere from 55 to 82 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H--tF0Kfs4meDHw_Opm6_Q.png" /><figcaption><em>Figure 8. The five loaders, cold start, in randomised order.</em></figcaption></figure><p>The ranking held in randomised order. The gaps between neighbours are 23, 10 and 34 seconds, many times larger than the run-to-run spread of 1.3 to 1.6 seconds. The default loader is the exception. Its five runs ranged from 129 to 153 seconds.</p><p><strong>instanttensor was the fastest, by a wide margin.</strong> Weight loading took 9.6 seconds, against 70 for the default loader. The log shows it reading the whole checkpoint in about 4 to 5 seconds, at about 30 GB/s. The cluster’s peak one-second rate was 31.4 GB/s, close to the 37 GB/s goal from Figure 4.</p><p><strong>The storage saw a different workload.</strong> Each server’s drives peaked at 10.6 GB/s with instanttensor, three to six times the other loaders. Every loader except the default read the checkpoint exactly once, at 0.96x its size. The default loader read 1.65x as much, so some data was read from the drives more than once.</p><p><strong>fastsafetensors came third.</strong> With tensor parallelism, vLLM runs it without GPUDirect Storage, using one reader thread per GPU. Its weight loading took 36 seconds, about half the default loader’s 70.</p><p><strong>eager was the worst by far.</strong> vLLM&#39;s documentation recommends it for network file systems. Here it took 477 seconds, about 3.4 times slower than the default loader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*93UX4EQR5yjoKi8LX4JxLg.png" /><figcaption><em>Figure 9. Weight loading time and peak read rate per server by loader, means over five cold runs. The </em><em>eager strategy is left out because it would dwarf the rest.</em></figcaption></figure><h3>Eight workers, started one at a time</h3><p>Earlier we saw that the eight GPU workers took 66 seconds to come up. In a healthy start they would all come up together. This was the biggest single win in the project, and it had nothing to do with storage.</p><p><strong>What we saw.</strong> Each worker logs a line when it starts setting up GPU communication. With the original launcher script, the eight workers did so at 0, 6, 17, 27, 33, 43, 53 and 63 seconds. That is a queue, not a parallel start. The gap between the first and last worker was 63 to 66 seconds in every original-launcher run.</p><p><strong>It was not the GPUs.</strong> We started eight processes on their own, each creating a CUDA context on its own GPU. All eight finished in about 14 seconds, together. The GPUs were not the serial resource.</p><p><strong>It was how the workers are started.</strong> vLLM starts each worker as a fresh Python process (the spawn method), and a fresh process first re-imports the launcher script. Our launcher script imported all of vLLM at the top, so every worker spent about 10 seconds on that import before it could do anything. vLLM uses spawn because the launching process had already initialised CUDA. In our case, flashinfer, a GPU library that vLLM depends on, did that when it was imported.</p><p><strong>Why the start-up queued.</strong> The parent process sends each worker about 14 KB of start-up instructions through a pipe. Inside our Docker container, a pipe holds only 8 KiB, against 64 KiB on the host, so the message does not fit. The parent’s write blocks until the worker reads it, and the worker reads only after its 10-second import. We measured Process.start() at 10.1 to 10.8 seconds for each of the eight workers, while the actual process launch took under a millisecond. Eight workers, one after another, gave the queue. We measured the 8 KiB, but we did not find out why the container&#39;s pipes are that small.</p><p><strong>Two fixes, either of which works:</strong></p><ul><li><strong>Move the import.</strong> We moved from vllm import LLM inside the main() function, so the launcher imports nothing heavy at the top. The gap between the first and last worker fell from 63 seconds to 7-8.</li><li><strong>Give the container </strong><strong>--cap-add SYS_RESOURCE.</strong> With the original launcher unchanged, this restored 64 KiB pipes. Process.start() took 1 to 2 milliseconds, all eight workers were launched within 7 milliseconds, and start-up took 73.2 seconds (five cold runs, 71.6 to 75.2), against 132 to 136 seconds without it. The fixed launcher alone gave 71.5.</li></ul><blockquote><strong><em>Note.</em></strong><em> </em><em>SYS_RESOURCE is not the only way to get larger pipes. </em><em>CAP_SYS_ADMIN and </em><em>--privileged also gave 64 KiB, but they grant broader privileges. We did not test other ways to enlarge pipes inside the container, so a less privileged option may exist. Moving the import is the fix that needs no change to the container.</em></blockquote><p>The import move cut 54 to 66 seconds from every loader we tried: 193 to 139 s for the default loader, 152 to 95 for Run:ai, 171 to 105 for fastsafetensors, and 132 to 72 for instanttensor. It is a property of the launcher script and the container, not of the storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aHFwEBEnLU8SNZiMYYgjQg.png" /><figcaption><em>Figure 10. When each of the eight workers started GPU set-up, in seconds after the first. One example run for each launcher. Workers that started at the same moment are stacked.</em></figcaption></figure><h3>Putting it together</h3><p>Loading the weights from storage was part of the cold-start problem, about a third of the original 193 seconds, but not all of it. A model load reads 145 GB in one burst, so it is best served by a storage architecture that spreads the data across many drives and lets a reader use the drives of every server at once, as 3FS does. With the right loader, the drives on all three servers were busy together and the cluster peaked at 31 GB/s, while the default loader got only 6.5 GB/s from the same drives. Choosing the loader mattered: on our network file system, switching to instanttensor cut the start from 139 to 72 seconds. The best loader may differ for local disks or S3-style object storage, which we did not test, so the way to solve this part is to try the available loaders on your own storage and measure from cold. The rest of the problem had nothing to do with storage: moving one import line in the launcher cut the start from 193 to 139 seconds, whatever the storage underneath.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7f434c1c5ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantifying NVMe Storage Requirements for LLM KV Cache Memory Extension]]></title>
            <link>https://medium.com/@jagadish.mukku/quantifying-nvme-storage-requirements-for-llm-kv-cache-memory-extension-6c4e14d5f102?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c4e14d5f102</guid>
            <category><![CDATA[cloud-storage]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[llm-inference]]></category>
            <category><![CDATA[data-storage]]></category>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 15:08:21 GMT</pubDate>
            <atom:updated>2026-07-14T15:08:21.749Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*iu4fxGbxvZ2DVOwtkoXxoA.png" /></figure><h3><strong>TL;DR</strong></h3><p>Serving long-context LLMs requires extending KV cache memory beyond GPU HBM into NVMe storage. Sizing that NVMe layer correctly is non-trivial — and getting it wrong stalls your GPU.</p><p>This article works through four methods to quantify NVMe I/O requirements: <strong>roofline estimation, stochastic modelling, discrete-event simulation, and real hardware profiling.</strong> Each method adds fidelity and has a different cost.</p><p><strong>Key finding:</strong> running Qwen3–32B on 2× H100s with ShareGPT multi-turn traces, the NVMe layer sustained <strong>1,740 MB/s read</strong> and <strong>1,359 MB/s write</strong> on average, with peaks of <strong>2.6 GB/s</strong> and <strong>3.2 GB/s</strong>. A laptop simulator predicted these numbers closely — before any hardware was involved.</p><h3>The Problem — When HBM Runs Out</h3><p><strong>Modern LLM inference is as much a memory problem as it is a compute problem.</strong></p><p>When a user sends a message in a multi-turn conversation, the model doesn’t recompute KV values of the entire conversation history from scratch. Instead, it retrieves the key-value (KV) vectors computed in prior turns from a cache — avoiding redundant computation and keeping response latency low. This KV cache is what makes conversational AI feel fast.</p><p>The catch: the KV cache lives in GPU HBM (High Bandwidth Memory), and HBM is scarce even on the latest hardware. NVIDIA’s Hopper-generation H100 SXM5 carries 80 GB of HBM3. The newer Blackwell B200 SXM nearly triples that to 192 GB of HBM3e — a significant leap, but still finite. Consider Qwen2.5–72B: its weights alone consume ~144 GB in FP16, exhausting a two-H100 setup before a single request arrives and leaving under 50 GB free on a single B200. Gemma 3 27B is leaner at ~54 GB, fitting on one H100 — but KV state accumulates quickly regardless of model size. Qwen2.5–72B uses grouped-query attention with 8 KV heads across 80 layers, meaning a single 32k-token session carries roughly 10 GB of KV cache. Add a few dozen concurrent long-context sessions on a B200, and even 192 GB of HBM saturates fast — before accounting for batch size, activation memory, or speculative decoding buffers.</p><p>The standard response is KV cache eviction: when HBM is full, push the least-recently-used KV blocks out to a cheaper, larger memory layer — CPU DRAM first, then NVMe SSD. When those evicted blocks are needed again (the user sends another message), they are fetched back. This is KV cache memory extension — expanding context memory beyond HBM into DRAM and NVMe.</p><p>The concept is straightforward. The engineering challenge is not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*ODxixM9e0kkKbrLQ2OntJg.png" /><figcaption>KV Cache Memory Extension — HBM → DRAM → NVMe</figcaption></figure><p>Designing a KV cache memory extension system starts with one question. Get it right and every downstream decision — drive selection, queue depth, eviction policy — falls into place:</p><blockquote><strong><em>What read and write IOPS and bandwidth does the NVMe layer actually need to sustain under a realistic LLM inference workload?</em></strong></blockquote><p>Under-provision and the NVMe layer becomes a bottleneck, stalling token generation while the GPU waits for evicted KV blocks to reload. Over-provision and you’ve bought expensive enterprise NVMe for headroom you’ll never use.</p><p>The answer requires more than a back-of-the-envelope calculation. This article builds up to it through four methods: a <strong>first-principles roofline</strong> that establishes the ceiling, <strong>queueing theory and stochastic modelling</strong> that capture burstiness and latency distributions, <strong>discrete-event simulation</strong> that plays out realistic workloads without a GPU, and <strong>real workload profiling</strong> that validates everything against hardware. Each layer adds fidelity. Each has a cost.</p><h3>KV Cache I/O Anatomy</h3><p><strong>Before reaching for estimation methods, it helps to be precise about what kind of I/O the NVMe layer actually sees.</strong> KV cache I/O is not generic database I/O or file I/O — it has a specific shape, a specific access pattern, and an asymmetry between reads and writes that matters for tuning.</p><h4>The Unit of I/O: The KV Block</h4><p>LLM serving frameworks like vLLM do not evict individual tokens to NVMe. They operate on <strong>KV blocks</strong> — fixed-size chunks of KV cache covering a contiguous group of tokens across all transformer layers. In vLLM’s default configuration, one block covers 16 tokens.</p><p>The size of KV cache per token and hence KV block is determined entirely by model architecture.</p><p>This is the fundamental I/O unit. Every read and every write to NVMe transfers one or more whole blocks. There is no sub-block access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*yjYC1tQ2wL4iblG8QnPqkQ.png" /><figcaption>From Request to KV blocks</figcaption></figure><p>The practical implication: KV cache I/O consists of <strong>large, sequential block transfers</strong> — not the small random reads that stress IOPS on a typical OLTP workload. A single eviction or retrieve operation for Qwen2.5–72B moves ~5 MB in one shot. This favors sequential bandwidth (GB/s) over raw IOPS, though IOPS still matter at high concurrency when many sessions are evicted or retrieved simultaneously.</p><h3>The Four Metrics</h3><p>The goal of all the estimation methods in this article is to put concrete numbers on four quantities:</p><ul><li><strong>Read MB/s</strong> — bandwidth consumed restoring evicted KV blocks back to HBM when a session resumes</li><li><strong>Write MB/s</strong> — bandwidth consumed evicting KV blocks from HBM to NVMe under memory pressure</li><li><strong>Read IOPS</strong> — number of block retrieve operations per second across all concurrent sessions</li><li><strong>Write IOPS</strong> — number of block eviction operations per second</li></ul><p>For Qwen2.5–72B at 5 MB per block: sustaining 100 read IOPS requires 500 MB/s of read bandwidth. For Gemma 3 4B at 1.6 MB per block, the same 100 IOPS costs only 160 MB/s. Model architecture directly sets the bandwidth multiplier.</p><h3>The Read/Write Asymmetry</h3><p>Reads and writes do not arrive at equal rates, and they do not carry equal urgency.</p><p><strong>Writes</strong> are triggered by memory pressure. When HBM fills, the eviction policy (LRU, prefix-aware, frequency-based) selects blocks to push to NVMe. This tends to happen in bursts — a wave of new long-context requests arrives, HBM saturates, and a batch of blocks is evicted together. Writes can often be issued asynchronously without blocking the GPU, so write latency is partially hideable.</p><p><strong>Reads</strong> are triggered by session resumption. When a user sends the next message in a conversation whose KV state was evicted, those blocks must be loaded back to HBM before the prefill can proceed. Reads sit on the critical path for TTFT. A slow read directly delays the response the user sees.</p><p>With the shape of the I/O understood, the next step is to put numbers on it. Here are four ways to do that, from a back-of-the-envelope estimate to full hardware profiling.</p><h3>Hardware Setup</h3><p>As we go through the various methods, we will look into the results with actual hardware. Here are the setup details.</p><p>The benchmarks ran on 2× NVIDIA H100 80GB HBM3 GPUs from an 8-GPU node, with ~69 GB allocated to the KV cache and ~74 GB to model weights. NVMe storage was provided by a Samsung PM174X (7 TB). The serving stack was vLLM v0.23.0 + LMCache v0.5.0.</p><p>Each plot will be accompanied with the details of the benchmark run.</p><h3>Method 1 — Quantitative Modelling</h3><p><strong>The fastest way to get a storage sizing number is to derive it from first principles — no hardware, no simulator, just model architecture parameters and a few workload assumptions.</strong> This section covers two complementary analytical methods: <strong>roofline estimation</strong>, which gives you a static throughput ceiling, and <strong>queueing theory</strong>, which tells you what happens to latency when traffic bursts against that ceiling.</p><h3>Roofline Estimation</h3><p>This model estimates the NVMe read and write storage bandwidth for an LLM serving framework utilizing a hierarchical KV cache infrastructure (vLLM → LMCache → Filesystem → NVMe). It assumes an optimized storage layer with clean cache tracking.</p><h4>Core Assumptions</h4><ol><li><strong>Steady State</strong> — HBM is 100% full.</li><li><strong>Conservation of HBM Space</strong> — Any operation that adds data to HBM forces an immediate eviction of old data to free up space.</li><li><strong>Clean Cache Tracking</strong> — Data pulled into HBM from NVMe is marked “clean.” When evicted, it is dropped from HBM without a redundant rewrite. Physical NVMe writes are strictly restricted to newly computed data.</li></ol><h4>Variable Definitions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQYwhsXRTfboSe355YlIIw.png" /><figcaption>Variable Definitions</figcaption></figure><h4>1. NVMe Read Bandwidth</h4><p>Storage reads occur exclusively when prompt tokens miss HBM but hit NVMe. Generated tokens never trigger reads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*i2y8zE5RuWWyTOPsRkP5tA.png" /></figure><h4>2. NVMe Write Bandwidth (BWwrite)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*5PTplR1Ttu3NHeesdUHnDg.png" /></figure><p>Two things drive NVMe writes:</p><ul><li><strong>Prompt tokens with no cache hit</strong> — missed both HBM and NVMe, computed fresh</li><li><strong>Generated tokens</strong> — always new, always written</li></ul><h4>Boundary Cases</h4><p><strong>Reads Worst-case (P_hbm = 0, P_nvme = 1)</strong> — zero HBM hits, all recurring history pulled from NVMe:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*ToXrY7SHq0tNtJFgmV8TOA.png" /></figure><p><strong>Writes Worst-case: Cold start (P_hbm = 0, P_nvme = 0)</strong> — 0% hit rate across both memory layers, all prompts computed from scratch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*KF5xOSZIkg9qA8tz6VYl4A.png" /></figure><p>In practice, T_prompt &gt;&gt; T_generate for most workloads — enterprise and RAG traces commonly have input contexts 10–50× longer than outputs. Under cold start, the write bandwidth is therefore dominated by newly computed prompt KV cache, not decode tokens.</p><h3>Results</h3><p>To validate the roofline calculations with the actual run on hardware, we need to choose the benchmark. To make the benchmark as close to real production scenarios, Mooncacke traces were chosen. The Mooncake traces are real-world LLM serving workloads released by Moonshot AI as part of their USENIX FAST 2025 paper “Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving”. They capture anonymized production traffic from Kimi, Moonshot’s commercial LLM service, and are available at <a href="https://github.com/kvcache-ai/Mooncake">https://github.com/kvcache-ai/Mooncake</a>. The conversational trace used in this benchmark contains 11,185 requests with an average input length of 8,628 tokens, representing realistic long-context conversational workloads.</p><p>In the first run, the NVMe cache is cold — every KV block must be computed from scratch and written to NVMe, producing zero reads. This gives us the write worst-case ceiling. The roofline bandwidth is calculated directly from the measured token throughput.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PmLgj5IkNK05CxPe8jxhTQ.png" /><figcaption>NVMe Writes Roofline Comparison</figcaption></figure><p>In the second run, the same traces are replayed against a fully warm NVMe cache — every KV block is loaded from NVMe rather than recomputed. This is the read worst-case. The improvement in input token throughput over the cold run illustrates the core value of KV cache memory extension: serving context from NVMe is faster than recomputing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5NvpUapGpy50mpn4-76JMw.png" /><figcaption>NVMe Read Roofline Comparison</figcaption></figure><p><strong>Where roofline breaks down</strong></p><p>Roofline is a steady-state, worst-case model. It cannot answer:</p><ul><li>What happens to read latency when 20 retrieve operations arrive in the same 10ms window?</li><li>What is P99 latency at 80% NVMe utilization?</li><li>How does queue depth behave under bursty multi-turn conversation traffic?</li></ul><p>For those questions, you need yo look beyond roofline.</p><h3>Beyond Roofline — Queueing Theory and Stochastic Demand</h3><p>Unlike roofline estimation, a stochastic model captures the statistical reality of LLM inference traffic — requests don’t arrive uniformly, context lengths vary widely, and cache block reuse is probabilistic. The math is rich enough to deserve an article of its own — this section outlines the model structure and leaves the derivation aside.</p><p>The model is built from four components:</p><ul><li><strong>Request arrivals</strong> — modelled as a Poisson process, where inter-arrival times follow an exponential distribution parameterized by λ (target request rate). This is the standard assumption for memoryless, independent arrivals.</li><li><strong>Input token length</strong> — modelled as a Gamma, Lognormal, or Zipf distribution depending on the workload character. Zipf captures the heavy-tailed reality of real prompt length distributions well.</li><li><strong>Output token length</strong> — modelled as a uniform distribution over a plausible range.</li><li><strong>KV cache block survivability</strong> — estimated using approximations that gives the probability that a cached block survives in the memory layer long enough to be reused, without requiring simulation. This gets more nuanced with prefix caching — a cached block is only reusable up to the point where the new request diverges from the cached prefix.</li></ul><p>Together, these distributions let you estimate NVMe IOPS and bandwidth for a wide range of deployment scenarios purely by adjusting distribution parameters — no hardware, no running inference stack. Swapping a Gamma for a Zipf input distribution, or shifting λ, immediately reprices the storage requirement. This makes the stochastic model significantly more flexible than roofline for exploring workload sensitivity before committing to hardware.</p><h3>Method 2 — Simulation</h3><p><strong>Analytical methods give you a sizing ceiling. What they cannot give you is the behavior that arises from the interaction between eviction policy, request mix, and cache pressure over time.</strong> For that you need simulation — and the key advantage of LLM inference simulators is that they give you this without requiring a single GPU.</p><h3>What Simulation Adds Over Analytical Methods</h3><p>Roofline and queueing theory require you to assume values for P_hbm, P_nvme, T_prompt, and T_generate. Simulation derives these from the workload itself. Feed in a trace of real requests — with their actual context lengths, inter-arrival times, and session structure — and the simulator tracks which KV blocks get evicted, which get retrieved, and at what rate, across thousands of requests. The I/O demand numbers fall out as measurement, not assumption.</p><p>Several open-source simulators exist for estimating LLM inference I/O demand without real hardware. <a href="https://github.com/llm-d/llm-d-inference-sim">llm-d-inference-sim</a> is a lightweight, OpenAI-compatible vLLM simulator written in Go that models KV cache allocation, eviction, and configurable prefill/decode latency profiles — useful for infrastructure and scheduler testing, but better suited for routing evaluation than storage sizing.</p><p>The <a href="https://jxing.me/pdf/unicache-sigmetrics26.pdf">UniCache</a> simulator is well-suited for this estimation. It is a trace-driven, CPU-based simulator built on top of vLLM’s scheduler — it retains vLLM’s request admission, KV block tracking, and prefix cache management logic, but replaces GPU execution with a lightweight token replay engine. This makes it roughly 30× faster than running on real hardware while preserving accurate cache hit and eviction behavior.</p><p>The simulator takes request traces as input — token sequences with arrival timestamps, session IDs, and turn structure — and internally manages KV block allocation, prefix hash matching, and eviction events using vLLM’s trie-based block organization. It outputs cache hit ratios, eviction counts, and TTFT metrics per request.</p><p>The authors — Bei Ouyang, Yifan Qiao, and Jiarong Xing (Rice University / UC Berkeley) — have made the full codebase publicly available at <a href="https://github.com/xsyslab/UniCache">github.com/xsyslab/UniCache</a>. With a few targeted modifications, NVMe can be added as a memory extension layer below HBM — intercepting eviction events and logging the resulting read and write I/O demands. The simulator already tracks every block eviction; adding NVMe accounting requires wiring those events to an I/O counter rather than discarding them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*OtmjsMcqCje7tm5CoN96jQ.png" /></figure><p>A simulator can sweep across all dimensions(cache size, eviction policy, specific workload structure) in minutes on a laptop. Running the equivalent parameter sweep on real GPUs would take lot of time and cost significant compute budget.</p><h3>Workload Traces</h3><p>The quality of a simulation is bounded by the realism of its input traces. In addition to the real world traces, it is worthwhile to generate the synthetic traces for the specific workload that the estimation is needed. As part of this synthetic trace generation, it should take into account the request token length, inter-arrival time for turns, cache re-usage ratio, request rate.</p><p>The below are the few trace sources that cover few production scenarios:</p><p><strong>ShareGPT</strong> is the most widely used benchmark trace for LLM serving research. It contains real conversational exchanges scraped from ChatGPT — multi-turn dialogues with variable prompt and response lengths. Its statistical properties (median context ~512 tokens, heavy-tailed length distribution) are representative of general-purpose chatbot workloads. vLLM, SGLang, and most open-source simulators ship with ShareGPT support out of the box.</p><p><strong>Mooncake traces</strong> come from Kimi’s production inference infrastructure (arXiv:2407.00079). They capture a mixture of short interactive sessions and long-context document processing — closer to a mixed enterprise workload than ShareGPT’s purely conversational distribution.</p><h3>Advantages</h3><p><strong>No GPU required.</strong> Runs on a laptop in under an hour for many configurations. The equivalent real-hardware sweep would require GPU cluster time and careful warm-up protocols.</p><p><strong>Controllable and reproducible.</strong> Every simulation run with the same trace and parameters produces identical results. There is no noise from thermal throttling, PCIe contention, or OS scheduling. This makes it practical to isolate the effect of a single variable — say, cache size — while holding everything else constant.</p><p><strong>Eviction policy comparison.</strong> Swapping LRU for prefix-aware LRU on real hardware requires redeploying the serving stack. In simulation it is a configuration flag. This makes simulation the natural tool for eviction policy selection before committing to an implementation.</p><p><strong>Fast iteration on architecture.</strong> Changing the DRAM, NVMe layer capacity or testing a different HBM:DRAM ratio takes seconds to configure and minutes to run. Hardware experiments take days.</p><h3>Siumlation Limitations</h3><p><strong>Throughput parameters must be supplied externally.</strong> The virtual time engine is only as accurate as its prefill and decode throughput inputs. If those numbers come from a different model, a different batch size, or a different hardware generation than your target deployment, the simulated timing — and therefore the eviction pressure — will be wrong. Garbage in, garbage out.</p><p><strong>No real NVMe latency jitter.</strong> The simulator models NVMe service time as a fixed latency or a simple distribution. Real NVMe devices exhibit latency spikes from garbage collection, write amplification, and controller queue depth effects that are not captured in simulation. Simulated P99 latency is therefore optimistic relative to real hardware.</p><p><strong>PCIe contention is invisible.</strong> In a real multi-GPU node, NVMe I/O competes with GPU-to-GPU transfers and CPU-to-GPU model weight loading on the PCIe bus. The simulator sees none of this. For workloads where PCIe is already near saturation, simulation will underestimate retrieve latency.</p><p><strong>Hit rate is sensitive to trace representativeness.</strong> The simulated hit rate is only meaningful if the trace matches the statistical structure of your real workload — session length distribution, inter-arrival times, prefix reuse patterns.</p><h3>Simulation Results</h3><p>The simulation was run against ShareGPT traces filtered to conversations with more than 4 turns, with 32 concurrent conversations outstanding at any point during the run. This workload creates sustained multi-turn context pressure — conversations accumulate KV state across turns, filling HBM and triggering NVMe evictions as the working set grows beyond what HBM can hold.</p><p>The first plot shows the simulated NVMe bandwidth and token throughput predicted by the simulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVo18hktmhqpakUjXy9eSA.png" /></figure><p>The second plot shows the same metrics measured on real hardware under identical trace conditions. The close alignment between the two validates the simulator’s eviction model — the predicted I/O demand and the measured I/O demand track each other well, confirming that simulation is a viable pre-hardware sizing tool for this workload class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8-7rlrIG28zGpLeEaCZPA.png" /></figure><h3>Method 3 — Real Workload Profiling</h3><p><strong>Simulation tells you what the workload <em>should</em> demand from storage. Real hardware profiling tells you what it <em>actually</em> demands</strong> — including PCIe contention, NVMe queue depth effects, HBM pressure from concurrent batches, and the timing jitter that no virtual clock captures. This is the ground truth method, and it is the only one that can validate the estimates from Sections 3 and 4.</p><h3>The Multi-Turn Benchmarking Problem</h3><p>The fundamental challenge with multi-turn conversation benchmarking is causal dependency. In a real deployment, turn N’s user prompt is shaped by what the model said in turn N-1. The conversation is a live, non-deterministic sequence — not a fixed script. This creates two problems:</p><ul><li><strong>Non-reproducibility.</strong> The same conversation starter produces different model responses across runs. KV cache hit patterns shift because prefix lengths change. You cannot rerun the same experiment twice and get the same I/O trace.</li><li><strong>Uncontrolled session length.</strong> You cannot know in advance how many tokens a conversation will grow to, which makes HBM pressure hard to reproduce across runs.</li></ul><p>The standard solution to both problems is <strong>trace replay</strong>: instead of running live inference, you pre-record complete conversations — both user turns and model responses — and replay them as fixed token sequences. The model still executes (KV blocks are computed and cached exactly as in production), but model outputs are discarded. Only the KV cache behavior matters. The conversation is deterministic, reproducible, and controllable.</p><h3>Limitations</h3><p><strong>Trace representativeness is still a ceiling.</strong> Even with ShareGPT or Mooncake traces, the hit rate you measure is only valid for workloads with similar statistical structure. A production workload with longer sessions or different prefix reuse patterns will produce different I/O demand.</p><p><strong>Single hardware configuration.</strong> Results from an 8x H100 node with PCIe 5.0 do not transfer directly to a different topology — different NVMe controller, different NUMA configuration, or a Blackwell B200 with its wider HBM. The analytical and simulation methods are necessary to extrapolate across hardware generations.</p><h3>ShareGPT on Qwen3–32B</h3><h3>Hardware Setup</h3><p>The benchmark ran on 2× NVIDIA H100 80GB HBM3 GPUs from an 8-GPU node, with ~69 GB allocated to the KV cache and ~74 GB to model weights. NVMe storage was provided by a Samsung PM174X (7 TB). The serving stack was vLLM v0.23.0 + LMCache v0.5.0.</p><p>The workload was 500 ShareGPT conversations replayed in true multi-turn mode — each turn waits for the server’s actual response before sending the next, making the session structure deterministic and reproducible. The HBM KV cache holds approximately 179 full conversations before NVMe spill begins. LMCache was configured without a DRAM cache layer — all HBM evictions spill directly to NVMe.</p><h3>NVMe I/O — IOPS and Bandwidth</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oot7X-wnQh6eaLn2BGQVXQ.png" /></figure><p>Writes begin immediately as new conversations fill HBM. Reads appear once the cache warms up and prior conversations are revisited. At steady state, average read bandwidth reached <strong>1,740 MB/s</strong> and write bandwidth <strong>1,359 MB/s</strong> — with peaks of 2,617 MB/s and 3,226 MB/s respectively. Read IOPS averaged 13,299 and write IOPS 10,376.</p><h3>Token Throughput</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9Z-00a1RJTvYjtjeraakQ.png" /></figure><p>Input token throughput averaged <strong>13,890 tokens/s</strong> against output throughput of <strong>3,502 tokens/s</strong> — a roughly 4:1 ratio.</p><h3>Conclusion</h3><p><strong>Sizing NVMe storage for KV cache memory extension is not a one-time calculation — it is a layered process.</strong> The roofline model gives you a worst-case ceiling from model architecture alone, requiring nothing but arithmetic. The stochastic model adds workload realism through probability distributions, capturing the burstiness and variability that steady-state analysis misses. Simulation grounds those distributions in actual trace behavior, letting you sweep eviction policies and cache sizes without touching a GPU. And real workload profiling closes the loop — validating every assumption against hardware and surfacing the PCIe contention, NVMe jitter, and queue depth effects that no model captures.</p><p>Each method has a place. Start with the roofline to bound the problem. Use stochastic modelling and simulation to explore the design space. Profile on real hardware before committing to a production configuration. The four methods are not alternatives — they are a progression, and the most robust sizing decisions use all of them.</p><h3>References</h3><ol><li><em>Mooncake Traces (FAST ‘25).</em> kvcache-ai/Mooncake. <a href="https://github.com/kvcache-ai/Mooncake/tree/main/FAST25-release/traces">https://github.com/kvcache-ai/Mooncake/tree/main/FAST25-release/traces</a></li><li><em>UniCache: Unifying Prefix Cache Eviction for Heterogeneous LLM Serving Workloads.</em> <a href="https://jxing.me/pdf/unicache-sigmetrics26.pdf">https://jxing.me/pdf/unicache-sigmetrics26.pdf</a></li><li>Chiang, W.-L., Li, Z., Lin, Z., Sheng, L., Wu, Zhanghao., Zhang, H., … &amp; Frader, J. (2023). <em>Vicuna: An open-source chatbot impressing GPT-4 with 90% ChatGPT quality.</em> LMSYS Org. <a href="https://lmsys.org/blog/2023-03-30-vicuna/">https://lmsys.org/blog/2023-03-30-vicuna/</a></li><li>Cheng et al. (2025). <em>LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference.</em> arXiv:2510.09665. <a href="https://arxiv.org/abs/2510.09665">https://arxiv.org/abs/2510.09665</a> · GitHub: <a href="https://github.com/lmcache/lmcache">github.com/lmcache/lmcache</a></li><li>Kwon et al. (2023). <em>Efficient Memory Management for Large Language Model Serving with PagedAttention.</em> arXiv:2309.06180. <a href="https://arxiv.org/abs/2309.06180">https://arxiv.org/abs/2309.06180</a> · GitHub: <a href="https://github.com/vllm-project/vllm-docs">github.com/vllm-project/vllm-docs</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c4e14d5f102" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storage for AI Inference: Matching the Right Storage to the Right Workload]]></title>
            <link>https://medium.com/@jagadish.mukku/storage-for-ai-inference-matching-the-right-storage-to-the-right-workload-37db35a4fd1c?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/37db35a4fd1c</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[llm-inference]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 16:08:28 GMT</pubDate>
            <atom:updated>2026-06-10T16:08:28.004Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction: Inference is Not One Workload</h3><p>When planning AI inference storage, the conversation often collapses into a single question: <em>which storage system should we use? </em>The better question is: <em>what does each workload actually need?</em></p><p>Inference is not one workload. Behind every model response lies a pipeline of distinct data types — each with its own I/O fingerprint, redundancy requirement, and lifecycle. Model weights are loaded once at startup and read sequentially in bulk. KV cache is written hot during prefill and read back seconds later. Conversational history accumulates turn by turn and must survive across sessions. Vector indexes are ingested in large batches and queried with random access patterns. RAG document stores are read-heavy knowledge bases that may or may not need point-in-time recovery.</p><p>These are not variations of the same problem. They are five different storage problems that happen to live inside the same inference stack.</p><p>This article walks through each one — what it is, what it demands from storage, and why those demands differ. The goal is not to tell you which storage system to buy. It is to give you the map that makes that decision clear.</p><h3>The Five Workloads at a Glance</h3><p>Before diving into each workload, it helps to see them side by side. The table below is the map this article is built around. Every workload has three dimensions that matter for storage: the I/O pattern it produces, the redundancy it requires, and how its data should be managed over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xiOexv0jkSzF39GdE72mxQ.png" /><figcaption><em>Copies/Replica counts shown reflect a baseline for fault tolerance and read load distribution — your environment, failure domain requirements, and access patterns may call for more.</em></figcaption></figure><p>The sections that follow explain the reasoning behind each row — why replica counts might differ from KV cache and conversational data and how snapshot requirements vary by workload.</p><h3>Model Weights — Read Once, Read Fast</h3><p>Model weights are the foundation of every inference deployment. Before a single token is generated, the serving engine must load the full model from storage into GPU memory. For modern large language models, that means reading anywhere from tens of gigabytes to nearly a terabyte — sequentially, in bulk, at startup.</p><p>This is a simple I/O profile: one large sequential read, done once, then the data lives in GPU memory for the duration of the serving session. There are no random reads, no small writes, no real-time updates. The storage system just needs to deliver bytes as fast as possible.</p><p><strong>Redundancy</strong> is handled differently here than in other workloads. The goal is not fault tolerance in the traditional sense — model weights are immutable artifacts that live in a model registry upstream. If a copy is lost, it can be re-fetched. The reason to keep multiple replicas is read performance: when a cluster of GPU servers all restart simultaneously and race to load the same model, a single copy becomes a bottleneck. Spreading replicas across nodes lets multiple servers load in parallel.</p><p><strong>Snapshots and backups are not needed.</strong> The model registry is the source of truth. The copy on the inference storage tier is a hot cache of something that already exists elsewhere.</p><h3>KV Cache — The Hottest Data in Inference</h3><p>The KV cache is the most latency-sensitive data in the entire inference stack. During the prefill phase, the model processes the input prompt and generates key-value tensors for every attention layer — these are stored as the KV cache. When a subsequent request shares the same context prefix, the engine can skip recomputation and read directly from the cache. That difference — recompute vs. retrieve — can be the difference between a fast response and a slow one.</p><p>The I/O pattern is asymmetric: write once during prefill, read multiple times across requests that share the same prefix. Files are large — a single cached context can range from hundreds of megabytes to several gigabytes depending on model size and context length.</p><p><strong>Transfer speed is everything here.</strong> The storage interface matters less than whether it supports GPU Direct Storage (GDS). Traditionally, data moves from storage → system memory → GPU memory — two hops. GDS eliminates the middle step, allowing storage to write directly into GPU memory. For KV cache, where every millisecond of prefill latency is visible to the end user, this direct path is the difference between a storage tier that keeps up and one that becomes the bottleneck. Maximizing the efficiency of this direct hardware path requires splitting the storage architecture into two distinct operational access patterns: immediate online loops and scheduled batch pipelines.</p><p><strong>Real-time access is highly dynamic. A</strong>ctive inference loops read and write directly to local NVMe tiers to service immediate, unpredictable user requests. Conversely, scheduled batch workflows allow for proactive, tiered storage orchestration. When the inference schedule is known ahead of time — such as pulling a patient’s historical records before a scheduled appointment — the orchestrator initiates a background I/O pipeline. This pipeline transfers massive, cold KV cache files from cost-effective object storage or remote networks down to the local NVMe tier well before execution. By separating real-time, low-latency NVMe read paths from asynchronous, background hydration paths, the system maximizes GPU utilization and completely eliminates network-induced Time-to-First-Token (TTFT) spikes during batch runs.</p><p><strong>Redundancy is set at 2 replicas</strong> — enough to protect against disk and node failures, and to absorb the prefill storm that occurs when multiple inference engines restart simultaneously and all attempt to warm their caches at the same time.</p><p><strong>Snapshots and backups are not needed.</strong> KV cache is recomputable on demand. If a cache entry is lost, the engine recomputes it from the original prompt. TTL-based expiry handles cleanup automatically — there is no value in point-in-time recovery for data that can be regenerated in seconds.</p><h3>Conversational Data — When History Matters</h3><p>Conversational data is the chat history generated between a user and a model across multiple turns. Unlike KV cache, which is ephemeral and recomputable, conversational data is irreplaceable — it represents the actual exchange between a user and the system. Losing it means losing context that cannot be reconstructed.</p><p>The I/O pattern reflects the nature of conversation: small to medium writes as each turn is appended, and full session reads when context is loaded back into the inference engine at the start of a new turn. Some applications access this data directly through a filesystem, others route it through a database layer — both are valid, and the storage system needs to support both access patterns.</p><p><strong>Redundancy is set at 3 replicas.</strong> This is primary storage — the kind where data loss has a direct user-facing consequence. Three replicas protect against disk, node, and rack failures without requiring any recomputation or recovery from an upstream source.</p><p><strong>Snapshots and backups are required.</strong> Conversational history is curated user data. Point-in-time recovery matters here — whether for disaster recovery, compliance, or the ability to roll back after a corruption event. This is the workload that behaves most like traditional enterprise storage, and it should be treated accordingly.</p><h3>Vector DB Storage — Built for Search</h3><p>Vector databases power semantic search — the ability to find documents, passages, or data points that are conceptually similar to a query, not just lexically matching. Under the hood, a vector DB stores high-dimensional embeddings alongside an index structure that makes nearest-neighbor lookups fast. The storage layer underneath that index has a distinct and often underappreciated I/O profile.</p><p>Ingestion is bulk and sequential — when embeddings are generated and indexed, large segment files are written to storage in one pass. Query time is the opposite: individual vectors and index nodes are read randomly and at low latency. This write-large, read-random pattern is similar to a search engine index and different from anything else in the inference stack.</p><p><strong>Redundancy is set at 3 replicas.</strong> Vector indexes are expensive to rebuild. Generating embeddings for a large document corpus requires significant compute time and cost. A storage failure that destroys an index without a replica means rebuilding from scratch — a process that can take hours or days depending on corpus size. Three replicas provide the protection that investment deserves.</p><p><strong>Snapshots and backups are required.</strong> Vector indexes represent a curated, computed artifact. The source documents may exist elsewhere, but the index itself — with all its tuning and structure — is worth protecting independently. Point-in-time snapshots allow recovery to a known good state if an index is corrupted during an update or compaction cycle.</p><h3>RAG Document Storage — The Knowledge Base</h3><p>Retrieval-Augmented Generation (RAG) is a pattern where the model’s response is grounded in documents retrieved at query time — rather than relying solely on what was baked into the model weights during training. The document store is the foundation of that pipeline. It holds the raw source material: PDFs, web pages, internal documents, product manuals — whatever the retrieval system is built on top of.</p><p>The I/O pattern is similar to vector DB storage in shape but different in origin. Documents are ingested in bulk — large files written sequentially during indexing pipelines. At query time, individual chunks are retrieved randomly and passed to the model as context. The store is read-heavy in production, with writes concentrated during ingestion and update cycles.</p><p><strong>Redundancy is set at 3 replicas.</strong> The document corpus is the source of truth for the retrieval pipeline. Losing it means losing the grounding that makes RAG useful. Three replicas protect against hardware failure without requiring a full re-ingestion from upstream sources.</p><p><strong>Snapshot and backup needs depend on the use case.</strong> If the document store is a cached copy of content that exists authoritatively elsewhere — a web crawl, a synced external corpus — backups add cost with limited recovery benefit. If the store contains original or curated content that does not exist elsewhere, it should be treated like primary storage and backed up accordingly.</p><h3>Choosing the Right Storage Interface</h3><p>There is no single storage interface that wins across all inference workloads. The right choice depends on what the workload expects, how latency-sensitive it is, and what infrastructure already exists in the environment.</p><p><strong>Filesystem</strong> is the most universal interface across inference workloads. Inference engines, vector databases, and application frameworks all know how to read and write files. It requires no translation layer, supports GPU Direct Storage natively, and works equally well for large sequential reads and small random writes. For most workloads in this article — model weights, KV cache, conversational data — a filesystem interface is the natural fit.</p><p><strong>S3-compatible object storage</strong> is a strong choice for workloads that are less latency-sensitive and where the ecosystem already speaks S3. RAG document pipelines, model registries, and batch ingestion workflows are natural fits. With S3 over RDMA, the throughput gap between object storage and filesystem narrows significantly — making it viable even for higher-bandwidth use cases that previously required a filesystem.</p><p><strong>Database-backed storage</strong> applies where the application layer already manages data through a database — conversational history being the clearest example. Here the storage system provides the durable, replicated backend and the database engine handles the query interface. The storage layer does not need to understand the schema — it just needs to be fast, reliable, and support the redundancy the database expects.</p><p>The pattern that emerges: use filesystem where latency and throughput are critical, S3 where ecosystem compatibility and scale matter, and database-backed storage where the application already has a query layer it depends on.</p><h3>Storage Topology: Co-located vs. External</h3><p>Where storage physically lives relative to the GPU is one of the most consequential decisions in an inference deployment — and one of the least discussed. There are two fundamental topologies: storage co-located on the same server as the GPUs, and storage as a separate external appliance connected over a network.</p><p><strong>Co-located storage</strong> places NVMe drives directly inside the GPU server. Data travels over PCIe — the shortest, fastest path possible. Latency is measured in microseconds. GPU Direct Storage works at its best here, with no network hop between the drive and the GPU memory. This topology is ideal for KV cache, where access latency directly impacts time-to-first-token. The tradeoff is capacity — the number of drives is constrained by what fits in the server chassis, and storage cannot be scaled independently of compute.</p><p><strong>External storage appliances</strong> decouple storage capacity from compute. Drives live in a separate system connected over a high-speed network — typically RDMA over InfiniBand or RoCE. This allows storage to scale independently, be shared across multiple GPU servers, and be managed as a distinct tier. The latency is higher than co-located NVMe, but with RDMA the gap narrows considerably. For workloads like model weights, RAG documents, and vector indexes — where access patterns are less latency-critical than KV cache — external appliances are a practical and cost-effective choice.</p><p><strong>In practice, most production deployments use both.</strong> KV cache lives on co-located NVMe for minimum latency. Model weights, document stores, and vector indexes live on shared external storage for capacity efficiency and manageability. The inference stack treats them as a unified namespace — the storage topology is an infrastructure concern, not an application concern.</p><h3>Closing: Start With the Workload</h3><p>Storage decisions for AI inference are easy to underestimate. The GPU cluster gets the attention, the inference stack gets the benchmarks, and storage is often treated as a solved problem — until it isn’t. The workloads that run inference are more diverse than they appear, and each one has specific demands that a one-size-fits-all approach will eventually struggle to meet.</p><p>The answer to “<em>what does each workload in our inference pipeline actually need?” </em>is<em> </em>not complicated. Model weights need bulk sequential throughput and read parallelism. KV cache needs low latency, GPU Direct Storage, and fast recovery from a prefill storm. Conversational data needs durability and point-in-time recovery. Vector indexes and RAG document stores need capacity, redundancy, and protection for data that is expensive to rebuild.</p><p>Each workload has a clear answer. The job of the storage layer is to meet each one — without compromise, and without forcing every workload through the same interface.</p><p>Start with the workload. The right storage decision follows naturally.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37db35a4fd1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Storage Drives Beat the GPU: KV Cache Reload vs Recompute in Long-Context LLM Inference]]></title>
            <link>https://medium.com/@jagadish.mukku/when-storage-drives-beat-the-gpu-kv-cache-reload-vs-recompute-in-long-context-llm-inference-2568c749819e?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2568c749819e</guid>
            <category><![CDATA[llm-inference]]></category>
            <category><![CDATA[kv-cache]]></category>
            <category><![CDATA[llmops]]></category>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Wed, 03 Jun 2026 16:27:00 GMT</pubDate>
            <atom:updated>2026-06-03T19:02:53.764Z</atom:updated>
            <content:encoded><![CDATA[<p>A modern GPU like the NVIDIA B200 can execute 9,000 trillion operations per second. An NVMe drive reads sequential data at a few GB/s. By every hardware spec on paper, it’s not a competition.</p><p>Yet for one of the most common operations in LLM serving, an NVMe drive wins — by 20x.</p><p>This reminds me of the quote by Andrew S. Tanenbaum.</p><p><a href="https://en.wikiquote.org/wiki/Andrew_S._Tanenbaum"><strong><em>Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway.</em></strong></a></p><h3>What is a Transformer and Why Does It Create a KV Cache?</h3><p><strong>Already familiar with KV cache internals?</strong> Feel free to skip ahead to the next section. For a deeper dive refer to [4]</p><p>A Large Language Model processes text as a sequence of <strong>tokens</strong> . The core computation happens in a <strong>Transformer</strong>, which consists of:</p><ul><li><em>nlayers</em>​ identical processing stages stacked on top of each other</li><li>Each layer contains an <strong>Attention mechanism</strong> and a <strong>Feed-Forward Network (FFN)</strong></li></ul><p>The Attention mechanism works by computing three vectors for every token:</p><ul><li><strong>Query (Q)</strong></li><li><strong>Key (K)</strong></li><li><strong>Value (V)</strong></li></ul><p>When generating token number <em>t</em>, the model needs to compare the current token’s Query against the Keys of <strong>all previous tokens</strong> to decide what to pay attention to. This means the K and V vectors of all previous tokens must be available.</p><p><strong>The KV Cache</strong> is simply the stored collection of all K and V vectors for all previous tokens across all layers. Instead of recomputing them every time, you store them once and reuse them.</p><h3><strong>Why a Busy GPU Is Rarer Than You Think</strong></h3><p>A GPU has two speeds: how fast it <strong>computes</strong> and how fast it <strong>reads from memory</strong>. During token generation, the GPU must read the entire model — hundreds of gigabytes of weights — just to produce one token. At a single request, the GPU spends almost all its time waiting for memory and barely any time actually computing. This is called being <strong>memory-bound</strong>.</p><p><strong>Batch size</strong> is simply how many user requests the GPU processes simultaneously. Here’s why it matters: the model weights are read once per generation step regardless of how many requests are being served. So if you process 100 requests at the same time instead of 1, you do 100x more computation from the same memory read. The GPU goes from nearly idle to genuinely busy.</p><p>This ratio — computation done per byte read from memory — is called <strong>arithmetic intensity</strong>. A single request barely moves the needle. But stack enough requests together and the GPU crosses a threshold where compute, not memory, becomes the bottleneck. That crossover is where you’re finally getting full value from the hardware.</p><p>The GPU’s compute capacity and memory bandwidth are fixed hardware properties — they don’t change based on what model you run. What changes is how much work your specific model does per byte it reads. A large model reads hundreds of gigabytes of weights every generation step, making it heavily memory-bound at low batch sizes. A model with a larger KV cache per token adds even more memory pressure per request. So while the hardware sets the target — the threshold where compute finally becomes the bottleneck — the model determines how much batching you need to reach it. A small 7B model might saturate GPU compute at batch size 10. A 671B MoE model like DeepSeek-V3 needs 177 concurrent requests to get there. Same GPU, very different answer — because the model shapes the workload, and the workload determines where you land on the roofline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9LAkYKakhZrfkP_KQmM2w.png" /><figcaption><strong>Arithmetic intensity rises with batch size until it hits the compute-saturation band — how quickly depends on the model, how high the band sits depends on MFU, the GPU’s real-world efficiency.</strong></figcaption></figure><h3>How much KV Cache can be stored in GPU memory ?</h3><p><strong>What lives in GPU Memory?</strong></p><ul><li><strong>Model weights</strong> — the brain of the model, loaded once and never moved</li><li><strong>Activations</strong> — intermediate results during computation, temporary and freed immediately after each forward pass</li><li><strong>Framework overhead</strong> — ~10% reserved for CUDA and communication buffers</li></ul><p>Model weights and KV cache are the two biggest consumers of GPU memory.</p><p><strong>Context Length and GPU Memory</strong></p><p>Every piece of text the model processes — your question, the conversation history, the document you uploaded — gets broken into <strong>tokens</strong>. A token is roughly three-quarters of a word: “unbelievable” is one token, “I am happy” is three. A 10,000-token context is approximately a 7,500-word essay — about 30 pages of text. This matters because every token in the context has a KV cache entry that lives in GPU HBM for the duration of the request. The memory grows linearly: double the context length, double the HBM consumed. For Gemma 4 31B Dense at BF16 precision, each token costs 480 KB — meaning a single 128K-token request consumes nearly 63 GB of GPU memory, leaving very little headroom on an H100. Switching to FP8 halves that to 31.5 GB — the single biggest lever for reducing memory pressure without changing hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEjIEWCDKEDORsheeyE6Nw.png" /><figcaption><strong>KV cache memory grows linearly with context length</strong></figcaption></figure><p>As we saw earlier, saturating GPU compute requires serving many requests simultaneously — 177 concurrent requests on a B200 just to stop being memory-bound. But every active request holds its entire conversation history as a KV cache in HBM. At 480 KB per token, 177 sessions each with a 32K-token context alone consumes over 2.7 TB — far beyond what any GPU cluster holds. In practice, HBM fills up fast. As new requests arrive, older KV caches get evicted to make room. When those sessions return for their next conversation turn, their cache has to be loaded back or recomputed from scratch.</p><h3>Two Strategies, One Question</h3><p>When a KV cache gets evicted, the system faces a choice on the next request from that session.</p><p><strong>Option A — Recompute:</strong> Run the entire conversation history through the GPU again from scratch. No storage needed, but the GPU has to redo all that work.</p><p><strong>Option B — Retrieve:</strong> Save the evicted KV cache to an NVMe drive and reload it when the session returns. Storage is needed, but the GPU skips the recomputation entirely.</p><p>Both options have a cost. The question is simply: <strong>which one is faster?</strong></p><h3>The Recompute Cost</h3><p>Processing a prompt is measured in <strong>FLOPs</strong> — floating point operations, the basic unit of work a GPU performs. For DeepSeek-V3, a 10,000-token conversation requires roughly <strong>1.4 quadrillion FLOPs</strong> and takes <strong>85ms</strong> on an 8× B200 cluster.</p><p><strong>For Full Attention</strong>, what makes this painful at long contexts is that the cost doesn’t grow evenly. At 10K tokens, attention computation accounts for just 13% of total FLOPs. At 128K tokens it becomes 65% — because every token must look at every other token. Double the context length and you nearly quadruple the compute. That’s not a linear cost. It’s a trap.</p><p>Here are the few variables to calculate the cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aug58PpCopa9GJsid4Dt8Q.png" /></figure><p>For full attention, here is the cost to recompute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-ldu01nIvoMnnXAKNIjEA.png" /><figcaption>Full Attention FLOPS</figcaption></figure><p><strong>Sliding window attention (Gemma-4) and sparse attention</strong> <strong>(Deepsek-V3.2)</strong> represent a major shift in how latest models handle long context. By restricting a token focus to an immediate neighbor tokens or by strategically sampling the most critical neighbor tokens, they reduce the compute cost. The “Attention score FLOPS” term change as below for the sliding window “<strong>W</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTRPMtRfhWHSf28lbEZwIw.png" /></figure><h3>The Retrieval Cost</h3><p>A <strong>PCIe Gen5 NVMe drive</strong> reads sequential data at roughly 12 GB/s per drive. An 8-drive server delivers ~96 GB/s aggregate. DeepSeek-V3 uses a compressed KV format called MLA that stores just <strong>35 KB per token</strong> —<strong> far smaller than most models</strong>. Loading a 10,000-token cache takes just <strong>4ms</strong>. At 128K tokens, still only <strong>47ms</strong>.</p><p><em>Note: these retrieval times are dominated by transfer time. NVMe reads also carry a small overhead in order of micro seconds to milliseconds — but at large transfer sizes this is negligible and doesn’t change the conclusion.</em></p><p>Retrieval cost grows simply: more tokens means more bytes. Linear, predictable, no quadratic surprises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L50rzLYFv1sJgaAe8LHGKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jZSBdzTAFChMnpB_pM5-g.png" /></figure><h3>The Decision Ratio</h3><p>One number makes the call</p><p>R = T_recompute / T_retrieve</p><p>R &gt; 1 → Retrieve from an NVMe (drive wins)</p><p>R &lt; 1 → Recompute on GPU</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*EM1z1KH0IbUW9ckLBHAHSw.png" /></figure><p>At 128K tokens: T_recompute ≈ 2,700ms, T_retrieve ≈ 47ms → R = 57. Drive wins by 57x.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*NP8-AHw_qMakfCZLD2h3Yw.png" /></figure><h3>Not All KV Caches Are Equal</h3><p>The decision ratio <strong>R</strong> has two levers: how expensive recompute is, and how expensive retrieval is. So far we’ve used DeepSeek-V3 as the example — a model that makes retrieval look like an obvious winner. But the numbers change significantly depending on which model you’re running.</p><p>The reason comes down to one number: <strong>how many bytes the model stores per token in the KV cache</strong>.</p><p>This isn’t a tuning parameter — it’s baked into the model’s architecture. And it varies enormously.</p><h4>GQA vs MLA — Two very different memory footprints</h4><p>Most modern models use <strong>Grouped Query Attention (GQA)</strong> — a standard attention mechanism where each token’s KV cache grows with the number of layers, heads, and hidden dimensions. Llama-3 70B at FP8 stores <strong>163 KB per token</strong>. A single 32K-token session consumes over 5 GB of KV cache alone.</p><p>DeepSeek-V3 takes a different approach called <strong>Multi-head Latent Attention (MLA)</strong>. Instead of storing full Key and Value vectors, it compresses them into a compact latent representation. The result: just <strong>35 KB per token</strong> — nearly 5x smaller than Llama-3 70B.</p><h4>Why this directly shifts the decision</h4><p>A smaller KV cache means less data to transfer from an NVMe — which directly cuts <strong>T_retr</strong>. Recompute cost stays the same regardless of KV format. So a model with a compact KV cache gets a higher R — retrieval becomes even more attractive.</p><p>For Llama-3 70B at 10K tokens, a 1.6 GB KV transfer at 96 GB/s takes ~17ms. For DeepSeek-V3, the same context is just 351 MB — taking 4ms. Same GPU, same NVMe, same context length. The architecture alone shifts retrieval time by 4x.</p><h4>Quantization is a second lever</h4><p>Beyond architecture, <strong>KV cache quantization</strong> directly compresses the bytes per token. FP8 halves the size compared to BF16 — and more aggressive methods like INT4 can compress further. This matters not just for HBM pressure but for retrieval speed: a quantized cache transfers faster, pushing <strong>R</strong> higher and making retrieval more attractive even at shorter contexts.</p><h3>Conclusion</h3><p>The gap between hardware specs and real-world performance is where most infrastructure decisions go wrong. A B200 GPU that can execute 9,000 trillion operations per second sounds like it should win every race — until you understand that token generation at low batch sizes uses less than 1% of that capacity, and that processing a long conversation grows quadratically while loading it from drive grows linearly. The math doesn’t care about the spec sheet. At 128K tokens, an NVMe drive beats a state-of-the-art GPU cluster by 57x — not because the GPU is slow, but because it’s being asked to do the wrong kind of work.</p><p>The decision ratio <strong>R</strong> is a simple formula, but what it represents is a shift in how to think about LLM infrastructure. Storage is not just a fallback for when memory runs out. At long contexts, it is the faster path. Understanding where that crossover happens — for your model, your hardware, your traffic — is the difference between an architecture that scales and one that recomputes its way into a bottleneck.</p><p>For a deeper dive of the model and the details of the math, review the documentation at Github.</p><p><a href="https://github.com/JagadishMukku/kvcache/blob/main/kvcache_model.md">https://github.com/JagadishMukku/kvcache/blob/main/kvcache_model.md</a></p><h3>References</h3><p><a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need</a> — Vaswani, A., et al. (2017)</p><p><a href="https://arxiv.org/abs/2412.19437">DeepSeek-V3 Technical Report</a> — DeepSeek-AI (2024)</p><p><a href="https://arxiv.org/abs/2309.06180">Efficient Memory Management for Large Language Model Serving with PagedAttention</a> — Kwon, W., et al. (2023)</p><p><a href="https://magazine.sebastianraschka.com/p/coding-the-kv-cache-in-llms">Coding the KV Cache in LLMs</a> — Raschka, S. (2024)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2568c749819e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Bursting Kubernetes Stateful Applications]]></title>
            <link>https://medium.com/@jagadish.mukku/cloud-bursting-kubernetes-stateful-applications-6921c2725edd?source=rss-ed3249d233dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6921c2725edd</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[stateful-applications]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jagadish Mukku]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 22:51:57 GMT</pubDate>
            <atom:updated>2019-08-12T22:51:57.350Z</atom:updated>
            <content:encoded><![CDATA[<h3>Bursting Kubernetes Stateful Apps To Cloud</h3><h3>Infrastructure Planning With Cloud Strategy</h3><p>On-premise data centers are planned for running numerous applications with room for expansion. With more and more applications hosted in the data centers to deliver business value, the infrastructure needs to adopt to the ever-increasing needs. There is also a case that the business has peak demand in only a short period in the year that needs to be met.</p><p>The infrastructure would otherwise be un-used for the rest of the year if it planned for the peak usage. With the advent of cloud, it is possible to run the on-premise applications on cloud and reduce the usage at the on-premise.</p><p>Many businesses have a combination of on-premise and a cloud strategy to better meet their needs. With the emergence of multiple cloud providers and the matured technology, now is the time to use the public cloud for the infrastructure needs. With this strategy there is no need to accurately predict the peak usage, no more spending on the extra capacity.</p><h3>Hybrid cloud strategy</h3><p>There are many ways to look at hybrid cloud strategy. An application running on the on-premise can be burst to cloud for additional capacity. This would mean that the application is spanning the on-premise and the cloud. There are many challenges to this architecture. This kind of architecture involves maintaining a minimum latency between the on-premise datacenter and the cloud, managing the configuration between them since they are different. An application would have to be re-written to understand the topology to be more efficient. For example, a read to a database that has the storage on-premise has different latency than the read to the storage from on-premise to cloud.</p><p>A better solution would be to run the business-critical application in the on-premise data center and move the non-business-critical applications to cloud based on the demands. This strategy is less complex to implement since it involves moving the entire application.</p><h3>Kubernetes: The inflection point for cloud bursting</h3><p>Kubernetes is fueling the container-based applications that can run on on-premise, on cloud, span both. Many cloud vendors offer Kubernetes based platforms. The very fact that there are many kubernetes based platforms ie Google GKE, Amazon EKS, Redhat Openshift proves that the technology has reached an inflection point. Kubernetes provides the base platform to enable the cloud bursting and does provide most of the pieces for stateless apps.</p><p>Let’s look into the details of moving the entire application to the cloud. There are stateless apps and stateful apps. Moving stateless apps is simple since they can be moved anywhere without any state. On the other hand, moving stateful apps to cloud poses multiple challenges.</p><p>A stateful app has various state components.</p><p>· <strong><em>Application config</em></strong>. This is the topology of the application, any passwords, environment variables.</p><p><strong><em>· Application data. </em></strong>This is the actual data of the application. It may be a database on disk, a filesystem on disk etc.</p><p>The kubernetes application has the combination of the following components as depicted in Figure 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*ieXyoNOKX38bCnomZPxBwA.png" /><figcaption>Figure 1 Stateful application composition</figcaption></figure><p>A true app mobility to cloud would mean taking both the config and data together and bringing the app in the cloud without tweaking. It should be very seamless like cut-copy-paste operation.</p><h3>Hallmarks of a seamless app mobility</h3><p>Moving an app to cloud has to be operationally simple, efficient in the usage of the resources like network and storage. The whole process should be as simple as copying a file as we know from one folder to another. The stateful application brings in new challenges to tackle especially when it has large amounts of data. A stateful application like a database needs to move its database disk data to the cloud. The solution that takes into consideration all the components of the app can deliver a great experience to the user.</p><h3>Data mobility</h3><p>A stateful application has data disks that can have large amount of data. The movement of data should be minimized to be nimble in moving the apps to/from cloud. Let’s look at the complete roundtrip of the stateful app between on-premise and cloud.</p><p>An application is running on-premise with data. At this point there is no presence of this app in the cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*aTcJPaFchZjm3ZGYvkcSkw.png" /><figcaption>Figure 2 On-premise app</figcaption></figure><p>To run an app on the cloud, all the components of the app are transferred to the cloud. This can take many hours to days depending on the size of the app. There are many data movement optimizations that can be done to reduce the transfer cycle. One of them is to send the data periodically and incrementally to the cloud storage like an object store that is not expensive. It is efficient to fetch the data from the object store since it incurs low latency from the cloud. Without the data movement optimizations, it would slow down the operational time to move the app to the cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*oDGlHkeaRJQRd_UwqUFWpw.png" /><figcaption>Figure 3 On-premise app transferred to Cloud</figcaption></figure><p>The app is now running in the cloud and hence there can be changes to its configuration and data. The on-premise app is now inactive which means the compute and memory resources can be freed. The storage resources can also be freed, but it would require more time to bring it back from cloud which we see later. If the app needs to be moved back to on-premise any point in the future, all the changes to it need to be tracked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*H4ewRU_I15oOpv97-uUuOw.png" /><figcaption>Figure 4 App active in cloud. Changes are made to app</figcaption></figure><p>Once the on-premise infrastructure has the capacity to hold this app, it can be brought back to the on-premise. This is where the tracking changes to the app makes the movement efficient. It will be very fast if and only the changed config and data are transferred back to on-premise as seen from Figure 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*xRT061ZYwqcNedE6AOUB7A.png" /><figcaption>Figure 5 App moving to on-premise data centre</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*voeQvEJuG1WPWFw2mcys-A.png" /><figcaption>Figure 6 App is now active at on-premise data centre with latest data</figcaption></figure><p>The on-premise app now has all the latest data and the config. It can now be active, and the app roundtrip is complete.</p><p><strong>Credits</strong></p><p>Much of the above article is learning from my work at Robin.io. Checkout <a href="https://robin.io/product/robin-storage-action/">https://robin.io/product/robin-storage-action/</a> and click Migrate App + Data tab.</p><p>ROBIN brings advanced storage and data management that extends the agility, efficiency and portability of Kubernetes to all stateful applications, even complex Big Data, Databases, AI/ML and Custom Apps, on any infrastructure, On-Premise, Hybrid Cloud or Multi-Cloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6921c2725edd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>