Skip to content

Add jitter to matching long poll deadlines#10161

Open
baekgyu-kim wants to merge 2 commits intotemporalio:mainfrom
baekgyu-kim:6843
Open

Add jitter to matching long poll deadlines#10161
baekgyu-kim wants to merge 2 commits intotemporalio:mainfrom
baekgyu-kim:6843

Conversation

@baekgyu-kim
Copy link
Copy Markdown

@baekgyu-kim baekgyu-kim commented May 2, 2026

What changed?

Added up to 5% jitter to Matching long poll deadlines so empty long polls do not all expire at the same time after mass poll cancellation.
Fixes #6843.

Why?

When many long polls are cancelled or expire together, SDK workers can retry in alignment and create a synchronized polling burst. Subtracting a small randomized amount from the Matching long poll timeout spreads those retries while preserving the existing deadline buffer behavior.

How did you test it?

  • built
    • Ran make bins and built all server/tool binaries successfully.
  • run locally and tested manually
    • Started the server with make start and verified namespace/cluster health via Temporal CLI.
  • covered by existing tests
    • Ran existing Matching empty-poll tests for workflow and activity task queues.
  • added new unit test(s)
    • Added TestJitteredLongPollTimeout for deterministic jitter timeout calculation coverage.
  • added new functional test(s)

Potential risks

The effective long poll timeout can be shortened by up to 5%. The jitter is bounded and does not change the existing returnEmptyTaskTimeBudget deadline buffer.

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.

Add small jitter timeout to the long poll empty response

1 participant