forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 70
Make heavy loaded optimization configurable #114
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,24 @@ type ClusterConfig struct { | |
| // Default: 128 for older CQL versions | ||
| MaxRequestsPerConn int | ||
|
|
||
| // Threshold for the number of inflight requests per connection | ||
| // after which the connection is considered as heavy loaded | ||
| // Default: 512 | ||
| HeavyLoadedConnectionThreshold int | ||
|
|
||
| // When a connection is considered as heavy loaded, the driver | ||
| // could switch to the least loaded connection for the same node. | ||
| // The switch will happen if the other connection is at least | ||
| // HeavyLoadedSwitchConnectionPercentage percentage less busy | ||
| // (in terms of inflight requests). | ||
| // | ||
| // For the default value of 20%, if the heavy loaded connection | ||
| // has 100 inflight requests, the switch will happen only if the | ||
| // least busy connection has less than 80 inflight requests. | ||
| // | ||
| // Default: 20% | ||
| HeavyLoadedSwitchConnectionPercentage int | ||
|
|
||
| // Default consistency level. | ||
| // Default: Quorum | ||
| Consistency Consistency | ||
|
|
@@ -267,6 +285,8 @@ func NewCluster(hosts ...string) *ClusterConfig { | |
| ConnectTimeout: 600 * time.Millisecond, | ||
| Port: 9042, | ||
| NumConns: 2, | ||
| HeavyLoadedConnectionThreshold: 512, | ||
| HeavyLoadedSwitchConnectionPercentage: 20, | ||
|
Collaborator
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. Please run gofmt on this file. It will be annoying for others contributors if gofmt keeps formatting code that they didn't modify. |
||
| Consistency: Quorum, | ||
| MaxPreparedStmts: defaultMaxPreparedStmts, | ||
| MaxRoutingKeyInfo: 1000, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please validate that this parameter is within valid range when the session is being created.