Skip to content

priority: implement changes to child policy caching specified in A115#8997

Merged
easwars merged 3 commits into
grpc:masterfrom
easwars:disable_priority_lb_cache
Mar 23, 2026
Merged

priority: implement changes to child policy caching specified in A115#8997
easwars merged 3 commits into
grpc:masterfrom
easwars:disable_priority_lb_cache

Conversation

@easwars

@easwars easwars commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary of changes:

  • Add a new API to the balancergroup that allows removal of child policies with immediate effect, even when a cache is configured.
  • Make the priority LB use this new API when removing child policies that have been removed from its configuration.
    • This change is protected with an environment variable that turns on the new behavior by default.
  • Update the name generation algorithm to give higher preference to reuse names of existing priority (if there is a locality match) over lower priorities.
  • Fix a bunch of tests in the priority LB policy to ensure that they work with the old and new behavior.
  • Fix a couple of aggregate cluster tests such that they don't continuously handle the same NACKed resource from the management server.
  • Other minor cleanups in tests that I had to look at as part of making this change.

RELEASE NOTES:

  • xds/priority: Stop caching child LB policies removed from the configuration. This will help reduce memory and cpu usage when localities are constantly switching between priorities.

@easwars easwars force-pushed the disable_priority_lb_cache branch from 178649d to 0c5ef20 Compare March 23, 2026 04:15
@codecov

codecov Bot commented Mar 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.01%. Comparing base (12e91dd) to head (c1bcadd).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
internal/balancergroup/balancergroup.go 90.90% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8997      +/-   ##
==========================================
- Coverage   83.04%   83.01%   -0.04%     
==========================================
  Files         411      411              
  Lines       32892    32917      +25     
==========================================
+ Hits        27316    27326      +10     
- Misses       4181     4193      +12     
- Partials     1395     1398       +3     
Files with missing lines Coverage Δ
internal/envconfig/envconfig.go 100.00% <ø> (ø)
...ds/balancer/cdsbalancer/configbuilder_childname.go 100.00% <100.00%> (ø)
internal/xds/balancer/priority/balancer.go 84.48% <100.00%> (ø)
internal/xds/balancer/priority/balancer_child.go 91.78% <100.00%> (+0.35%) ⬆️
...nternal/xds/balancer/priority/balancer_priority.go 73.33% <100.00%> (ø)
internal/balancergroup/balancergroup.go 84.65% <90.90%> (-1.83%) ⬇️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars easwars requested a review from dfawley March 23, 2026 20:48
@easwars easwars added Type: Behavior Change Behavior changes not categorized as bugs Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Mar 23, 2026
@easwars easwars added this to the 1.80 Release milestone Mar 23, 2026
@easwars easwars marked this pull request as ready for review March 23, 2026 20:49
@dfawley

dfawley commented Mar 23, 2026

Copy link
Copy Markdown
Member

Add a new API to the balancergroup that allows removal of child policies with immediate effect, even when a cache is configured.

Why not just clear Options.SubBalancerCloseTimeout?

@dfawley

dfawley commented Mar 23, 2026

Copy link
Copy Markdown
Member

Why not just clear Options.SubBalancerCloseTimeout?

Oh, it's because we still want to cache lower priority children for awhile?

@dfawley dfawley assigned easwars and unassigned dfawley Mar 23, 2026
@easwars

easwars commented Mar 23, 2026

Copy link
Copy Markdown
Contributor Author

Why not just clear Options.SubBalancerCloseTimeout?

Oh, it's because we still want to cache lower priority children for awhile?

Yes. That is what we decided. The original gRFC had two cases where we would cache the child. We are only eliminating one of them as part of A115.

@easwars easwars merged commit ccc8d7b into grpc:master Mar 23, 2026
15 of 18 checks passed
easwars added a commit to easwars/grpc-go that referenced this pull request Mar 30, 2026
…grpc#8997)

Summary of changes:
- Add a new API to the `balancergroup` that allows removal of child
policies with immediate effect, even when a cache is configured.
- Make the `priority` LB use this new API when removing child policies
that have been removed from its configuration.
- This change is protected with an environment variable that turns on
the new behavior by default.
- Update the name generation algorithm to give higher preference to
reuse names of existing priority (if there is a locality match) over
lower priorities.
- Fix a bunch of tests in the `priority` LB policy to ensure that they
work with the *old* and *new* behavior.
- Fix a couple of aggregate cluster tests such that they don't
continuously handle the same NACKed resource from the management server.
- Other minor cleanups in tests that I had to look at as part of making
this change.

RELEASE NOTES:
* xds/priority: Stop caching child LB policies removed from the
configuration. This will help reduce memory and cpu usage when
localities are constantly switching between priorities.
arjan-bal pushed a commit that referenced this pull request Mar 31, 2026
Original PR: #8997

RELEASE NOTES:
* xds/priority: Stop caching child LB policies removed from the
configuration. This will help reduce memory and cpu usage when
localities are constantly switching between priorities.
goingforstudying-ctrl added a commit to goingforstudying-ctrl/grpc-go that referenced this pull request Jun 21, 2026
…grpc#8997)

Summary of changes:
- Add a new API to the `balancergroup` that allows removal of child
policies with immediate effect, even when a cache is configured.
- Make the `priority` LB use this new API when removing child policies
that have been removed from its configuration.
- This change is protected with an environment variable that turns on
the new behavior by default.
- Update the name generation algorithm to give higher preference to
reuse names of existing priority (if there is a locality match) over
lower priorities.
- Fix a bunch of tests in the `priority` LB policy to ensure that they
work with the *old* and *new* behavior.
- Fix a couple of aggregate cluster tests such that they don't
continuously handle the same NACKed resource from the management server.
- Other minor cleanups in tests that I had to look at as part of making
this change.

RELEASE NOTES:
* xds/priority: Stop caching child LB policies removed from the
configuration. This will help reduce memory and cpu usage when
localities are constantly switching between priorities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Behavior Change Behavior changes not categorized as bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants