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

Add max_requests_jitter configuration option. #862

Closed
wants to merge 2 commits into from

Conversation

alienth
Copy link
Contributor

@alienth alienth commented Aug 22, 2014

An issue we've had when using max_requests is almost all of our workers would restart at the same time due to even balancing of requests to the workers. This would result in a resource spike during the wave of worker restarts and a bunch of queuing due to fresh workers getting slammed. This jitter splits up the restart of the workers, which will help prevent the above issue.

This is something we've been using at reddit for a while now. Not sure it is suitable for the main project, but I figured I'd pass it along. I'd be happy to alter the name of the option or any of the documentation to meet any standards or requirements of the project.

@alienth alienth force-pushed the master branch 2 times, most recently from 3570fb8 to aa6e82c Compare August 23, 2014 02:05
@tilgovi
Copy link
Collaborator

tilgovi commented Aug 23, 2014

I'm 👍 for this change. A really good idea. Glad to hear it works well for you.

What values do you find work well? Perhaps we should just make this the default and just make the range some fraction of the max requests setting.

Say hi to @chromakode for me.

The maximum jitter to add to the max_requests setting.

The jitter causes the restart per worker to be randomized by
random(range(0, this_value)). This is intended to stagger worker
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: random(range(0, this_value)) -> random(range(0, this_value))

@alienth
Copy link
Contributor Author

alienth commented Aug 24, 2014

Thanks for the feedback! Right now we're using a max_requests of 500, and a max_requests_jitter of 200 so that restarts are highly randomized. I suspect that a jitter not being a decent proportion of the max_requests would have not very useful results. For example, max_requests of 500 and max_requests_jitter of 20 would result in closely-clustered restarts initially, but they'd eventually drift apart. We haven't tried any other values.

There may be some use cases where someone wants restarts to be closely clustered together, although I'm having trouble thinking of any. I can alter this to be default-behaviour, or a toggleable behaviour with a static fraction of max_requests. I think as-is it provides the greatest amount of flexibility, but that flexibility may not be very useful.

I cleaned up the doc item. Let me know if you'd like me to add the 'version' indicator.

@benoitc
Copy link
Owner

benoitc commented Oct 3, 2014

LGTM @tilgovi @berkerpeksag ?

@tilgovi
Copy link
Collaborator

tilgovi commented Oct 3, 2014

Yeah, seems fine. Let's get the version doc in there. Thanks, @alienth!

@berkerpeksag
Copy link
Collaborator

Merged in d4e1bfe and 94d9319 with tweaks 8b83a28.

Thanks!

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.

None yet

4 participants