Skip to content

Deduplicate poll cancellation RPCs by destination host#10230

Merged
rkannan82 merged 4 commits into
mainfrom
kannan/batch-poll-cancel-by-host
May 13, 2026
Merged

Deduplicate poll cancellation RPCs by destination host#10230
rkannan82 merged 4 commits into
mainfrom
kannan/batch-poll-cancel-by-host

Conversation

@rkannan82
Copy link
Copy Markdown
Contributor

@rkannan82 rkannan82 commented May 12, 2026

What

Deduplicates CancelOutstandingWorkerPolls RPCs by destination matching host during ShutdownWorker. Uses Route() on the matching client to determine which host each partition maps to, then sends only one RPC per unique host instead of one per partition.

Why

With N partitions across H matching hosts (H << N), the current code sends N RPCs per task type when H would suffice — the RPC cancels all pollers for the workerInstanceKey on the target host regardless of which partition was used for routing.

How did you test it?

Unit test

🤖 Generated with Claude Code

When ShutdownWorker fans out CancelOutstandingWorkerPolls to all partitions,
multiple partitions may route to the same matching host. Since the RPC cancels
all pollers for the workerInstanceKey on the target host regardless of partition,
redundant RPCs are wasted. Use Route() to deduplicate by host, reducing RPCs
from numPartitions to numHosts per task type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 force-pushed the kannan/batch-poll-cancel-by-host branch 2 times, most recently from e3cf9cd to 3260c43 Compare May 12, 2026 18:15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 force-pushed the kannan/batch-poll-cancel-by-host branch from 3260c43 to 9865b93 Compare May 12, 2026 18:18
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 requested a review from dnr May 12, 2026 18:21
@rkannan82 rkannan82 marked this pull request as ready for review May 12, 2026 18:21
@rkannan82 rkannan82 requested review from a team as code owners May 12, 2026 18:21
@rkannan82 rkannan82 requested a review from ShahabT May 12, 2026 18:22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 merged commit 560f8b8 into main May 13, 2026
48 checks passed
@rkannan82 rkannan82 deleted the kannan/batch-poll-cancel-by-host branch May 13, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants