Skip to content

Add proposal for configurable upstream connect timeout (#4327) - #137

Merged
k-wall merged 3 commits into
kroxylicious:mainfrom
AdityaThakur1998:design-proposal-#4327
Oct 5, 2026
Merged

k-wall merged 3 commits into
kroxylicious:mainfrom
AdityaThakur1998:design-proposal-#4327

Conversation

@AdityaThakur1998

@AdityaThakur1998 AdityaThakur1998 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Design proposal for kroxylicious/kroxylicious#4327 — making the upstream connect
timeout configurable.

What it proposes

A connectTimeout key on ClusterDefinition, carried into TargetCluster and
applied to the proxy's upstream connections. Netty's existing 30-second default
is retained when the key is unset, so the change is purely additive.

Kroxylicious sets no connect timeout today, so Netty's own default of 30 seconds
governs every deployment, invisibly and with no way to change it. The proposal is
about taking control of a bound already in force rather than introducing one.

Why it matters

An upstream address that silently drops packets — a firewall or security group
configured to DROP, a dead host whose address still routes — costs the full 30
seconds. A refused connection costs about one round trip, which is why this has
gone unnoticed.

The proxy dials one address per downstream connection and does not retry, so
progress past a bad address depends on the client reconnecting. Measured with an
AdminClient on default timeouts: one bad address ahead of a working broker
succeeded in 30.7s; three failed outright at 60.4s, the client's own budget
exhausted before the round robin reached a broker that would have answered. At a
2-second timeout the same cases took 2.7s and 7.1s, both succeeding.

The key serves the opposite need too — operators on high-latency links or in test
environments have hit the reverse problem, where 30 seconds is too short.

Points reviewers may want to weigh in on

  • The key name. connectTimeout is provisional.
  • Scope. DNS resolution, operator/CRD exposure, Kafka-style escalation and
    jitter are non-goals. Intra-connection failover across the bootstrap list is
    listed as a future extension and probably wants its own issue.
  • Not exposing the key on the deprecated targetCluster form, which is
    slated for removal under #4462 in the same release.

Assisted-by: Claude-Opus-5 [email protected]

@AdityaThakur1998
AdityaThakur1998 marked this pull request as ready for review September 14, 2026 17:49
@AdityaThakur1998
AdityaThakur1998 requested a review from a team as a code owner September 14, 2026 17:49
Comment thread proposals/137-configurable-upstream-connect-timeout.md Outdated
Proposes a connectTimeout key on ClusterDefinition to replace Netty's
invisible 30s default with an operator-controlled, 10s-default bound
on upstream TCP connects.

Assisted-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: AdityaThakur1998 <[email protected]>
…0s default

PR comments flagged that existing deployments may depend on the current 30-second bound in slow-network environments, and that some test environments need it raised rather than lowered. Accept the feedback and make the whole proposal additive-only:

- Netty's 30s default is retained; connectTimeout only changes behaviour when explicitly set, in either direction.
- Motivation now covers both directions: shortening the wait against a blackholed address, or lengthening it past 30s for slow links/test environments.
- Reworked the SYN-retransmission reasoning: Linux's schedule runs to 15s, not just 1s/3s, which rules out a flat 10s default rather than justifying one.
- Compatibility collapses to a single additive-key paragraph; the targetCluster no-opt-out caveat no longer applies.
- Rejected alternatives: replaced "leave the default and only add configurability" (now the accepted design) with "lower the default" (rejected).

Update the proposal now that the ClusterDefinition selection-strategy work has landed:

- Rename resolveSelectionStrategy()/resolveConnectTimeout() references to the landed effectiveSelectionStrategy() and the matching proposed effectiveConnectTimeout().
- Tighten wording on where resolution lives: ClusterDefinition holds and hands off the field, only TargetCluster resolves it.
- Separate the two precedents cited for the compact constructor: #4840 (PR #4891) for threading a nullable component through toTargetCluster(), NettySettings for rejecting a negative duration.
- Update the #4840 reference from unmerged to landed.

Signed-off-by: AdityaThakur1998 <[email protected]>
Assisted-By: Claude Sonnet 5 <[email protected]>

@MarkNSweep MarkNSweep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two comments looking to avoid the proposal going stale as the code base evolves.

Comment thread proposals/137-configurable-upstream-connect-timeout.md Outdated
Comment thread proposals/137-configurable-upstream-connect-timeout.md Outdated
Comment thread proposals/137-configurable-upstream-connect-timeout.md

@k-wall k-wall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Non-blocking feedback - I think this proposal is a bit lengthy. I think you could cut quite a lot of text from the proposal without sacrificing the important points - the public API and the behaviour of the client/proxy/server as a whole. LLMs can be really verbose - that costs reviewers time.

@AdityaThakur1998

Copy link
Copy Markdown
Contributor Author

LGTM.

Non-blocking feedback - I think this proposal is a bit lengthy. I think you could cut quite a lot of text from the proposal without sacrificing the important points - the public API and the behaviour of the client/proxy/server as a whole. LLMs can be really verbose - that costs reviewers time.

Thanks for the feedback everyone. I also think that proposal is a bit lengthy. I really need to configure output style of Claude code for design proposals

@robobario robobario left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @AdityaThakur1998

- Rewrite proposal for conciseness without losing meaning
- Remove trailing cross-reference in rejected-alternatives section

Signed-off-by: AdityaThakur1998 <[email protected]>
Assisted-By: Claude Sonnet 4.6 (1M context) <[email protected]>
one already in that suite.
The existing `ResilienceIT` bootstrap test does not cover this path: its fake servers accept the TCP
connection before closing it, so the connect succeeds and the timeout is never reached. A regression
test needs an address that accepts no connection at all — a non-routable or firewalled address —

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 240.0.0.0/4 help?

@k-wall k-wall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@k-wall
k-wall merged commit e12b632 into kroxylicious:main Oct 5, 2026
2 checks passed
k-wall pushed a commit to k-wall/design that referenced this pull request Oct 9, 2026
…licious#137)

* Add proposal for configurable upstream connect timeout (#4327)

Proposes a connectTimeout key on ClusterDefinition to replace Netty's
invisible 30s default with an operator-controlled, 10s-default bound
on upstream TCP connects.

Assisted-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: AdityaThakur1998 <[email protected]>

* Revise upstream connect timeout proposal per review: retain Netty's 30s default

PR comments flagged that existing deployments may depend on the current 30-second bound in slow-network environments, and that some test environments need it raised rather than lowered. Accept the feedback and make the whole proposal additive-only:

- Netty's 30s default is retained; connectTimeout only changes behaviour when explicitly set, in either direction.
- Motivation now covers both directions: shortening the wait against a blackholed address, or lengthening it past 30s for slow links/test environments.
- Reworked the SYN-retransmission reasoning: Linux's schedule runs to 15s, not just 1s/3s, which rules out a flat 10s default rather than justifying one.
- Compatibility collapses to a single additive-key paragraph; the targetCluster no-opt-out caveat no longer applies.
- Rejected alternatives: replaced "leave the default and only add configurability" (now the accepted design) with "lower the default" (rejected).

Update the proposal now that the ClusterDefinition selection-strategy work has landed:

- Rename resolveSelectionStrategy()/resolveConnectTimeout() references to the landed effectiveSelectionStrategy() and the matching proposed effectiveConnectTimeout().
- Tighten wording on where resolution lives: ClusterDefinition holds and hands off the field, only TargetCluster resolves it.
- Separate the two precedents cited for the compact constructor: #4840 (PR #4891) for threading a nullable component through toTargetCluster(), NettySettings for rejecting a negative duration.
- Update the #4840 reference from unmerged to landed.

Signed-off-by: AdityaThakur1998 <[email protected]>
Assisted-By: Claude Sonnet 5 <[email protected]>

* Revise upstream connect timeout proposal: address review comments

- Rewrite proposal for conciseness without losing meaning
- Remove trailing cross-reference in rejected-alternatives section

Signed-off-by: AdityaThakur1998 <[email protected]>
Assisted-By: Claude Sonnet 4.6 (1M context) <[email protected]>

---------

Signed-off-by: AdityaThakur1998 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants