Skip to content

Fix wft poll balancing with maxpoll=2#941

Merged
Sushisource merged 2 commits intomasterfrom
fix-no-sticky-pollers
Jun 24, 2025
Merged

Fix wft poll balancing with maxpoll=2#941
Sushisource merged 2 commits intomasterfrom
fix-no-sticky-pollers

Conversation

@mjameswh
Copy link
Copy Markdown
Contributor

What was changed

Fix a bug that prevented PollWorkflowTaskQueue to the sticky task queue if workflow_task_poller_behavior = PollerBehavior::SimpleMaximum(2). This was resulting in slower performance, and would cause "sticky worker unavailable, please use original task queue." error messages on the server.

@mjameswh mjameswh requested a review from a team as a code owner June 20, 2025 23:33
if both_are_zero {
let num_sticky_backlog = *sticky_backlog.borrow_and_update();

let allow = || {
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.

This could avoid being a closure by using else-ifs... but I don't have a firm position on if that's more readable or not.

Comment on lines +154 to +155
// Just balance the two poller types.
// FIXME: Do we need anything more here, to ensure proper balancing?
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.

Go effectively just forces there to be an even amount of both kinds of pending requests, except always favoring sticky during a backlog, and when counts are even: https://github.com/temporalio/sdk-go/blob/9682a692145f503a02b73f32435cb04bdc6f57c1/internal/internal_task_pollers.go#L782

We already are favoring it with a backlog. It's not obvious to me that just making an even amount is the best move either, but, it is what Core used to do and clearly it at least works, so we could go with that.

@Sushisource Sushisource enabled auto-merge (squash) June 24, 2025 20:17
@Sushisource Sushisource merged commit 6560876 into master Jun 24, 2025
28 of 31 checks passed
@Sushisource Sushisource deleted the fix-no-sticky-pollers branch June 24, 2025 20:36
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