feat(scheduling): add soft task and group concurrency - #17
Merged
Merged
Conversation
psteinroe
added this pull request to stack #25
September 15, 2026 03:35
psteinroe
force-pushed
the
feat/soft-concurrency
branch
10 times, most recently
from
September 15, 2026 05:02
534b688 to
7e3838b
Compare
psteinroe
removed this pull request from stack #25
September 15, 2026 11:41
psteinroe
force-pushed
the
feat/soft-concurrency
branch
2 times, most recently
from
September 15, 2026 13:26
fe8c04a to
d9847c5
Compare
psteinroe
added this pull request to stack #27
September 15, 2026 13:27
psteinroe
force-pushed
the
feat/soft-concurrency
branch
from
September 15, 2026 13:41
d9847c5 to
57e3d55
Compare
psteinroe
force-pushed
the
feat/soft-concurrency
branch
from
September 15, 2026 13:43
57e3d55 to
f6fa04a
Compare
psteinroe
force-pushed
the
feat/soft-concurrency
branch
4 times, most recently
from
September 15, 2026 14:06
276b56d to
dceeb87
Compare
psteinroe
force-pushed
the
feat/soft-concurrency
branch
4 times, most recently
from
September 18, 2026 09:32
22c50bd to
59ca720
Compare
psteinroe
force-pushed
the
feat/soft-concurrency
branch
from
September 18, 2026 12:06
59ca720 to
a127ed3
Compare
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.
Replace hard concurrency slots with database-coordinated soft task and group limits.
Workers count active executions while claiming with
FOR UPDATE SKIP LOCKED. Concurrent claim transactions may temporarily overshoot a configured limit; no slot or semaphore rows are maintained.groupConcurrencyapplies independently within each populated(queue, task, group)scope, while ungrouped work bypasses the group limit.Claim performance
The claim path now follows the bounded candidate pattern used by pg-boss, Graphile Worker, River, and Oban: it locks an ordered batch before applying task/group window ranking, instead of ranking the entire ready backlog. It materializes active executions once, skips saturated tasks and groups before locking, and uses a database-derived no-limit fast path so rolling workers cannot bypass newly configured limits. A covering partial index supports both task and group active counts.
With 1,000,000 ready executions and a batch size of 50, median claim latency dropped from 6,138 ms to 45 ms without limits, from 5,570 ms to 48 ms with a saturated group, and from 5,333 ms to 35 ms with a saturated task. A hot group can intentionally underfill one claim because ranking is bounded; the next poll excludes the now-saturated group and continues through eligible work.
Related consistency changes:
(id, queue, locked_by)without requiring the duplicated task key;Closes #12