[ML] Cache Inference Endpoints#133860
Merged
prwhelan merged 18 commits intoelastic:mainfrom Sep 10, 2025
Merged
Conversation
Maintain parsed Inference Endpoints in memory for reuse. Endpoints are cached on first access and expire after write. This removes search pressure during inference, bypassing search requests to system indices for repeated model access. When any endpoint is updated or deleted, the whole cache is invalidated and must be reloaded. Cache can be configured with three settings: - `xpack.inference.cache.enabled` enables or disables the cache (default enabled). - `xpack.inference.cache.weight` controls how many endpoints can live in the cache (default 25). - `xpack.inference.cache.expiry_time` controls how long endpoints live in the cache, measured from when they are first accessed (default 15 minutes, minimum 1 minute, maximum 1 hour). Resolve elastic#133135
Collaborator
|
Hi @prwhelan, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
Contributor
jonathan-buttner
left a comment
There was a problem hiding this comment.
Looks good just left a few questions
.../main/java/org/elasticsearch/xpack/inference/registry/ClearInferenceEndpointCacheAction.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/SerializableStats.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferencePlugin.java
Outdated
Show resolved
Hide resolved
...ence/src/main/java/org/elasticsearch/xpack/inference/registry/InferenceEndpointRegistry.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/elasticsearch/xpack/inference/registry/InferenceEndpointRegistryTests.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/xpack/inference/registry/ClearInferenceEndpointCacheAction.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/xpack/inference/registry/ClearInferenceEndpointCacheAction.java
Show resolved
Hide resolved
davidkyle
reviewed
Sep 8, 2025
Member
davidkyle
left a comment
There was a problem hiding this comment.
Project Aware!!!! nice. Looks good I'll take another pass at it later
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/SerializableStats.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferencePlugin.java
Outdated
Show resolved
Hide resolved
...ence/src/main/java/org/elasticsearch/xpack/inference/registry/InferenceEndpointRegistry.java
Outdated
Show resolved
Hide resolved
davidkyle
approved these changes
Sep 9, 2025
Member
davidkyle
left a comment
There was a problem hiding this comment.
LGTM
This is a really good change one I've wanted to make for a while
...c/main/java/org/elasticsearch/xpack/core/inference/action/GetInferenceDiagnosticsAction.java
Outdated
Show resolved
Hide resolved
...ce-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/CreateFromDeploymentIT.java
Show resolved
Hide resolved
.../main/java/org/elasticsearch/xpack/inference/registry/ClearInferenceEndpointCacheAction.java
Outdated
Show resolved
Hide resolved
jonathan-buttner
approved these changes
Sep 9, 2025
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.
Maintain parsed Inference Endpoints in memory for reuse. Endpoints are cached on first access and expire after write. This removes search pressure during inference, bypassing search requests to system indices for repeated model access. When any endpoint is updated or deleted, the whole cache is invalidated and must be reloaded.
Cache can be configured with three settings:
xpack.inference.cache.enabledenables or disables the cache (default enabled).xpack.inference.cache.weightcontrols how many endpoints can live in the cache (default 25).xpack.inference.cache.expiry_timecontrols how long endpoints live in the cache, measured from when they are first accessed (default 15 minutes, minimum 1 minute, maximum 1 hour).Resolve #133135