Disaggregated PD
Background
Section titled “Background”LLM online inference services typically need to meet two performance metrics: TTFT and TPOT. Traditional Contiguous Batching scheduling strategies mix Prefill and Decode requests during scheduling, causing Prefill and Decode phases to compete for computational resources. This prevents maximized utilization of computing resources and impacts performance metrics. To resolve this conflict, the Prefill and Decode phases are split to run on independent computational resources, enabling parallel execution. This simultaneously reduces TTFT and TPOT while improving throughput.
Introduction
Section titled “Introduction”The xLLM PD Separation feature is primarily implemented through the following three modules:
- etcd: Stores metadata such as instance information.
- xLLM Service: Schedules requests and manages all computing instances.
- xLLM: Handles request computation instances.
The overall architecture is shown below:

Deploy Qwen3.8-27B on eight Ascend 910B devices
Section titled “Deploy Qwen3.8-27B on eight Ascend 910B devices”This single-host example uses four devices for Prefill and four for Decode (TP4 per instance). Both use the Qwen3.8-27B weights, the Python model implementation, eager execution and PUSH KV transfer. The example selects the VLM backend to accept an image and text in the same request.
Start etcd and the gateway
Section titled “Start etcd and the gateway”Build the Ascend engine using Quick start. Make the host’s /etc/hccn.conf available inside the engine container for device networking. Follow Build and run to build the gateway, start etcd, then start the gateway with the Qwen3.8-27B model directory as its tokenizer path. Keep those processes running.
The example uses etcd at 127.0.0.1:2379, namespace demo, and gateway HTTP/RPC ports 8888 and 8889. All processes share one host network. For separate hosts, use mutually reachable addresses. The gateway advertises the non-loopback IPv4 address resolved from its hostname and its RPC port. Decode must be able to reach that address.
Launch Prefill and Decode
Section titled “Launch Prefill and Decode”Run the following in Bash from the xLLM repository root, in the prepared Ascend runtime. Set MODEL_PATH to the same weights directory used by the gateway. Each group starts ranks 0–3 with the same visible devices and master address. The per-rank API, transfer and P/D RPC ports and the two groups’ HCCL port ranges are distinct.
export XLLM_ROOT="$PWD"export MODEL_PATH=/path/to/Qwen3.8-27Bexport PYTHONPATH="$XLLM_ROOT/xllm-kernel/python:$XLLM_ROOT${PYTHONPATH:+:$PYTHONPATH}"XLLM_BIN="$XLLM_ROOT/build/xllm/core/server/xllm"LOG_DIR=$(mktemp -d)common=( "--model=$MODEL_PATH" --model_id=Qwen3.8-27B --backend=vlm --model_impl=python "--python_model_path=$XLLM_ROOT" --python_graph_backend=off --enable_graph=false --num_speculative_tokens=0 --nnodes=4 --dp_size=1 --ep_size=1 --communication_backend=hccl --enable_service_routing=true --enable_disagg_pd=true --xservice_rpc_protocol=baidu_std --kv_cache_transfer_mode=PUSH --etcd_addr=127.0.0.1:2379 --etcd_namespace=demo --reasoning_parser=qwen35 --enable_prefix_cache=true --enable_chunked_prefill=true --enable_schedule_overlap=false --enable_shm=true --block_size=128 --max_memory_utilization=0.8 --max_tokens_per_batch=4096 --max_tokens_per_chunk_for_prefill=1536 --max_seqs_per_batch=256 --max_linear_state_cache_slots=4 --host_blocks_factor=0 --enable_fia_decode=true)
pids=()for role in PREFILL DECODE; do if [[ $role == PREFILL ]]; then devices=0,1,2,3; group=0 else devices=4,5,6,7; group=1 fi for rank in 0 1 2 3; do slot=$((4 * group + rank)) ASCEND_RT_VISIBLE_DEVICES="$devices" HCCL_IF_BASE_PORT=$((40000 + 128 * group)) \ "$XLLM_BIN" "${common[@]}" "--instance_role=$role" "--node_rank=$rank" \ "--master_node_addr=127.0.0.1:$((19000 + 64 * group))" \ "--port=$((18000 + slot))" "--transfer_listen_port=$((26000 + slot))" \ "--disagg_pd_port=$((27000 + slot))" >"$LOG_DIR/$role-$rank.log" 2>&1 & pids+=("$!") donedoneOnce both groups have registered, curl -fsS http://127.0.0.1:8888/v1/models should list Qwen3.8-27B. Rank logs are in $LOG_DIR. To stop the eight ranks started by this example, run kill "${pids[@]}" in the same shell.
Send an image and text through the gateway
Section titled “Send an image and text through the gateway”Run this example with Python, Pillow and Requests. It creates a red PNG in memory, sends it with a question, and prints the model’s answer. Prefill preprocesses the image and sends the first token and position information to Decode. The gateway returns the completed response.
import base64import io
import requestsfrom PIL import Image
png = io.BytesIO()Image.new("RGB", (224, 224), "red").save(png, format="PNG")url = "data:image/png;base64," + base64.b64encode(png.getvalue()).decode("ascii")response = requests.post( "http://127.0.0.1:8888/v1/chat/completions", json={ "model": "Qwen3.8-27B", "messages": [{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": url}}, {"type": "text", "text": "What color is the image? Answer with one word."}, ]}], "temperature": 0, "max_tokens": 32, "stream": False, "chat_template_kwargs": {"enable_thinking": False}, }, timeout=120,)response.raise_for_status()print(response.json()["choices"][0]["message"]["content"])The answer should identify the color as red. For streamed output, set stream to true in the HTTP request and consume the SSE events until [DONE]. See OpenAI-compatible API for a streaming client and reasoning options.
When chunked prefill and prefix caching are enabled, Prefill matches existing prefix-cache blocks before calculating the chunk budget.