Skip to content

coalesce updates to reduce intermediate updates#7328

Merged
zirain merged 8 commits intoenvoyproxy:mainfrom
zhaohuabing:coalesce-updates
Oct 29, 2025
Merged

coalesce updates to reduce intermediate updates#7328
zirain merged 8 commits intoenvoyproxy:mainfrom
zhaohuabing:coalesce-updates

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Oct 24, 2025

fix: #7308

In my test setup, I added a 5-second sleep to mimic a slow process, and then rolled out the backend deployment from 1 to 100 replicas. The result looks good:

2025-10-24T10:10:11.791Z	INFO	watchable	message/watchutil.go:144	coalesced updates	{"runner": "gateway-api", "count": 1, "before": 81}
2025-10-24T10:10:16.239Z	INFO	watchable	message/watchutil.go:144	coalesced updates	{"runner": "gateway-api", "count": 1, "before": 10}

@zhaohuabing zhaohuabing requested a review from a team as a code owner October 24, 2025 08:24
@zhaohuabing zhaohuabing marked this pull request as draft October 24, 2025 08:25
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.08%. Comparing base (f133f5e) to head (b1a7508).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7328      +/-   ##
==========================================
+ Coverage   72.06%   72.08%   +0.01%     
==========================================
  Files         230      230              
  Lines       33404    33424      +20     
==========================================
+ Hits        24074    24095      +21     
  Misses       7583     7583              
+ Partials     1747     1746       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhaohuabing zhaohuabing marked this pull request as ready for review October 24, 2025 09:37
@zhaohuabing zhaohuabing changed the title coalesce updates to reduce redundant processing in subscription handler coalesce updates to reduce intermediate updates Oct 24, 2025
@zhaohuabing zhaohuabing force-pushed the coalesce-updates branch 2 times, most recently from f15c2e7 to 22ee4fe Compare October 24, 2025 09:50
@zhaohuabing zhaohuabing force-pushed the coalesce-updates branch 3 times, most recently from 656ba3e to b63f8e2 Compare October 27, 2025 02:07
jukie
jukie previously approved these changes Oct 27, 2025
jukie
jukie previously approved these changes Oct 27, 2025
@zhaohuabing zhaohuabing force-pushed the coalesce-updates branch 2 times, most recently from dc727be to d7bc432 Compare October 28, 2025 05:08
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as ready for review October 29, 2025 00:08
Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@arkodg arkodg added this to the v1.6.0 Milestone milestone Oct 29, 2025
@zirain zirain merged commit de2f8f3 into envoyproxy:main Oct 29, 2025
53 of 55 checks passed
@zhaohuabing zhaohuabing deleted the coalesce-updates branch October 29, 2025 06:43
zirain pushed a commit to zirain/gateway that referenced this pull request Nov 14, 2025
* coalesce updates to reduce redundant processing in subscription handler

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain order

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* keep intermediate delete updates

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* minor wording

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* treat delete as normal operations

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain the original order of the last updates for each key

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
zirain added a commit that referenced this pull request Nov 14, 2025
* fix: bug in overlap detection of cert SANs (#7234)

Signed-off-by: zirain <zirain2009@gmail.com>

* fix(translator): Fix panic with request mirror + grpcroute (#6875)

Signed-off-by: Andrew Moreland <andy@andymoreland.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix: watch change for the ca cert in the Backend (#7294)

* watch change for the ca cert in the Backend

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix ipFamily not set in UDPListener (#7313)

fix: set ipfamily in udpistener (#7312)

Signed-off-by: cong <q1875486458@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* coalesce updates to reduce intermediate updates (#7328)

* coalesce updates to reduce redundant processing in subscription handler

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain order

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* keep intermediate delete updates

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* minor wording

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* treat delete as normal operations

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain the original order of the last updates for each key

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix: port typo (#7397)

Signed-off-by: cong <q1875486458@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix: validate EnvoyGateway configuration before reload (#7412)

Signed-off-by: zirain <zirain2009@gmail.com>

* fix: missing  jwt provider when jwt is configured on multiple listeners sharing the same port (#7337)

* fix jwt provider missing when jwt is configured at multiple ir listeners

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix: memory leak (#7429)

Fix memory leak.

Two watchable.Maps were never closed when shutting down the provider:
- GatewayClassStatuses.Close() - missing in GatewayAPIStatuses.Close()
- BackendTrafficPolicyStatuses.Close() - missing in PolicyStatuses.Close()

Each unclosed map leaked 3 goroutines:
1. Internal watchable.Map.coalesce goroutine
2. HandleSubscription goroutine blocked on channel read
3. Error handler goroutine blocked on channel read

Signed-off-by: Gonzalo Serrano <boikot@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* fix gen after cherry-pick

Signed-off-by: zirain <zirain2009@gmail.com>

* fix watchutil test

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: Andrew Moreland <andy@andymoreland.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: cong <q1875486458@gmail.com>
Signed-off-by: Gonzalo Serrano <boikot@gmail.com>
Co-authored-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
Co-authored-by: Andrew Moreland <andy@andymo.org>
Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Co-authored-by: 聪 <q1875486458@gmail.com>
Co-authored-by: Gonzalo Serrano <boikot@gmail.com>
shawnh2 pushed a commit to shawnh2/gateway that referenced this pull request Nov 19, 2025
* coalesce updates to reduce redundant processing in subscription handler

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain order

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* keep intermediate delete updates

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* minor wording

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* treat delete as normal operations

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* retain the original order of the last updates for each key

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: sh2 <shawnhxh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coalesce intermediate updates in subscriber queue

4 participants