1. Why Deploy LLM Applications with PD Disaggregation
In the process of LLM inference, there are two serial stages:
- Process the entire input context and generate the KV Cache (Prefill stage)
- Incrementally generate new tokens (Decode stage)
These two stages have different resource requirements. The Prefill stage has to compute a large amount of KV Cache, while the Decode stage has to read and store a large amount of KV Cache.
If the Prefill and Decode stages run simultaneously on one device, that device needs strong enough compute and large enough VRAM, and its price is correspondingly higher.
From a chip design perspective, the more compute cores there are, the larger the silicon area they occupy, the smaller the area left for memory interfaces, and the smaller the maximum memory capacity that can be supported.
Chip manufacturers, constrained by cost, yield, process, power consumption, and the international situation, have limited the area of a single chip, so the requirements that Prefill and Decode place on the chip are contradictory.
Since this contradiction cannot be resolved in the short term, the only option is to deploy the Prefill and Decode processes on different devices. Choose a chip with strong compute for Prefill, and a chip with large memory capacity for Decode.
Of course, if the model is small and the text is short, a single device may be able to provide enough compute and memory, and PD disaggregated deployment is unnecessary.
2. Request Traffic Analysis for a PD-Disaggregated Application

A PD-disaggregated application needs three services:
- API Proxy service, which receives user requests and forwards them to the P node and D node
- P node, responsible for the Prefill stage, generating the KV Cache
- D node, responsible for the Decode stage, reading and storing the KV Cache
During deployment, the P node and D node can have identical configurations, differing only in the compute device used. For example, the P node uses H200 and the D node uses H20. The API Proxy service uses only CPU, and only needs low-latency networking to the P node and D node.
The API Proxy service is the entry and exit point for traffic. A PD-disaggregated application processes as follows:
- The API Proxy sets
max_tokens=1and forwards the user request to the P node - The P node processes the request, generates the KV Cache, and returns the first token to the API Proxy
- The API Proxy discards the P node’s response
- The API Proxy forwards the user request to the D node
- The D node processes the request, reads the KV Cache, and continues generating tokens
- The D node returns the generated tokens to the API Proxy
There are some interesting considerations here:
- Must P always come before D? Can we go straight to D, in case it hits the Cache? This leads to NVIDIA’s open-source dynamo project
- What are the ways for P and D to share the KV Cache? This leads to the different Connectors, which use remote storage, NIXL, and NCCL for high-speed transfer
- How do multiple P nodes and D nodes work together? This leads to the design of the Proxy service and how to improve the cache hit rate
- Tiering around the cache. On both P and D nodes, multi-level caches for VRAM, memory, local, and remote can be configured — how do we coordinate them
- Ultra-large-capacity storage pools. https://lmcache.ai/kv_cache_calculator.html can calculate that a long-text Cache block for an LLM is over 200 MB. How do we build a cache pool with ultra-large capacity
- KV Cache expiration and cleanup policies
- Load balancing and fault tolerance. How do multiple P and D nodes do load balancing, and how are node failures handled
In real production, all of these questions may need to be considered. This also brings new challenges and opportunities to AI Infra deployment components. Let’s first deploy a simple application to get a feel for PD disaggregation and relax a bit.
3. Deploying a PD-Disaggregated Application with vLLM
3.1 Connectors Supported by vLLM
A connector is the way P and D nodes share the KV Cache. vLLM currently supports 5 types of connectors:
- SharedStorageConnector, shares KV Cache via a shared storage path
- LMCacheConnectorV1, combines LMCache caching with NIXL to transfer KV Cache
- NixlConnector, transfers KV Cache based on NIXL
- P2pNcclConnector, uses NVIDIA NCCL to transfer KV Cache
- MultiConnector, a combination of multiple connectors
Reference https://docs.vllm.ai/en/latest/features/disagg_prefill.html?h=prefill#why-disaggregated-prefilling
Here we use SharedStorageConnector for the demonstration.
3.2 Starting the vLLM Container Environment
| |
The remaining commands are all executed inside the container.
3.3 Deploying the P Node
| |
Here kv_role is set to kv_producer, indicating that the P node is the producer of the KV Cache. shared_storage_path specifies the path of the shared storage; the P node stores the KV Cache it generates under this path.
- Deploy the D node
| |
You can also set the role of both nodes to kv_both, acting as both producer and consumer of the KV Cache.
3.4 Starting the AI Proxy Service
- Download the Proxy service code
| |
- Install dependencies
| |
- Start the Proxy service
| |
- Send a request
| |
| |
- Check the D node logs
| |
- Check the shared storage path
| |
4. Summary
This article covers the following:
- For LLM inference with large models and long text, the Prefill and Decode stages have contradictory requirements for compute and memory, which can be resolved by PD-disaggregated deployment
- From the request traffic analysis of a PD-disaggregated application, the P node generates the KV Cache with
max_tokens=1set and does not directly respond to the request - Using vLLM to deploy a PD-disaggregated application and experience the P node, D node, and Proxy service working together
