Skip to content

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
@thomasst thomasst requested a review from jkemp101 February 16, 2021 20:33
@thomasst thomasst force-pushed the reduce-idle-activity branch from 5d9afc3 to 1e376f4 Compare February 16, 2021 21:55
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.

3 participants