mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 15:35:55 +03:00
[PR #921] [CLOSED] Call LREM with count=1 on the active queue item #2937
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#2937
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/921
Author: @pior
Created: 10/14/2024
Status: ❌ Closed
Base:
master← Head:lrem-1📝 Commits (1)
e0ab52eCall LREM with count=-1 on the active queue item📊 Changes
1 file changed (+7 additions, -7 deletions)
View changed files
📝
internal/rdb/rdb.go(+7 -7)📄 Description
When a task is done, marked as completed, archived or requeued, it is removed from the
activelist in Redis.This operation is done by a
LREMoperation withcount = 0(remove all elements matching the value).For 100 concurrently active tasks or so,
LREMis not an issue.For 1000 concurrent active tasks or more, the
O(N+M)complexity of LREM seems to become a significant waste of Redis cpu time.It represents almost 50% of the the Redis CPU time in some of our queues.
Note: we plan to test this change in a realistic environment, which is why the PR is in Draft.
Issue: https://github.com/hibiken/asynq/issues/389
Solution
Change the LREM count parameter from 0 to -1 (deletes up to 1 element, starting from the tail, doc).
Tasks pushed with RPOPLPUSH should generally be at the tail when they are done/completed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.