Add Task Queue Priority and Fairness sample#466
Open
sivagirish81 wants to merge 2 commits into
Open
Conversation
sivagirish81
commented
May 7, 2026
| - `FairnessKey` groups work by tenant within a priority level. Every Activity Task in this sample uses its tenant ID as a non-empty fairness key. | ||
| - `FairnessWeight` gives `premium-media` a larger proportional share while it has backlog. The premium tenant uses `FairnessWeight=3.0`; regular tenants use `FairnessWeight=1.0`. | ||
|
|
||
| Priority determines which priority sub-queue Tasks go into. Fairness determines ordering within a given priority level. Fairness ordering is probabilistic and observational, so the exact order can vary between runs. |
Author
There was a problem hiding this comment.
I think I need to change up this wording as it is misleading
Suggested change
| Priority determines which priority sub-queue Tasks go into. Fairness determines ordering within a given priority level. Fairness ordering is probabilistic and observational, so the exact order can vary between runs. | |
| Priority determines which priority sub-queue Tasks go into. Within a priority level, Fairness selects among fairness-key virtual queues using weighted, probabilistic dispatch. Tasks with the same fairness key are still dispatched FIFO, but the interleaving between different fairness keys is not a deterministic row-by-row sequence and can vary between runs. |
sivagirish81
commented
May 7, 2026
| `premium-media` should appear repeatedly near the front of normal-priority | ||
| dispatch while it still has backlog. | ||
|
|
||
| Fairness is probabilistic, so exact row-by-row ordering can vary between runs. |
Author
There was a problem hiding this comment.
This one as well.
Suggested change
| Fairness is probabilistic, so exact row-by-row ordering can vary between runs. | |
| Fairness uses weighted, probabilistic dispatch across fairness keys, so this sample validates expected weighted/proportional patterns rather than an exact row-by-row sequence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
This PR adds a new Go SDK sample:
task-queue-priority-fairness.Why?
Temporal users need a concrete, runnable sample showing how Task Queue Priority and Fairness work together in a shared multi-tenant queue:
urgentbeforenormal/background)premium-mediagets a larger share while backlogged)Checklist