-
Notifications
You must be signed in to change notification settings - Fork 994
feat: FlexKV integration in Dynamo #5858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alec-flowers
merged 8 commits into
ai-dynamo:main
from
YconquestY:feature/support_flexkv
Mar 3, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
52e3f1b
Add README and use cases for FlexKV
YconquestY e0ae7a8
add more docs and fix typos
zhuofan1123 c2635d1
add flexKV connector
zhuofan1123 454d6dd
update usage of flexkv
zhuofan1123 efbc762
update doc
zhuofan1123 87e2c8b
update flexkvconnector
zhuofan1123 a91e12b
use new kvcache connector syntax
zhuofan1123 72a025c
chore: add DCO signoff
zhuofan1123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # FlexKV Integration in Dynamo | ||
|
|
||
| ## Introduction | ||
|
|
||
| [FlexKV](https://github.com/taco-project/FlexKV) is a scalable, distributed runtime for KV cache offloading. It acts as a unified KV caching layer for inference engines like vLLM, TensorRT-LLM and SGLang. | ||
|
|
||
| ## Usage | ||
|
|
||
| Enable FlexKV by setting the `DYNAMO_USE_FLEXKV` environment variable: | ||
|
|
||
| ```bash | ||
| export DYNAMO_USE_FLEXKV=1 | ||
| ``` | ||
|
|
||
| ### Aggregated Serving | ||
|
|
||
| Use FlexKV with the `--kv-transfer-config '{"kv_connector":"FlexKVConnectorV1","kv_role":"kv_both"}'` flag: | ||
|
|
||
| ```bash | ||
| python -m dynamo.vllm --model $YOUR_MODEL --kv-transfer-config '{"kv_connector":"FlexKVConnectorV1","kv_role":"kv_both"}' | ||
| ``` | ||
|
|
||
| Refer to [`agg_flexkv.sh`](../../../examples/backends/vllm/launch/agg_flexkv.sh) for quick setup. | ||
|
|
||
| ### Aggregated Serving with Peer Node KV Cache Reuse | ||
|
|
||
| Refer to our project [README](https://github.com/taco-project/FlexKV/blob/main/docs/dist_reuse/README_en.md) for instructions on setting up peer KV cache reuse. | ||
|
|
||
| ### Disaggregated Serving | ||
|
|
||
| Refer to [`disagg_flexkv.sh`](../../../examples/backends/vllm/launch/disagg_flexkv.sh) for quick setup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| set -e | ||
| trap 'echo Cleaning up...; kill 0' EXIT | ||
|
|
||
| # Run frontend | ||
| python -m dynamo.frontend & | ||
|
|
||
| # Run worker with FlexKV | ||
| DYNAMO_USE_FLEXKV=1 \ | ||
| FLEXKV_CPU_CACHE_GB=32 \ | ||
| python -m dynamo.vllm --model Qwen/Qwen3-0.6B --kv-transfer-config '{"kv_connector":"FlexKVConnectorV1","kv_role":"kv_both"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| set -e | ||
| trap 'echo Cleaning up...; kill 0' EXIT | ||
|
|
||
| MODEL="Qwen/Qwen3-0.6B" | ||
|
|
||
| # Run frontend and KV router | ||
| python -m dynamo.frontend \ | ||
| --router-mode kv \ | ||
| --router-reset-states & | ||
|
|
||
| # Run worker with FlexKV | ||
| DYNAMO_USE_FLEXKV=1 \ | ||
| FLEXKV_CPU_CACHE_GB=32 \ | ||
| FLEXKV_SERVER_RECV_PORT="ipc:///tmp/flexkv_server_0" \ | ||
| CUDA_VISIBLE_DEVICES=0 \ | ||
| python -m dynamo.vllm \ | ||
| --model $MODEL \ | ||
| --kv-transfer-config '{"kv_connector":"FlexKVConnectorV1","kv_role":"kv_both"}' \ | ||
| --gpu-memory-utilization 0.2 \ | ||
| --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:20080","enable_kv_cache_events":true}' & | ||
|
|
||
| DYNAMO_USE_FLEXKV=1 \ | ||
| FLEXKV_CPU_CACHE_GB=32 \ | ||
| FLEXKV_SERVER_RECV_PORT="ipc:///tmp/flexkv_server_1" \ | ||
| CUDA_VISIBLE_DEVICES=1 \ | ||
| python -m dynamo.vllm \ | ||
| --model $MODEL \ | ||
| --kv-transfer-config '{"kv_connector":"FlexKVConnectorV1","kv_role":"kv_both"}' \ | ||
| --gpu-memory-utilization 0.2 \ | ||
| --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:20081","enable_kv_cache_events":true}' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.