fix(epp): record encode-stage endpoint in multimodal encoder-cache - #2627
Open
acardace wants to merge 3 commits into
Open
fix(epp): record encode-stage endpoint in multimodal encoder-cache#2627acardace wants to merge 3 commits into
acardace wants to merge 3 commits into
Conversation
Add an optional encodeProfile parameter (default "encode") to the multimodal encoder-cache producer, matching the profiles.encode value on disagg-profile-handler. The value is resolved and stored on the producer for use when recording encoder-cache placements. Signed-off-by: Antonio Cardace <acardace@redhat.com>
The mm-embeddings-cache-producer recorded encoder-cache placements against the primary (decode) profile's endpoint. In disaggregated E/PD serving the encode stage runs as a separate profile and selects a different pod, so the producer stored decode-pod IDs while scoring queried encode-pod IDs. The keys never matched: the affinity score was always zero and repeated media never stuck to the pod that already held the embeddings. Record the encode profile's target endpoints instead, falling back to the primary profile when no encode profile ran (aggregated serving). Recording only the encode endpoint also keeps encoder_cache_hits_total from counting decode pods, which do not hold the encoder cache. Signed-off-by: Antonio Cardace <acardace@redhat.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes multimodal encoder-cache affinity for encode-disaggregated serving by ensuring mm-embeddings-cache-producer records the encode-stage endpoint(s) (rather than the decode endpoint) when updating the per-pod LRU used for affinity scoring.
Changes:
- Add an
encodeProfileparameter (default"encode") and store it on the producer instance. - Update
PreRequestto select endpoints from the encode profile’sTargetEndpoints, with fallback to the primary profile for aggregated serving. - Add unit tests covering encode-vs-decode endpoint recording and the primary-profile fallback behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/epp/framework/plugins/requestcontrol/dataproducer/multimodal/producer.go | Introduces configurable encodeProfile and wires it into the producer initialization. |
| pkg/epp/framework/plugins/requestcontrol/dataproducer/multimodal/prerequest.go | Records cache placement against encode-profile endpoints (fallback to primary profile). |
| pkg/epp/framework/plugins/requestcontrol/dataproducer/multimodal/producer_test.go | Adds tests validating encode endpoint recording and aggregated fallback. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+149
to
+173
| func TestPreRequestRecordsEncodeEndpointInDisaggregatedMode(t *testing.T) { | ||
| producer := newTestProducer(t, nil, nil) | ||
| encodePod := k8stypes.NamespacedName{Namespace: "default", Name: "encode-pod"} | ||
| decodePod := k8stypes.NamespacedName{Namespace: "default", Name: "decode-pod"} | ||
|
|
||
| request := requestWithHashes("req-1", map[string]int{"hash-a": 1}) | ||
|
|
||
| require.NoError(t, producer.Produce(context.Background(), request, | ||
| []scheduling.Endpoint{newEndpoint(encodePod), newEndpoint(decodePod)})) | ||
|
|
||
| result := &scheduling.SchedulingResult{ | ||
| PrimaryProfileName: "decode", | ||
| ProfileResults: map[string]*scheduling.ProfileRunResult{ | ||
| "decode": {TargetEndpoints: []scheduling.Endpoint{newEndpoint(decodePod)}}, | ||
| "encode": {TargetEndpoints: []scheduling.Endpoint{newEndpoint(encodePod)}}, | ||
| }, | ||
| } | ||
|
|
||
| _ = producer.PreRequest(context.Background(), request, result) | ||
| producer.wg.Wait() | ||
|
|
||
| cache := producer.cacheSnapshot() | ||
| assert.Contains(t, cache["hash-a"], encodePod.String()) | ||
| assert.NotContains(t, cache["hash-a"], decodePod.String()) | ||
| } |
…producer Signed-off-by: Antonio Cardace <acardace@redhat.com>
acardace
force-pushed
the
fix/mm-cache-prerequest-records-encode-endpoints
branch
from
September 1, 2026 12:41
8b0f630 to
a9a8cc4
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this?
/kind bug
What this PR does / why we need it:
In encode-disaggregated (E/PD, E/P/D) serving,
mm-embeddings-cache-scoreralways scored 0 for every encode pod, so encoder-cache affinity never routed repeated media to the pod that already held the embedding, andencoder_cache_hit_ratiostayed at 0.The
mm-embeddings-cache-producerreads the per-pod LRU inProduce()(keyed byendpoint.ID, scoring encode pods) and writes it inPreRequest().PreRequestrecorded the endpoints fromProfileResults[PrimaryProfileName], whichdisagg-profile-handlersets to the decode profile. So the producer stored decode-pod IDs while scoring queried encode-pod IDs: the keys never matched and affinity was always 0. Recording the decode pod also inflatedencoder_cache_hits_total, which counts a hit for every pod in the LRU holding the hash even though decode pods do not hold the encoder cache.This PR records the encode profile target endpoints instead, falling back to the primary profile when no encode profile ran (aggregated serving). The encode profile name is configurable via a new
encodeProfileparameter (defaultencode) to matchdisagg-profile-handler.Validated on a 1 encode-per-pod and 2 encode-pod E/PD deployment (Qwen2.5-VL-7B): with the fix, the first request scores 0 (cold), subsequent same-image requests score 1 on the encoding pod and 0 on the other, and all repeated requests route to that pod.
encoder_cache_hits_totalrecords only the encode pod.Which issue(s) this PR fixes:
Fixes #2626
Release note (write
NONEif no user-facing change):