-
Notifications
You must be signed in to change notification settings - Fork 467
[Misc] Add KV cache event synchronization configuration examples #1410
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
Draft
ae86zhizhi
wants to merge
2
commits into
vllm-project:main
Choose a base branch
from
ae86zhizhi:misc/kvevent_sample_config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 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,24 @@ | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-kv-events | ||
# Note: This sample uses 'default' namespace for quickstart purposes. | ||
# To deploy to a different namespace, change this value or use: kubectl apply -f <file> -n <your-namespace> | ||
namespace: default | ||
ae86zhizhi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: gateway-plugins | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
model.aibrix.ai/kv-events-enabled: "true" | ||
ports: | ||
- protocol: TCP | ||
port: 5557 | ||
- protocol: TCP | ||
port: 5558 |
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,94 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
model.aibrix.ai/name: llama-8b-instruct | ||
model.aibrix.ai/kv-events-enabled: "true" | ||
name: llama-8b-instruct | ||
# Note: This sample uses 'default' namespace for quickstart purposes. | ||
# To deploy to a different namespace, change this value or use: kubectl apply -f <file> -n <your-namespace> | ||
namespace: default | ||
ae86zhizhi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
model.aibrix.ai/name: llama-8b-instruct | ||
template: | ||
metadata: | ||
labels: | ||
model.aibrix.ai/name: llama-8b-instruct | ||
model.aibrix.ai/kv-events-enabled: "true" | ||
spec: | ||
containers: | ||
- name: vllm-openai | ||
image: vllm/vllm-openai:v0.7.1 | ||
command: | ||
- python3 | ||
- -m | ||
- vllm.entrypoints.openai.api_server | ||
- --host | ||
- "0.0.0.0" | ||
- --port | ||
- "8000" | ||
- --model | ||
- meta-llama/Llama-3.1-8B-Instruct | ||
- --served-model-name | ||
- llama-8b-instruct | ||
env: | ||
# NEW: KV event configuration via environment | ||
- name: VLLM_ENABLE_KV_CACHE_EVENTS | ||
value: "true" | ||
- name: VLLM_KV_EVENTS_PUBLISHER | ||
value: "zmq" | ||
- name: VLLM_KV_EVENTS_ENDPOINT | ||
value: "tcp://*:5557" | ||
- name: VLLM_KV_EVENTS_REPLAY_ENDPOINT | ||
value: "tcp://*:5558" | ||
- name: VLLM_KV_EVENTS_BUFFER_STEPS | ||
value: "10000" | ||
# Performance tuning | ||
- name: VLLM_KV_EVENTS_HWM | ||
value: "100000" # ZMQ high water mark | ||
ports: | ||
- containerPort: 8000 | ||
protocol: TCP | ||
name: api | ||
- containerPort: 5557 | ||
protocol: TCP | ||
name: kv-events | ||
- containerPort: 5558 | ||
protocol: TCP | ||
name: kv-replay | ||
resources: | ||
limits: | ||
nvidia.com/gpu: "1" | ||
requests: | ||
nvidia.com/gpu: "1" | ||
ae86zhizhi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
livenessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 3 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 5 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
startupProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 30 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 |
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 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
model.aibrix.ai/name: deepseek-r1-distill-llama-8b | ||
model.aibrix.ai/port: "8000" | ||
model.aibrix.ai/kv-events-enabled: "true" # NEW: Enable KV events | ||
name: deepseek-r1-distill-llama-8b | ||
# Note: This sample uses 'default' namespace for quickstart purposes. | ||
# To deploy to a different namespace, change this value or use: kubectl apply -f <file> -n <your-namespace> | ||
namespace: default | ||
ae86zhizhi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
model.aibrix.ai/name: deepseek-r1-distill-llama-8b | ||
template: | ||
metadata: | ||
labels: | ||
model.aibrix.ai/name: deepseek-r1-distill-llama-8b | ||
model.aibrix.ai/kv-events-enabled: "true" # NEW: Required for discovery | ||
spec: | ||
containers: | ||
- name: vllm-openai | ||
image: vllm/vllm-openai:v0.7.1 | ||
command: | ||
- python3 | ||
- -m | ||
- vllm.entrypoints.openai.api_server | ||
- --host | ||
- "0.0.0.0" | ||
- --port | ||
- "8000" | ||
- --uvicorn-log-level | ||
- warning | ||
- --model | ||
- deepseek-ai/DeepSeek-R1-Distill-Llama-8B | ||
- --served-model-name | ||
- deepseek-r1-distill-llama-8b | ||
- --max-model-len | ||
- "12288" | ||
# NEW: KV event publishing configuration | ||
- --enable-kv-cache-events | ||
- --kv-events-publisher | ||
- zmq | ||
- --kv-events-endpoint | ||
- "tcp://*:5557" | ||
- --kv-events-replay-endpoint | ||
- "tcp://*:5558" | ||
- --kv-events-buffer-steps | ||
- "10000" | ||
ports: | ||
- containerPort: 8000 | ||
protocol: TCP | ||
name: api | ||
# NEW: KV event ports | ||
- containerPort: 5557 | ||
protocol: TCP | ||
name: kv-events | ||
- containerPort: 5558 | ||
protocol: TCP | ||
name: kv-replay | ||
resources: | ||
limits: | ||
nvidia.com/gpu: "1" | ||
requests: | ||
nvidia.com/gpu: "1" | ||
# Health checks remain the same | ||
livenessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 3 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 5 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
startupProbe: | ||
httpGet: | ||
path: /health | ||
port: 8000 | ||
scheme: HTTP | ||
failureThreshold: 30 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
model.aibrix.ai/name: deepseek-r1-distill-llama-8b | ||
prometheus-discovery: "true" | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/port: "8080" | ||
name: deepseek-r1-distill-llama-8b | ||
# Note: This sample uses 'default' namespace for quickstart purposes. | ||
# To deploy to a different namespace, change this value or use: kubectl apply -f <file> -n <your-namespace> | ||
namespace: default | ||
spec: | ||
ports: | ||
- name: serve | ||
port: 8000 | ||
protocol: TCP | ||
targetPort: 8000 | ||
- name: metrics | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
# NEW: Expose KV event ports (optional, for debugging) | ||
- name: kv-events | ||
port: 5557 | ||
protocol: TCP | ||
targetPort: 5557 | ||
- name: kv-replay | ||
port: 5558 | ||
protocol: TCP | ||
targetPort: 5558 | ||
selector: | ||
model.aibrix.ai/name: deepseek-r1-distill-llama-8b | ||
type: ClusterIP |
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.
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.
did you see any issues without using NetworkPolicy?
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.
Gateway plugins are deployed in the
aibrix-system
namespace, while KV event producers (model pods) are deployed in thedefault
namespace (for quickstart) or inuser-specified
namespaces. The current NetworkPolicy only permits same-namespace traffic, but the actual deployment requires cross-namespace communication. I will prepare and submit a patch soon.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.
@ae86zhizhi Are you planning to submit a new PR or a new commit in this PR?