Repository navigation
Open SFTP and SSH store connections on demand - #432
Merged
Merged
Conversation
The SFTP and SSH stores opened all N connections when the store was created, whether they were needed or not. They now share a pool that opens the first connection up front, to confirm the store can be reached, and further ones only when all existing connections are busy, up to N. Connections are still opened one at a time. The S3 store kept minio's default of 16 idle connections per host, so with a concurrency above 16 the extra connections were closed and reopened for every request. It now keeps one per concurrent request.
Raising the per-host idle limit isn't enough on its own. minio's transport caps idle connections at 256 in total and Go's default transport, which the OCI store clones, at 100. Above that, connections were still closed and reopened for every request.
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.
The SFTP and SSH stores opened all N connections when the store was created, whether they were needed or not. With a high
-nthat meant starting that many SSH processes up front. This is also a prerequisite for adaptive concurrency (#430), where the number of requests in flight changes during a run and the connections should follow it.Both stores now share a small pool (
sessionpool.go) that:Close, and reports every close error instead of only the last oneA failure to open a later connection is now returned by the request that needed it rather than when the store is created. A pool size below 1 is treated as 1; previously a store created with
N: 0blocked forever on its first request.The S3 store kept minio's default of 16 idle connections per host, so with a concurrency above 16 the extra connections were closed and reopened, with a new TLS handshake, for every request. It now keeps one per concurrent request, as the HTTP and OCI stores already do. Raising the per-host limit alone isn't enough, since minio also caps idle connections at 256 in total, so that cap is raised too. The OCI store had the same problem above 100, the total cap of the Go default transport it clones, and gets the same fix. GCS already keeps 100 per host and is unchanged.