feat(vector sink): Add connection_ttl_secs config for load balancing #24034
+140
−8
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.
Summary
This PR adds a
connection_ttl_secsconfiguration option to thevectorsink that allows connections to be periodically closed and re-established. This addresses load balancing issues where long-lived HTTP/2 connections prevent proper distribution of traffic across backend instances.When
connection_ttl_secsis set, the sink will track the age of each connection and automatically recreate the underlying HTTP/2 client after the specified duration. This forces a reconnection through the load balancer, allowing traffic to be distributed to different backend instances.Vector configuration
Without the option (default behavior - unlimited connection reuse):
How did you test this PR?
The implementation tracks connection creation time and checks before each request whether the TTL has been exceeded. When expired, it recreates the hyper HTTP/2 client and gRPC client transparently.
Change Type
[ ] Bug fix
[x] New feature
[ ] Non-functional (chore, refactoring, docs)
[ ] Performance
Is this a breaking change?
[ ]Yes
[x] No
Does this PR include user facing changes?
[x] Yes. Please add a changelog fragment based on our guidelines.
[ ] No. A maintainer will apply the no-changelog label to this PR.
References
This addresses the common issue where HTTP/2 connection multiplexing and keep-alive prevent load balancers from distributing traffic across multiple backend instances, as HTTP/2 connections are designed to be long-lived and reused.