upstream: fix: set MaxIdleConnsPerHost on internal HTTP transports (goharbor/harbor#23591) - #533
Draft
github-actions[bot] wants to merge 1 commit into
Draft
upstream: fix: set MaxIdleConnsPerHost on internal HTTP transports (goharbor/harbor#23591)#533github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…oharbor/harbor#23591) Go's default MaxIdleConnsPerHost(2) causes heavy connection churn on Harbor's single-host internal traffic (core->registry proxy, registry client, jobservice hooks, scanner client), piling up TIME_WAIT sockets and exhausting ephemeral ports under high concurrency (dial error: cannot assign requested address). Raise per-host idle pools to match each path's concurrency. Idle connections are still reaped by IdleConnTimeout; no behavior change. Signed-off-by: chlins <chlins.zhang@gmail.com> Co-authored-by: Wang Yan <wangyan_0219@hotmail.com> (cherry picked from commit c2c27ed2d617eee7a53b6c130a73c06668f910c8) Upstream-Commit: c2c27ed2d617eee7a53b6c130a73c06668f910c8 Upstream-PR: goharbor/harbor#23591 Upstream-Author: @chlins Cherry-Pick-Status: conflicted Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
Cherry-picks upstream Harbor commit
c2c27ed2dfrom goharbor/harbor#23591.Upstream Context
Cherry-Pick Status
Upstream Description
Comprehensive Summary
Go's
http.TransportdefaultsMaxIdleConnsPerHostto 2. Harbor's internal traffic is dominated by single-host hotspots (core → registry reverse proxy, registry API client, jobservice → core hooks, scanner adapter client), so under high concurrency almost every connection is closed after use. The resulting churn piles up client-sideTIME_WAITsockets and eventually exhausts ephemeral ports:Changes:
common/http/transport.go:newDefaultTransport()now setsMaxIdleConns=1000/MaxIdleConnsPerHost=200, covering the registry client, core↔jobservice, webhook jobs and replication adapters.server/registry/proxy.go: the core → registry reverse proxy previously fell back tohttp.DefaultTransportwhen internal TLS is disabled; it now always gets a dedicated transport withMaxIdleConns(PerHost)=1024, as all/v2/data-plane traffic targets a single host.jobservice/hook/hook_client.go/pkg/scan/rest/v1/client.go: per-host idle pool now matchesMaxIdleConns(20/100), since each client only talks to one endpoint.These knobs only enable connection reuse — idle connections beyond actual need are still reaped by
IdleConnTimeout, and peak connection count remains driven by concurrency. No behavior change.Issue being fixed
Observed on a docker-compose deployment under high-concurrency pulls; core floods
proxy error: context canceledfollowed bycannot assign requested addresson the core → registry hop.Review Notes
Upstream-Commit: c2c27ed2d617eee7a53b6c130a73c06668f910c8
Upstream-PR: goharbor/harbor#23591
Cherry-Pick-Status: conflicted