-
Notifications
You must be signed in to change notification settings - Fork 420
[Doc] Add document for integrating Mooncake Store to LMCache V1 #385
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # Mooncake Store x LMCache for vLLM V1 | ||
|
|
||
| The vLLM v1 version has been released with support for PD separation. The detailed design document can be found here: https://docs.google.com/document/d/1uPGdbEXksKXeN4Q9nUm9hzotqEjQhYmnpAhidLuAsjk. LMCache immediately implemented the corresponding connector to support storage, transmission, and loading of KVCache, enabling collaborative operation with PD nodes. Mooncake, as LMCache's backend storage engine, has undergone extensive optimizations in usability, performance, and stability. This document explains how to deploy a complete vLLM V1 PD separation instance using LMCache + Mooncake. | ||
|
|
||
| ## Deployment | ||
|
|
||
| 1. First, you need to prepare two GPU-equipped machines, which we will refer to as Machine A and Machine B. Install vLLM, LMCache, and Mooncake on both Machine A and Machine B. For specific installation instructions, please refer to the official documentation of each repository. | ||
|
|
||
| 2. Start the Mooncake Master node on Machine A using the following command: | ||
| `cd Mooncake/build && ./mooncake-store/src/mooncake_master -v=1 -port=50052 -max_threads 64 -metrics_port 9004` | ||
|
|
||
| 3. Start etcd on Machine A with the command: | ||
| `etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://localhost:2379` | ||
|
|
||
| 4. Launch D endpoint on machine A | ||
| - Modify the vllm/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh file. | ||
| ```diff | ||
| diff --git a/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh b/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| index 831ef0bb5..a2ff0744c 100644 | ||
| --- a/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| +++ b/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| @@ -24,6 +24,8 @@ if [[ $1 == "prefiller" ]]; then | ||
| LMCACHE_CONFIG_FILE=$prefill_config_file \ | ||
| LMCACHE_USE_EXPERIMENTAL=True \ | ||
| VLLM_ENABLE_V1_MULTIPROCESSING=1 \ | ||
| + VLLM_USE_MODELSCOPE=True \ | ||
| + MOONCAKE_CONFIG_PATH=./mooncake.json \ | ||
| VLLM_WORKER_MULTIPROC_METHOD=spawn \ | ||
| CUDA_VISIBLE_DEVICES=0 \ | ||
| vllm serve $MODEL \ | ||
| @@ -36,11 +38,13 @@ if [[ $1 == "prefiller" ]]; then | ||
|
|
||
| elif [[ $1 == "decoder" ]]; then | ||
| # Decoder listens on port 8200 | ||
| - decode_config_file=$SCRIPT_DIR/configs/lmcache-decoder-config.yaml | ||
| + decode_config_file=$SCRIPT_DIR/decode.yaml | ||
|
|
||
| UCX_TLS=cuda_ipc,cuda_copy,tcp \ | ||
| LMCACHE_CONFIG_FILE=$decode_config_file \ | ||
| LMCACHE_USE_EXPERIMENTAL=True \ | ||
| + VLLM_USE_MODELSCOPE=True \ | ||
| + MOONCAKE_CONFIG_PATH=./mooncake.json \ | ||
| VLLM_ENABLE_V1_MULTIPROCESSING=1 \ | ||
| VLLM_WORKER_MULTIPROC_METHOD=spawn \ | ||
| CUDA_VISIBLE_DEVICES=1 \ | ||
| ``` | ||
| - Add `decode.yaml` and 'mooncake.json' file | ||
| ```yaml | ||
| chunk_size: 256 | ||
| local_device: "cpu" | ||
| remote_url: "mooncakestore://{IP of Machine A}:50052/" | ||
| remote_serde: "naive" | ||
| pipelined_backend: False | ||
| local_cpu: False | ||
| max_local_cpu_size: 100 | ||
| ``` | ||
| ```json | ||
| { | ||
| "local_hostname": "{IP of Machine A}", | ||
| "metadata_server": "etcd://{IP of Machine A}:2379", | ||
| "protocol": "rdma", | ||
| "device_name": "erdma_0, erdma_1", | ||
| "global_segment_size": 3355443200, | ||
| "local_buffer_size": 1073741824, | ||
| "master_server_address": "{IP of Machine A}:50052" | ||
| } | ||
| ``` | ||
| - Launch D endpoint using command `bash disagg_vllm_launcher.sh decoder Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4` | ||
|
|
||
| 5. Launch P endpoint on machine B | ||
| - Modify the vllm/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh file. | ||
| ```diff | ||
| diff --git a/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh b/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| index 831ef0bb5..9e5a3f044 100644 | ||
| --- a/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| +++ b/examples/lmcache/disagg_prefill_lmcache_v1/disagg_vllm_launcher.sh | ||
| @@ -18,12 +18,14 @@ fi | ||
|
|
||
| if [[ $1 == "prefiller" ]]; then | ||
| # Prefiller listens on port 8100 | ||
| - prefill_config_file=$SCRIPT_DIR/configs/lmcache-prefiller-config.yaml | ||
| + prefill_config_file=$SCRIPT_DIR/prefill.yaml | ||
|
|
||
| UCX_TLS=cuda_ipc,cuda_copy,tcp \ | ||
| LMCACHE_CONFIG_FILE=$prefill_config_file \ | ||
| LMCACHE_USE_EXPERIMENTAL=True \ | ||
| VLLM_ENABLE_V1_MULTIPROCESSING=1 \ | ||
| + VLLM_USE_MODELSCOPE=True \ | ||
| + MOONCAKE_CONFIG_PATH=./mooncake.json \ | ||
| VLLM_WORKER_MULTIPROC_METHOD=spawn \ | ||
| CUDA_VISIBLE_DEVICES=0 \ | ||
| vllm serve $MODEL \ | ||
| @@ -42,6 +44,8 @@ elif [[ $1 == "decoder" ]]; then | ||
| LMCACHE_CONFIG_FILE=$decode_config_file \ | ||
| LMCACHE_USE_EXPERIMENTAL=True \ | ||
| VLLM_ENABLE_V1_MULTIPROCESSING=1 \ | ||
| + VLLM_USE_MODELSCOPE=True \ | ||
| + MOONCAKE_CONFIG_PATH=./mooncake.json \ | ||
| VLLM_WORKER_MULTIPROC_METHOD=spawn \ | ||
| CUDA_VISIBLE_DEVICES=1 \ | ||
| vllm serve $MODEL \ | ||
| ``` | ||
|
|
||
| - Add `prefill.yaml` and `mooncake.json` file | ||
| ```yaml | ||
| chunk_size: 256 | ||
| local_device: "cpu" | ||
| remote_url: "mooncakestore://{IP of Machine A}:50052/" | ||
| remote_serde: "naive" | ||
| pipelined_backend: False | ||
| local_cpu: False | ||
| max_local_cpu_size: 100 | ||
| ``` | ||
|
|
||
| ```json | ||
| { | ||
| "local_hostname": "{IP of Machine B}", | ||
| "metadata_server": "etcd://{IP of Machine A}:2379", | ||
| "protocol": "rdma", | ||
| "device_name": "erdma_0, erdma_1", | ||
| "global_segment_size": 3355443200, | ||
| "local_buffer_size": 1073741824, | ||
| "master_server_address": "{IP of Machine A}:50052" | ||
| } | ||
| ``` | ||
|
|
||
| - Launch P endpoint using command `bash disagg_vllm_launcher.sh prefiller Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4` | ||
|
|
||
| 6. Launch the LoadBalance endpoint using command | ||
| ```bash | ||
| python3 disagg_proxy_server.py --host localhost --port 9000 --prefiller-host IP_of_Machine_B --prefiller-port 8100 --decoder-host IP_of_Machine_B --decoder-port 8200 | ||
| ``` | ||
|
|
||
| 7. Now we can send the requests to LoadBalance to test PD separation. | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @XucSh,
Thanks for sharing this doc, I tried it, but encountered an error
Failed to initialize/re-establish remote connection: Please install mooncake by following the instructionsI installed mooncake by
pip3 install mooncake-transfer-engineThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,zhenwei,the error indicates that mooncake is not installed correctly, you can install it by hand.
git clone https://github.com/kvcache-ai/Mooncake.git && cd Mooncake && sh dependencies.sh && mkdir build && cd build && cmake .. -DUSE_ETCD=1 -DUSE_ETCD_LEGACY=1 && make install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your reply, I will try.
BTW, does LMCache with mooncake backend not rely on the CUDA env and can it also run on other AI accelerators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Now LMCache V1 only works with CUDA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XucSh hello, wanna check if DUSE_ETCD_LEGACY=1 is necessary, it's hard to compile when enable this on my env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cicirori hi,this is not necessary. Regardless of how it's done, the key is to get the etcd service running. :)