-
Notifications
You must be signed in to change notification settings - Fork 442
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
consumer: redistribute RDY when connections are active #208
Conversation
LowRdyIdleTimeout time.Duration `opt:"low_rdy_idle_timeout" min:"1s" max:"5m" default:"10s"` | ||
|
||
// Duration to wait until redistributing RDY for an nsqd regardless of LowRdyIdleTimeout | ||
LowRdyTimeout time.Duration `opt:"low_rdy_timeout" min:"1s" max:"5m" default:"30s"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably never be lower than LowRdyIdleTimeout
, I can enforce this...
Looks good to me. I noticed this part below seems less than optimal (abbreviated): for len(possibleConns) > 0 && availableMaxInFlight > 0 {
availableMaxInFlight--
i := r.rng.Int() % len(possibleConns)
c := possibleConns[i]
possibleConns = append(possibleConns[:i], possibleConns[i+1:]...)
r.updateRDY(c, 1)
} All This could be fixed by appending to possibleConns only if the conn has a zero ready count. |
Hmm, yea, can probably be improved, but it's at least randomized. |
@ploxiln want to gimme a 👍 — also, there are probably a few lessons to learn from nsqio/pynsq#179 and nsqio/pynsq#176 |
👍 to these additions. ... but the existing rdyCount logic is a bit tricky, and I'm not really familiar with it, and it's taking a while to digest. Anyway, I'm confident that this is strictly an improvement. fwiw :) |
fixes #179