Repository navigation
test: Add vLLM integration tests - #261
ptarasiewiczNV wants to merge 6 commits into
Conversation
8c9dd7c to
67d0360
Compare
|
My first thought is, yay testing! And different levels of impact! Can you please elaborate on when you think different testing levels should run and the runtime implications of each level? My second thought is @pvijayakrish should have eyes on this as she has been thinking about what executing the test suite should look like. To my eyes this is largely replicating the test framework of Triton and that comes with limitations of legibility and reporting if we don't conform to standard testing output formats. After @pvijayakrish weighs in on how to proceed, I would like to see these changes reflected in the public workflow. Finally, if you would can you fill in these answers in the overview of this PR? |
|
This is just a very first set of tests that only cover the examples, I think these are must have. The biggest problems with them is that some of them require > 1 GPUs (disagg configs) and it may take some time until the jobs are allocated. For that reason I am fine in running L1 post merge. Maybe something like:
But even if the configuration will be changed in the future I think it's very important and urgent to have at least this basic set of tests from this PR run post merge. |
| done | ||
|
|
||
| echo "==============================================================" | ||
| echo "✅ SUCCESS: All responses are identical - deterministic behavior confirmed" |
There was a problem hiding this comment.
Do emojis get rendered in bash?
|
This is great Piotr - I'm not sure how our GPUs for CI work but it would be great if these could run nightly. The current 4 examples should never be broken on main |
| wait_for_server "$HOST:$PORT" $SERVED_MODEL_NAME || exit 1 | ||
|
|
||
| echo "Checking if responses are deterministic..." | ||
| first_response="" |
There was a problem hiding this comment.
There is a lot of code duplication. All the tests have similar structure:
- run deployment according to given config
- check if the answer make sense ('Paris' in the response)
- check if the answers are deterministic
Couldn't we make some reusable code?
Anyway, I don't mind merging it now and polishing later.
d3f2398 to
ff52cf0
Compare
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
WalkthroughThis update introduces several new shell scripts for automated testing of deterministic behavior in various LLM serving configurations, including both aggregated and disaggregated setups with and without KV routing. It also adds a Bash utility script with helper functions for test orchestration and updates the Dockerfile to install the Changes
Sequence Diagram(s)sequenceDiagram
participant Tester as Test Script
participant Env as Test Environment
participant NATS as NATS Server
participant ETCD as etcd Server
participant LLM as LLM Frontend Service
Tester->>Env: Set up environment variables
Tester->>Env: Install dependencies (e.g., hf-transfer)
Tester->>NATS: Start NATS server
Tester->>ETCD: Start etcd server
Tester->>Env: Source utility functions
Tester->>NATS: Wait for readiness
Tester->>ETCD: Wait for readiness
Tester->>LLM: Launch LLM frontend service
Tester->>LLM: Wait for server readiness
loop 10 times
Tester->>LLM: Send chat completion request (fixed seed, temp=0)
LLM-->>Tester: Return response
end
Tester->>Tester: Verify all responses are identical and contain expected answer
Tester-->>Env: Print success or failure
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 7
♻️ Duplicate comments (4)
tests/vllm/L1_deploy_examples_llm_disaggregated_serving/test.sh (3)
27-27: QuotesourcepathWrap the sourced path in quotes to handle spaces:
-source $SCRIPT_DIR/../utils.sh +source "$SCRIPT_DIR"/../utils.sh
42-45: Anchor and quoteyqinvocations- SERVED_MODEL_NAME=$(yq .Frontend.model $CONFIG_FILE) + SERVED_MODEL_NAME=$(yq eval '.Frontend.model' "$CONFIG_FILE") - PORT=$(yq .Frontend.port $CONFIG_FILE) + PORT=$(yq eval '.Frontend.port' "$CONFIG_FILE")
53-67: QuoteSERVED_MODEL_NAMEin JSON payload and use raw output- response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ - -H "Content-Type: application/json" \ - -d '{ - "model": '$SERVED_MODEL_NAME', - ... - }') + response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "'"$SERVED_MODEL_NAME"'", + ... + }') @@ - completion=$(echo "$response" | jq .choices[0].message.content) + completion=$(echo "$response" | jq -r .choices[0].message.content)tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh (1)
49-91: Duplicate test logic across scripts.
This deterministic-response loop is duplicated in multiple test.sh files. Consider extracting it into a helper inutils.sh(e.g.run_deterministic_test) and parameterizing the endpoint, prompt, expected token, and repeat count.
🧹 Nitpick comments (11)
container/Dockerfile.vllm (1)
159-159: Unify APT usage and cleanup to reduce image sizeUse
apt-getconsistently, enable--no-install-recommends, and clean up the apt cache to keep the image lean:-RUN apt update -y && apt install -y git wget curl nvtop tmux vim yq +RUN apt-get update -y && \ + apt-get install -y --no-install-recommends git wget curl nvtop tmux vim yq && \ + rm -rf /var/lib/apt/lists/*tests/vllm/utils.sh (3)
1-4: Consider enabling strict error modesAdding
set -euo pipefailat the top will catch unbound variables and pipeline failures early:-#!/usr/bin/env bash +#!/usr/bin/env bash +set -euo pipefail
30-31: Remove unusedhostandportvariablesThe locals
hostandportare assigned but never used. Removing them cleans up the function:-local host=$(echo $host_port | cut -d ':' -f 1) -local port=$(echo $host_port | cut -d ':' -f 2)
110-113: Quote expansions to prevent word splittingWrap variable expansions in quotes when echoing or piping:
- echo $(echo $SLURM_NODELIST | cut -d',' -f1) + echo "$(echo "$SLURM_NODELIST" | cut -d',' -f1)"tests/vllm/L0_pre_merge/test.sh (1)
24-24: Address the TODO formypychecksThe placeholder indicates missing type checking. Consider re-enabling mypy or removing this TODO. Let me know if you’d like assistance integrating
mypy.tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh (1)
27-27: QuotesourcepathWrap the sourced path in quotes to handle spaces:
-source $SCRIPT_DIR/../utils.sh +source "$SCRIPT_DIR"/../utils.shtests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh (2)
26-27: Quote$SCRIPT_DIRwhen sourcing.
Wrap the path in quotes to guard against spaces/globbing:- source $SCRIPT_DIR/../utils.sh + source "$SCRIPT_DIR/../utils.sh"
18-18: Enable strict error handling.
Replaceset -exwith:- set -ex + set -euxo pipefailto catch unset variables and pipeline failures.
tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh (3)
49-91: Extract the common deterministic-response loop.
This loop is duplicated across test scripts. Consider factoring it intoutils.sh(e.g.run_deterministic_test) to reduce duplication and improve maintainability.
26-27: Quote$SCRIPT_DIRwhen sourcing.
Ensure the path is quoted:- source $SCRIPT_DIR/../utils.sh + source "$SCRIPT_DIR/../utils.sh"
18-18: Enable stricter shell flags.
Consider using:- set -ex + set -euxo pipefailto catch unset variables and pipeline errors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
container/Dockerfile.vllm(1 hunks)tests/vllm/L0_pre_merge/test.sh(1 hunks)tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh(1 hunks)tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh(1 hunks)tests/vllm/L1_deploy_examples_llm_disaggregated_serving/test.sh(1 hunks)tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh(1 hunks)tests/vllm/utils.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
tests/vllm/utils.sh
[warning] 30-30: host appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 30-30: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 31-31: port appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 31-31: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 74-74: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 112-112: Quote this to prevent word splitting.
(SC2046)
🔇 Additional comments (3)
tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh (1)
42-45: Anchor and quoteyqinvocationsExplicitly quote variables and use the compatible
evalsubcommand:- SERVED_MODEL_NAME=$(yq .Frontend.model $CONFIG_FILE) + SERVED_MODEL_NAME=$(yq eval '.Frontend.model' "$CONFIG_FILE") - PORT=$(yq .Frontend.port $CONFIG_FILE) + PORT=$(yq eval '.Frontend.port' "$CONFIG_FILE")Verify your
yqversion supports this syntax.tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh (2)
37-38: Good use of service readiness helpers.
Usingwait_for_natsandwait_for_etcdreplaces brittle sleeps and aligns with past feedback.
40-45: Fetching config viayqaddresses previous suggestions.
Retrieving model and port fromagg.yamlwithyqis implemented correctly here.
| if curl -s -X POST http://$host_port/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": '$model', | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "test" | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 5 | ||
| }' | grep -q "content"; then |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Quote model in JSON payload to prevent invalid JSON and injection
Wrap $model in double quotes in the JSON body:
- if curl -s -X POST http://$host_port/v1/chat/completions \
+ if curl -s -X POST "http://$host_port/v1/chat/completions" \
-H "Content-Type: application/json" \
- -d '{
- "model": '$model',
+ -d '{
+ "model": "'"$model"'",
"messages": [
{
"role": "user",
"content": "test"
}
],
"stream": false,
"max_tokens": 5
}' | grep -q "content"; then📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if curl -s -X POST http://$host_port/v1/chat/completions \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": '$model', | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "test" | |
| } | |
| ], | |
| "stream": false, | |
| "max_tokens": 5 | |
| }' | grep -q "content"; then | |
| if curl -s -X POST "http://$host_port/v1/chat/completions" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "'"$model"'", | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "test" | |
| } | |
| ], | |
| "stream": false, | |
| "max_tokens": 5 | |
| }' | grep -q "content"; then |
🤖 Prompt for AI Agents
In tests/vllm/utils.sh around lines 37 to 49, the $model variable in the JSON
payload is not quoted, which can produce invalid JSON or allow injection. Fix
this by wrapping $model in double quotes inside the JSON string to ensure it is
treated as a proper JSON string value.
| TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")" | ||
| OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}} | ||
| DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD} | ||
|
|
There was a problem hiding this comment.
Ensure output directory exists before running pytest
Create the output directory to avoid write errors:
-OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
+OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
+mkdir -p "${OUTPUT_DIR}"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")" | |
| OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}} | |
| DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD} | |
| TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")" | |
| OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}} | |
| mkdir -p "${OUTPUT_DIR}" | |
| DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD} |
🤖 Prompt for AI Agents
In tests/vllm/L0_pre_merge/test.sh around lines 20 to 23, the script sets the
OUTPUT_DIR variable but does not ensure the directory exists, which can cause
write errors during pytest execution. Add a command to create the OUTPUT_DIR
directory if it does not already exist, using mkdir with appropriate flags to
create parent directories as needed before running pytest.
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": '$SERVED_MODEL_NAME', | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "What is capital of France?" | ||
| } | ||
| ], | ||
| "seed": 1, | ||
| "temperature": 0.0, | ||
| "stream": false, | ||
| "max_tokens": 100 | ||
| }') |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Quote SERVED_MODEL_NAME in JSON payload and use raw output
Wrap the model name in quotes and extract the content with jq -r to avoid embedded quotes in the comparison:
- response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
- -H "Content-Type: application/json" \
- -d '{
- "model": '$SERVED_MODEL_NAME',
- ...
- }')
+ response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "model": "'"$SERVED_MODEL_NAME"'",
+ ...
+ }')
@@
- completion=$(echo "$response" | jq .choices[0].message.content)
+ completion=$(echo "$response" | jq -r .choices[0].message.content)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": '$SERVED_MODEL_NAME', | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "What is capital of France?" | |
| } | |
| ], | |
| "seed": 1, | |
| "temperature": 0.0, | |
| "stream": false, | |
| "max_tokens": 100 | |
| }') | |
| response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "'"$SERVED_MODEL_NAME"'", | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "What is capital of France?" | |
| } | |
| ], | |
| "seed": 1, | |
| "temperature": 0.0, | |
| "stream": false, | |
| "max_tokens": 100 | |
| }') | |
| completion=$(echo "$response" | jq -r .choices[0].message.content) |
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh
around lines 53 to 67, the SERVED_MODEL_NAME variable is not quoted in the JSON
payload, which can cause invalid JSON if the model name contains special
characters. Fix this by wrapping the model name in double quotes inside the JSON
string. Also, when extracting the response content for comparison, use jq with
the -r flag to get raw output without embedded quotes.
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": '$SERVED_MODEL_NAME', | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "We will start with some tokens to actually trigger disaggregation. What is capital of France?" | ||
| } | ||
| ], | ||
| "seed": 1, | ||
| "temperature": 0.0, | ||
| "stream": false, | ||
| "max_tokens": 100 | ||
| }') |
There was a problem hiding this comment.
Quote the model name in the JSON payload.
The current construction
-d '{
"model": '$SERVED_MODEL_NAME',
…
}'will emit unquoted model names (invalid JSON). Use:
- "model": '$SERVED_MODEL_NAME',
+ "model": "'"$SERVED_MODEL_NAME"'", or switch to a here-doc for clarity.
🤖 Prompt for AI Agents
In
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh
between lines 53 and 67, the model name variable $SERVED_MODEL_NAME is inserted
into the JSON payload without quotes, resulting in invalid JSON. Fix this by
enclosing the model name in double quotes within the JSON string, or
alternatively, refactor the curl command to use a here-document to clearly and
correctly format the JSON payload with proper quoting.
|
|
||
|
|
||
| export HF_HUB_ENABLE_HF_TRANSFER=1 | ||
| uv pip install hf-transfer |
There was a problem hiding this comment.
Fix the pip install command.
The line uv pip install hf-transfer is invalid and will fail. It should be:
- uv pip install hf-transfer
+ pip install hf-transfer📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| uv pip install hf-transfer | |
| pip install hf-transfer |
🤖 Prompt for AI Agents
In
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh
at line 22, the command `uv pip install hf-transfer` is invalid. Replace it with
the correct pip install command by removing the `uv` prefix so it reads `pip
install hf-transfer`.
|
|
||
|
|
||
| export HF_HUB_ENABLE_HF_TRANSFER=1 | ||
| uv pip install hf-transfer |
There was a problem hiding this comment.
Fix the pip install command.
The line uv pip install hf-transfer is invalid and will fail. It should be:
- uv pip install hf-transfer
+ pip install hf-transfer📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| uv pip install hf-transfer | |
| # Before (line 22 in tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh) | |
| - uv pip install hf-transfer | |
| # After | |
| pip install hf-transfer |
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh at line 22, the
command `uv pip install hf-transfer` is invalid and will cause an error. Replace
`uv` with the correct command prefix or remove it entirely so that the line
correctly runs `pip install hf-transfer`.
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": '$SERVED_MODEL_NAME', | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "What is capital of France?" | ||
| } | ||
| ], | ||
| "seed": 1, | ||
| "temperature": 0.0, | ||
| "stream": false, | ||
| "max_tokens": 100 | ||
| }') |
There was a problem hiding this comment.
Quote the model name in the JSON payload.
As in the other test, this will emit unquoted values. Change to:
- "model": '$SERVED_MODEL_NAME',
+ "model": "'"$SERVED_MODEL_NAME"'", or use a here-doc block for JSON.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": '$SERVED_MODEL_NAME', | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "What is capital of France?" | |
| } | |
| ], | |
| "seed": 1, | |
| "temperature": 0.0, | |
| "stream": false, | |
| "max_tokens": 100 | |
| }') | |
| response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "'"$SERVED_MODEL_NAME"'", | |
| "messages": [ | |
| { | |
| "role": "user", | |
| "content": "What is capital of France?" | |
| } | |
| ], | |
| "seed": 1, | |
| "temperature": 0.0, | |
| "stream": false, | |
| "max_tokens": 100 | |
| }') |
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh between lines 53
and 67, the model name variable SERVED_MODEL_NAME is not quoted in the JSON
payload, causing it to be emitted as an unquoted value. Fix this by enclosing
the model name variable in double quotes within the JSON string to ensure it is
properly quoted. Alternatively, refactor the JSON payload to use a here-document
block for clearer and safer JSON formatting.
|
@ptarasiewiczNV Should we revive this? Seems useful. Otherwise can you close it? |
## Summary - add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes - retain the existing per-worker decoded-image LRU and in-flight deduplication - fail open to the origin when shared-cache reads, writes, or deletes fail - validate cached payloads, evict corrupt entries, and refill them from the origin - split Redis connection and I/O timeouts for large image transfers - expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection. ## Metrics - `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error` - `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error` - both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown` GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels. ## User impact Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled. ## Validation - 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed - Python compilation passed - isort, Black, flake8, Ruff, and codespell passed for the cache changes - `git diff --check` passed The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument. Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main. Signed-off-by: Dao Le <daole@inferact.ai>
Signed-off-by: Dao Le <daole@inferact.ai> ## Summary - read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity - pass the propagated session ID into the vLLM image loader - scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier - gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`. ## Validation - `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed) - targeted agent-context/header tests (4 passed) - ImageLoader unit tests (50 passed, 1 expected HEIF skip) - Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check` - vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main.
## Summary - add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes - retain the existing per-worker decoded-image LRU and in-flight deduplication - fail open to the origin when shared-cache reads, writes, or deletes fail - validate cached payloads, evict corrupt entries, and refill them from the origin - split Redis connection and I/O timeouts for large image transfers - expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection. ## Metrics - `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error` - `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error` - both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown` GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels. ## User impact Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled. ## Validation - 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed - Python compilation passed - isort, Black, flake8, Ruff, and codespell passed for the cache changes - `git diff --check` passed The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument. Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main. Signed-off-by: Dao Le <daole@inferact.ai> Signed-off-by: Dao007forever <daole@inferact.ai>
Signed-off-by: Dao Le <daole@inferact.ai> ## Summary - read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity - pass the propagated session ID into the vLLM image loader - scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier - gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`. ## Validation - `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed) - targeted agent-context/header tests (4 passed) - ImageLoader unit tests (50 passed, 1 expected HEIF skip) - Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check` - vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main. Signed-off-by: Dao007forever <daole@inferact.ai>
- add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes - retain the existing per-worker decoded-image LRU and in-flight deduplication - fail open to the origin when shared-cache reads, writes, or deletes fail - validate cached payloads, evict corrupt entries, and refill them from the origin - split Redis connection and I/O timeouts for large image transfers - expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection. - `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error` - `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error` - both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown` GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels. Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled. - 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed - Python compilation passed - isort, Black, flake8, Ruff, and codespell passed for the cache changes - `git diff --check` passed The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument. Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main. Signed-off-by: Dao Le <daole@inferact.ai> Signed-off-by: Dao007forever <daole@inferact.ai>
Signed-off-by: Dao Le <daole@inferact.ai> - read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity - pass the propagated session ID into the vLLM image loader - scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier - gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`. - `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed) - targeted agent-context/header tests (4 passed) - ImageLoader unit tests (50 passed, 1 expected HEIF skip) - Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check` - vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main. Signed-off-by: Dao007forever <daole@inferact.ai>
Overview:
Add basic vLLM e2e tests that follow the examples
Details:
Each test can be run inside the container by running the test script:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit