Repository navigation
Conversation
MisterVVP
changed the base branch from
main
to
dev-optimize-streaming-response-latencies
September 3, 2026 14:10
MisterVVP
merged commit Sep 3, 2026
d696509
into
dev-optimize-streaming-response-latencies
19 checks passed
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.
Summary
Follow-up to #223.
This PR unifies the default libcurl unary and streaming HTTP request paths onto the same bounded process-wide
CURLMreactor pool.Previously, streaming requests used the shared
CURLMreactors while unary requests used reusable easy handles withcurl_easy_perform(). As a result, a common unary → stream sequence could cross two independent libcurl connection caches and lose an otherwise reusable HTTP connection.The new implementation preserves the synchronous
SendRequest()API while executing its network transfer through the same event-driven request engine used by streaming.What changed
Unified CURLM request engine
Unary
RequestSlots now retain a reactor assignment in addition to their reusable easy handle.Client::SendRequest()configures the request as before, submits the easy handle to its assignedCURLMreactor, and synchronously waits for that transfer to complete.No public HTTP or A2A client API changes are required.
Unary → streaming connection-cache affinity
Each client establishes a primary reactor affinity for its first unary and streaming handles.
This allows the common sequence:
unary request -> streaming requestto use the same
CURLMconnection cache and reuse an existing HTTP connection when the server and protocol allow it.Additional concurrent unary and streaming handles continue to be distributed across the bounded reactor pool rather than concentrating all work on one reactor.
Bounded global resource usage
Both unary and streaming requests now use the existing process-wide pool of at most four
CURLMreactors.Reusable easy-handle slots retain their reactor assignments, preserving connection-cache locality while keeping reactor/thread growth bounded as more SDK clients are created.
Regression coverage
A dedicated loopback test performs a unary request followed by a streaming request through the same
a2a::http::Clientand verifies that both operations use a single accepted TCP connection.Existing concurrent unary-request coverage continues to verify that moving unary requests onto
CURLMdoes not serialize independent requests behind one shared easy handle.Performance documentation has been updated to describe the unified request topology.