-
Notifications
You must be signed in to change notification settings - Fork 59
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
Make heavy loaded optimization configurable #114
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,10 +345,10 @@ func (p *scyllaConnPicker) maybeReplaceWithLessBusyConnection(c *Conn) *Conn { | |
return c | ||
} | ||
alternative := p.leastBusyConn() | ||
if alternative == nil || alternative.AvailableStreams() * 120 > c.AvailableStreams() * 100 { | ||
return c | ||
} else { | ||
if alternative != nil && alternative.InUseStreams() * 100 < c.InUseStreams() * 80 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of fact that the problem with the original equation wasn't spotted when it was reviewed, I would appreciate some unit tests in order to convince us better that it indeed is fixed now. I think we already have some There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry but isn't And this brings us back to the initial motivation of this patch. It was supposed to be as follows:
Or in your current version:
Don't you think that adjusting the original equation would make this patch much simpler? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. The reason I changed it to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. |
||
return alternative | ||
} else { | ||
return c | ||
} | ||
} | ||
|
||
|
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.
A question from a C-guy: why did you have to create all these complications with casting like this one (
int
would be aint64
on 64-bit platform according to https://www.educative.io/answers/what-is-type-int-in-golang)?I assume that the reason you need to do all these transformations is because
NumStreams
isint
but for whatever unclear to me reasoninuseStreams
isint32
. And this makes no sense to me at all becauseinuseStreams
can get a value stored inNumStreams
, and this implies that they should have the same type.Am I missing something?
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.
It is due to golang
atomic
package that does not have API forint
.