Skip to content

perf: raise the default connection pool size from 5 to 100 - #113

Merged
mogita merged 1 commit into
mainfrom
perf/connection-pool-default-100
Oct 1, 2026
Merged

mogita merged 1 commit into
mainfrom
perf/connection-pool-default-100

Conversation

@mogita

@mogita mogita commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Problem

The SDK's calls are synchronous execute() calls, which Dispatcher.maxRequestsPerHost does not limit, so concurrency was never capped at 5. But ConnectionPool(5, ...) kept only 5 idle connections, so after a burst every other connection was closed and the next burst redid the TCP and TLS handshakes.

Solution

  • Raise DEFAULT_MAX_CONNS_PER_HOST from 5 to 100, so up to 100 connections stay warm for reuse. Idle connections still close after 55s.
  • Correct the comment that said the Dispatcher caps in-flight requests: it only caps async enqueue() calls.
  • 100 matches stream-py (#299) and the other SDKs.

How to verify

  1. ./gradlew test --tests 'io.getstream.StreamHTTPClientTest'
  2. testDefaultPoolKeepsBurstConnectionsWarm runs 10 concurrent requests against a local server and asserts that all 10 connections stay idle in the pool. With the old default it fails with expected: <10> but was: <5>.

ConnectionPool kept only 5 idle connections, so connections opened for a burst were closed and the next burst redid the TCP and TLS handshakes.
@mogita
mogita merged commit e7afcf8 into main Oct 1, 2026
7 checks passed
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