Skip to content

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

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

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

Conversation

@mogita

@mogita mogita commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

The default SocketsHttpHandler capped each client at 5 connections per server (MaxConnectionsPerServer = 5). The API is served over HTTP/1.1, so a 6th concurrent request queues for a free connection, and that wait counts against the request timeout.

Solution

  • Raise the MaxConnsPerHost default from 5 to 100 in StreamOptions and ClientBuilder. Idle connections still close after 55s.
  • 100 matches stream-py (#299).
  • Apps that relied on the old limit to throttle traffic can set MaxConnsPerHost = 5.

How to verify

  1. dotnet test tests --filter "FullyQualifiedName~ConnectionPoolTests|FullyQualifiedName~ClientBuilderTests"
  2. All 20 pass and assert MaxConnectionsPerServer and the client.initialized log line at 100.

The default of 5 capped each client at 5 concurrent requests, so busy servers queued behind the pool. 100 matches httpx's default and stream-py.
@mogita
mogita merged commit 2fbcf6a into master Oct 1, 2026
7 checks passed
@mogita
mogita deleted the perf/connection-pool-default-100 branch October 1, 2026 13:44
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