mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-25 23:15:51 +03:00
[PR #868] [MERGED] Add jitter on the processor fetch backoff sleep #901
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#901
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hibiken/asynq/pull/868
Author: @pior
Created: 4/22/2024
Status: ✅ Merged
Merged: 10/19/2024
Merged by: @kamikazechaser
Base:
master← Head:jitter📝 Commits (1)
61d5816Add jitter on the processor fetch backoff sleep📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
processor.go(+2 -1)📄 Description
Changes
This PR adds some jitter to the backoff sleep of the processor fetch loop to avoid workers synchronization, and thus improve worker efficiency and job latency.
Context
We run dozens of workers, with an execution rate of up to 5K jobs/sec.
We started to suspect that the job workers were significantly inefficient.
Changing the TaskCheckInterval from 1s (default) to 100ms has reduced the latency from ~500ms to 40ms on a high traffic worker pool, and 10ms to a low traffic worker pool.
Then, adding the jitter has further reduced the latency to 2 ms on both high and low traffic worker pool.
Synchronization on a distributed system is well known, and adding jitter helped avoid it.
Impact of adding a jitter: Queue size:

Latency:

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.