Repository navigation
Conversation
devanbenz
force-pushed
the
db/23996/open-repl-clients
branch
from
November 9, 2026 20:57
9c59c5c to
5baf57a
Compare
Every remote write built a new api client, and influx-cli's NewAPIConfig clones http.DefaultTransport per call. Connections are pooled per Transport, so none was ever reused: each write did a fresh DNS lookup, TCP and TLS handshake, and left an idle connection open for ~90s. While draining a backlog this exhausts the file descriptor limit. PostWrite now uses one of two package-level transports (TLS verification on/off), so connections are pooled across all streams and the validator. Closes #23996
devanbenz
force-pushed
the
db/23996/open-repl-clients
branch
from
November 9, 2026 20:59
5baf57a to
0a69916
Compare
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.
Closes #23996
Description
Every remote write built a new api client, and influx-cli's
NewAPIConfigcloneshttp.DefaultTransportper call. Go pools connections perTransport, so none was ever reused: each write performed a fresh DNS lookup, TCP and TLS handshake, and left an idle connection open for ~90s. While draining a backlog after a remote outage this exhausts the file descriptor limit (too many open files), and in steady state more than half of each stream's bytes on the wire were connection setup (see the analysis in #23996).PostWritenow swaps in one of two package-level transports (TLS verification on/off, the only per-stream setting aTransportcarries). Connections are pooled across all replication streams and the validator path. The api client itself is still built per call; it is cheap and holds no connections.Testing
TestWrite_ReusesConnectionscounts server-side new TCP connections over 10 writes. Pre-fix: 10. Post-fix: 1. Also verifies a remote URL change opens exactly one connection to the new remote.go test -race ./replications/...passes.Severity
Recommend upgrade for users of replication streams, especially over metered or high-latency links.
Note for reviewers
Semantic type: Fix. Supersedes #23997 (which closed idle connections after each write instead of reusing them).