[ML] Refactoring http settings and adding stats endpoint#108219
Merged
jonathan-buttner merged 17 commits intoMay 28, 2024
Merged
[ML] Refactoring http settings and adding stats endpoint#108219jonathan-buttner merged 17 commits into
jonathan-buttner merged 17 commits into
Conversation
jonathan-buttner
commented
May 2, 2024
| "xpack.inference.http.max_connections", | ||
| public static final Setting<Integer> MAX_TOTAL_CONNECTIONS = Setting.intSetting( | ||
| "xpack.inference.http.max_total_connections", | ||
| 50, // default |
Contributor
Author
There was a problem hiding this comment.
Increasing this to 50 by default to exceed the maximum for a single to avoid a single service exhausting the entire connection pool.
| * The max number of connections a single route can lease. | ||
| */ | ||
| public static final Setting<Integer> MAX_ROUTE_CONNECTIONS = Setting.intSetting( | ||
| "xpack.inference.http.max_route_connections", |
Contributor
Author
There was a problem hiding this comment.
Allowing the per route limit to be controlled separately. I don't expect users to modify these settings often if ever. I could see these being used if we run into a situation in serverless or an SDH where we can help increase throughput.
| private IdleConnectionEvictor connectionEvictor; | ||
| private final HttpClient httpClient; | ||
|
|
||
| private volatile TimeValue evictionInterval; |
Contributor
Author
There was a problem hiding this comment.
The common pattern is to use volatile for settings, so moving to that.
Contributor
Author
|
@elasticmachine merge upstream |
…han-buttner/elasticsearch into ml-inference-http-pooling-settings
…ence-http-pooling-settings
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
…ence-http-pooling-settings
…ence-http-pooling-settings
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.
This PR adds some comments around the connection eviction and keep-alive strategy documentation for the apache http client implementation. I also increased the connection pool limit to exceed a single route's maximum. I've run into a situation during testing where a single service can lease all the connections in the pool and effectively blocking any other services from leasing a connection.
I also created a stats endpoint at
/_inference_stats. I was hoping to use/_inference/_statsbut theoretically a user could have that as their inference endpoint id 🤷♂️Right now the endpoint returns stats for the internal apache connection pool. I think this could be useful because it could illuminate whether a cluster has reached the maximum connections in the pool.
Example response:
After discussing with the team, we decided on
_inference/.diagnostics. If a user attempts to create an endpoint with a leading dot they'll get this error:If they attempt to create an endpoint called
.diagnosticsthey'll get this error: