Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce worker idle queries #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Reduce worker idle queries #177

wants to merge 1 commit into from

Conversation

thomasst
Copy link
Member

@thomasst thomasst commented Feb 16, 2021

This reduces Redis ops with N idle workers from from 6 + 4 * (N-1) to 7 + 1 * (N-1) per second.

For example, if 100 workers are idle, Redis queries would be reduced from 402 down to 106 per second.

@thomasst thomasst self-assigned this Feb 16, 2021
Copy link
Member

@jkemp101 jkemp101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine. Would probably want to do a test with a bunch of scheduled queues to see what performance improvement it makes to make sure we understand how this helps.

# one Redis query to enter this block since every single worker calls
# this every second.
# XXX: Ideally, we should keep track of workers and take turns.
key = self._key("lock", "secondary_tasks")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to single quotes

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.

2 participants