Skip to content

Memory fixes for EPP - #4

Open
Lucas-Fernandes-Martins wants to merge 12 commits into
mistral-mainfrom
lfm/cross-replica-store
Open

Memory fixes for EPP#4
Lucas-Fernandes-Martins wants to merge 12 commits into
mistral-mainfrom
lfm/cross-replica-store

Conversation

@Lucas-Fernandes-Martins

Copy link
Copy Markdown

What type of PR is this?

What this PR does / why we need it:

Two memory fixes:

  • Setting request payload to nil after it's used for the last time to save memory (GC won't free that memory since it belongs to a struct that is still in use).
  • No longer reading entire image just to get dimensions.

Which issue(s) this PR fixes:

  • Memory spikes on EPP under heavy load (specially multimodal)

Release note (write NONE if no user-facing change):

NONE

Signed-off-by: Lucas Fernandes Martins <lucas.fernandesmartins@macbook-pro-lucasmartins.cheetah-koi.ts.net>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas Fernandes Martins <lucas.fernandesmartins@macbook-pro-lucasmartins.cheetah-koi.ts.net>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas Fernandes Martins <lucas.fernandesmartins@macbook-pro-lucasmartins.cheetah-koi.ts.net>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
The Get method now accepts a caller-supplied aggregate function so
store implementations can fold per-replica values without hardcoding
aggregation logic.

Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
Implement a Redis-backed CrossReplicaStore that enables cross-replica
state aggregation. Each EPP replica writes its local state to Redis
keyed by {stateKey}:{endpointID}:{replicaID}, and reads aggregate
across all replicas via KEYS scan + caller-supplied aggregation
function.

Signed-off-by: Lucas-Fernandes-Martins <lucas.fernandesmartins@mistral.ai>
Signed-off-by: Lucas-Fernandes-Martins <lucasfmartins16@gmail.com>
- Replace KEYS+GET pattern with HSET/HGETALL (hash-per-endpoint)
- Add configurable TTL (default 180s) to expire stale replica data
- Add Ping health check at startup
- Log decode errors at DEBUG level instead of silently continuing
Dead replicas' hash fields persist because live replicas keep refreshing
the hash-level EXPIRE. Fix by stamping each value with its write time
and filtering entries older than TTL in Get().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant