Skip to content

Conncetiion, ConcurrentRequests, PendingRequest limits#23396

Merged
LakshmiNarayananDesikan merged 7 commits intomainfrom
api-gateway/connection-concurrentRequest-pendingRequestLimits
Apr 14, 2026
Merged

Conncetiion, ConcurrentRequests, PendingRequest limits#23396
LakshmiNarayananDesikan merged 7 commits intomainfrom
api-gateway/connection-concurrentRequest-pendingRequestLimits

Conversation

@LakshmiNarayananDesikan
Copy link
Copy Markdown
Contributor

Description

Testing & Reproduction steps

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@LakshmiNarayananDesikan LakshmiNarayananDesikan added the pr/no-changelog PR does not need a corresponding .changelog entry label Mar 30, 2026
@LakshmiNarayananDesikan LakshmiNarayananDesikan requested review from a team as code owners March 30, 2026 06:54
@github-actions github-actions Bot added theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support labels Mar 30, 2026
@LakshmiNarayananDesikan LakshmiNarayananDesikan force-pushed the api-gateway/connection-concurrentRequest-pendingRequestLimits branch from 74ab68a to 229fd3d Compare March 31, 2026 06:54
Comment thread agent/proxycfg/api_gateway.go Outdated
upstreams := make(map[APIGatewayListenerKey]structs.Upstreams)

var defaultLimits *structs.UpstreamLimits
if snap.APIGateway.GatewayConfig != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

snap can also be nil.

Copy link
Copy Markdown
Contributor Author

@LakshmiNarayananDesikan LakshmiNarayananDesikan Apr 8, 2026

Choose a reason for hiding this comment

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

Snap is initialized with defaults, It can not be nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the scope of this method, it can be nil. If we call this method somewhere else and that passes nil, there will be a panic.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it will not be nil, all handling is initialized after snapshot is initialized in the lifecycle handled by a proxycfg , manager. This comment can be ignored.

Comment thread agent/proxycfg/api_gateway.go Outdated
upstreams := make(map[APIGatewayListenerKey]structs.Upstreams)

var defaultLimits *structs.UpstreamLimits
if snap.APIGateway.GatewayConfig != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the scope of this method, it can be nil. If we call this method somewhere else and that passes nil, there will be a panic.

sreeram77
sreeram77 previously approved these changes Apr 10, 2026
Comment thread agent/xds/clusters.go
var clusters []proto.Message
createdClusters := make(map[proxycfg.UpstreamID]bool)
readyListeners := getReadyListeners(cfgSnap)
mergedLimitsByUID := make(map[proxycfg.UpstreamID]*structs.UpstreamLimits)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need 2 loops one for merging limits . another for config . can we have duplicate upstreams which are already generated in api_gateway.go .

readyListeners is prepared/populated in the API gateway proxycfg pipeline (proxycfg/api_gateway.go) and then consumed later in cluster construction.

So in the clusters.go loop:

  • it is iterating over a structure already assembled upstream in api_gateway.go,
  • each readyListener carries the resolved/attached upstreams for that listener,
  • cluster generation is using that prepared state rather than discovering listeners/upstreams itself.

my intuition says: if limits were already fully merged into the listener/upstream state in api_gateway.go, then clusters.go should only need to read/apply them (unless it has extra cluster-stage merge precedence).

upstream is created at service name level and uid here is created for cluster naming. Can you check the difference and reduce the merge here .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

readyListeners is intentionally route/listener is built for listener-level xDS assembly, not for unique upstream identity, so duplicates by upstream UID are expected.
cluster stage must remove duplicates and keep one final item per UID and apply merged limit precedence.

Comment thread agent/proxycfg/api_gateway.go Outdated
upstreams := make(map[APIGatewayListenerKey]structs.Upstreams)

var defaultLimits *structs.UpstreamLimits
if snap.APIGateway.GatewayConfig != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it will not be nil, all handling is initialized after snapshot is initialized in the lifecycle handled by a proxycfg , manager. This comment can be ignored.

Comment thread agent/xds/clusters.go
var clusters []proto.Message
createdClusters := make(map[proxycfg.UpstreamID]bool)
readyListeners := getReadyListeners(cfgSnap)
mergedLimitsByUID := make(map[proxycfg.UpstreamID]*structs.UpstreamLimits)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need 2 loops one for merging limits . another for config . can we have duplicate upstreams which are already generated in api_gateway.go .

readyListeners is prepared/populated in the API gateway proxycfg pipeline (proxycfg/api_gateway.go) and then consumed later in cluster construction.

So in the clusters.go loop:

  • it is iterating over a structure already assembled upstream in api_gateway.go,
  • each readyListener carries the resolved/attached upstreams for that listener,
  • cluster generation is using that prepared state rather than discovering listeners/upstreams itself.

my intuition says: if limits were already fully merged into the listener/upstream state in api_gateway.go, then clusters.go should only need to read/apply them (unless it has extra cluster-stage merge precedence).

upstream is created at service name level and uid here is created for cluster naming. Can you check the difference and reduce the merge here .

anandmukul93
anandmukul93 previously approved these changes Apr 13, 2026
@LakshmiNarayananDesikan LakshmiNarayananDesikan force-pushed the api-gateway/connection-concurrentRequest-pendingRequestLimits branch from 26cc7a5 to 2b4a037 Compare April 14, 2026 06:53
@LakshmiNarayananDesikan LakshmiNarayananDesikan removed the pr/no-changelog PR does not need a corresponding .changelog entry label Apr 14, 2026
@LakshmiNarayananDesikan LakshmiNarayananDesikan enabled auto-merge (squash) April 14, 2026 07:45
@LakshmiNarayananDesikan LakshmiNarayananDesikan merged commit 25e8c07 into main Apr 14, 2026
144 of 148 checks passed
@LakshmiNarayananDesikan LakshmiNarayananDesikan added backport/all Apply backports for all active releases per .release/versions.hcl backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.21 changes are backported to 1.21 ent backport/1.22 Changes are backported to 1.22 backport/ent/1.22 Changes are backported to 1.22 ent and removed pr/no-backport labels Apr 14, 2026
@LakshmiNarayananDesikan LakshmiNarayananDesikan removed backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.21 changes are backported to 1.21 ent backport/1.22 Changes are backported to 1.22 backport/ent/1.22 Changes are backported to 1.22 ent labels Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/all Apply backports for all active releases per .release/versions.hcl theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants