Skip to content

perf: default MaxConnsPerHost to unlimited, fix zero-value semantics#918

Merged
chaholl merged 1 commit intomainfrom
feat/configurable-max-conns
Apr 8, 2026
Merged

perf: default MaxConnsPerHost to unlimited, fix zero-value semantics#918
chaholl merged 1 commit intomainfrom
feat/configurable-max-conns

Conversation

@chaholl
Copy link
Copy Markdown
Contributor

@chaholl chaholl commented Apr 8, 2026

Summary

  • Change DefaultMaxConnsPerHost from 100 to 0 (unlimited), matching Go's http.Transport default
  • Fix NewPooledTransportWithOptions to treat MaxConnsPerHost=0 as unlimited instead of silently replacing with the default of 100
  • Negative values still fall back to DefaultMaxConnsPerHost

The previous hardcoded limit of 100 silently capped streaming throughput at ~149 rps with typical LLM response times (~670ms), creating a hidden bottleneck discovered during benchmark profiling. The max_conns_per_host field in provider.yaml http_transport config was already wired through but couldn't set unlimited because 0 was silently replaced.

Benchmark impact (bare metal, 14-core Apple Silicon)

Concurrency Before (MaxConns=100) After (unlimited)
100 143 rps 143 rps
500 142 rps 696 rps
1000 142 rps 1,407 rps

Test plan

  • New test: TestNewPooledTransportWithOptions_ZeroMaxConnsPerHostMeansUnlimited
  • Existing test updated: negative values still fall back to default
  • Full runtime/providers/... test suite passes
  • Full pkg/... test suite passes
  • Pre-commit hook passes (lint, build, test, coverage)

Closes #916

Change DefaultMaxConnsPerHost from 100 to 0 (unlimited), matching
Go's http.Transport default. The previous hardcoded limit of 100
silently capped streaming throughput at ~149 rps with typical LLM
response times, creating a hidden bottleneck that was difficult to
diagnose (#916).

Fix NewPooledTransportWithOptions to treat MaxConnsPerHost=0 as
unlimited (pass through to http.Transport) instead of replacing
it with the default. Negative values still fall back to the
default. MaxIdleConnsPerHost retains <= 0 guard since zero idle
conns would disable connection reuse.

The max_conns_per_host field in provider.yaml http_transport config
was already wired through but previously couldn't set unlimited
(0 was silently replaced with 100).
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@chaholl chaholl merged commit 322d14d into main Apr 8, 2026
25 checks passed
@chaholl chaholl deleted the feat/configurable-max-conns branch April 18, 2026 17:49
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.

perf: investigate 930 rps streaming throughput ceiling

1 participant