Repository navigation
fix: [stable-8.0][OCISDEV-1724] reuse HTTP connections in the reva clients - #824
Merged
Merged
Conversation
…ients Under high load, the HTTP clients of reva opened a new connection for most requests. The default transport of Go keeps 2 idle connections for each host. The extra connections close after each request. The host runs out of ports. 1. The metadata client uses its own transport. All CS3 instances share it. 2. The function GetHTTPClient keeps up to 100 idle connections for each host. The ocdav service and the data gateway use this function. 3. Both clients close an idle connection after 30 seconds. A load balancer or an ingress controller often closes an idle connection after 60 seconds. The client must close first. The transport does not repeat a PUT or POST request on a connection that the other side closed. Tests send two bursts of parallel requests. The second burst reuses the idle connections of the first burst. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
deyankiteworks
approved these changes
Nov 20, 2026
kobergj
approved these changes
Nov 20, 2026
mklos-kw
reviewed
Nov 20, 2026
| @@ -0,0 +1,102 @@ | |||
| // Copyright 2018-2021 CERN | |||
This was referenced Nov 20, 2026
2403905
added a commit
that referenced
this pull request
Nov 20, 2026
…ients (#826) Under high load, the HTTP clients of reva opened a new connection for most requests. The default transport of Go keeps 2 idle connections for each host. The extra connections close after each request. The host runs out of ports. 1. The metadata client uses its own transport. All CS3 instances share it. 2. The function GetHTTPClient keeps up to 100 idle connections for each host. The ocdav service and the data gateway use this function. 3. Both clients close an idle connection after 30 seconds. A load balancer or an ingress controller often closes an idle connection after 60 seconds. The client must close first. The transport does not repeat a PUT or POST request on a connection that the other side closed. On this branch, GetHTTPClient wraps the transport in an autoprop round tripper. The new function newTransport builds the base transport, so that the test can check its settings. Tests send two bursts of parallel requests. The second burst reuses the idle connections of the first burst. Backport of #824 (cherry picked from commit af7eb0a). Co-authored-by: Claude Sonnet 5.5 <[email protected]>
2403905
added a commit
that referenced
this pull request
Nov 20, 2026
Under high load, the HTTP clients of reva opened a new connection for most requests. The default transport of Go keeps 2 idle connections for each host. The extra connections close after each request. The host runs out of ports. 1. The metadata client uses its own transport. All CS3 instances share it. 2. The function GetHTTPClient keeps up to 100 idle connections for each host. The ocdav service and the data gateway use this function. 3. Both clients close an idle connection after 30 seconds. A load balancer or an ingress controller often closes an idle connection after 60 seconds. The client must close first. The transport does not repeat a PUT or POST request on a connection that the other side closed. On this branch, GetHTTPClient wraps the transport in an autoprop round tripper. The new function newTransport builds the base transport, so that the test can check its settings. Tests send two bursts of parallel requests. The second burst reuses the idle connections of the first burst. Backport of #824 (cherry picked from commit af7eb0a). Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Problem
Under high load, the HTTP clients of reva open a new connection for most requests. The default transport of Go keeps 2 idle connections for each host. The extra connections close after each request. The host runs out of ports. This causes failed requests.
Ticket: OCISDEV-1724. The load test numbers and the analysis are in the ticket.
Change
pkg/storage/utils/metadata/cs3.go: the metadata client uses its own transport. AllCS3instances share it. It keeps up to 100 idle connections for each host.pkg/rhttp/client.go:GetHTTPClientkeeps up to 100 idle connections for each host. Theocdavservice and the data gateway use this function.PUTorPOSTrequest on a connection that the other side closed.Tests
rhttptest fails with the old limit.go test -racefor./pkg/rhttp/...and./pkg/storage/utils/metadata/.... All tests pass.Next step
After this PR is merged, the oCIS
go.modneeds a bump. The oCIS PR is in preparation.🤖 Generated with Claude Code