-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Added qps and burst to server's client #956
Added qps and burst to server's client #956
Conversation
Hi @ffd2subroutine - thanks for the PR! I noticed you marked this as work-in-progress. Is there anything in particular you're still planning to do or is this ready for review from someone from the Ark team? |
Hi @rosskukulinski, yeah it's ready for review, maybe @ncdc can take a look at this one. |
Thanks for the PR @ffd2subroutine. I'll give this a read and test and get back to you. |
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.
I think upping the defaults makes sense. I just looked at Kubernetes 1.11, and it looks like the controller-manager's defaults are qps=20, burst=30. I like those values - what do you all think? |
@ncdc going with controller-manager's defaults sounds reasonable to me! |
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.
Thanks for updating that @ffd2subroutine!
2 more things (I missed this the first time): can you squash the commits into 1, as well as add a sign off line? git commit --amend --sign-off
will add the signed off line for you.
@ncdc Probably worth doing, yeah. |
pkg/cmd/server/server.go
Outdated
@@ -153,6 +161,8 @@ func NewCommand() *cobra.Command { | |||
command.Flags().StringSliceVar(&config.restoreResourcePriorities, "restore-resource-priorities", config.restoreResourcePriorities, "desired order of resource restores; any resource not in the list will be restored alphabetically after the prioritized resources") | |||
command.Flags().StringVar(&config.defaultBackupLocation, "default-backup-storage-location", config.defaultBackupLocation, "name of the default backup storage location") | |||
command.Flags().Var(&volumeSnapshotLocations, "default-volume-snapshot-locations", "list of unique volume providers and default volume snapshot location (provider1:location-01,provider2:location-02,...)") | |||
command.Flags().Float32Var(&config.clientQPS, "client-qps", config.clientQPS, "server's client qps") |
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.
We should probably be more descriptive here. Something along the lines that this is the maximum number of requests per second the server uses when communicating with Kubernetes when backing up and restoring.
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.
maximum number of requests per second the server uses when communicating with Kubernetes when backing up and restoring
Would that be okay?
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.
sgtm!
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.
Wanted to jot this down before I forget - I'm not sure if "maximum" is the best word here, since it's possible to burst above the qps. It's more like the average sustained requests rate.
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.
"quota" seems like one of the right words here. Something like "standard quota of requests per second to Kubernetes"?
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.
Okay, let me know the final wording for qps and burst param descriptions!
pkg/cmd/server/server.go
Outdated
@@ -153,6 +161,8 @@ func NewCommand() *cobra.Command { | |||
command.Flags().StringSliceVar(&config.restoreResourcePriorities, "restore-resource-priorities", config.restoreResourcePriorities, "desired order of resource restores; any resource not in the list will be restored alphabetically after the prioritized resources") | |||
command.Flags().StringVar(&config.defaultBackupLocation, "default-backup-storage-location", config.defaultBackupLocation, "name of the default backup storage location") | |||
command.Flags().Var(&volumeSnapshotLocations, "default-volume-snapshot-locations", "list of unique volume providers and default volume snapshot location (provider1:location-01,provider2:location-02,...)") | |||
command.Flags().Float32Var(&config.clientQPS, "client-qps", config.clientQPS, "server's client qps") | |||
command.Flags().IntVar(&config.clientBurst, "client-burst", config.clientBurst, "server's client burst") |
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.
I'm not sure the best way to write this clearly. It's a higher-than-average number of requests (more than QPS) that are allowed in a small window of time.
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.
What about this?
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.
Given that the QPS is the normal number of requests per second, the burst is the ability to exceed the QPS for a short period of time. Here's how it works:
There is a "bucket" that has a fixed capacity. This capacity is the "burst" value. Let's use an example of 30. The bucket is initially filled to capacity, so it has 30 tokens. You can pull tokens out as fast as possible, which means you can initially do 30 requests. The bucket also has a rate at which it is filled - this is the QPS. Here let's use an example of 20. This means a new token is added to the bucket approximately every 1/20 of a second. If you are constantly making requests, the steady rate will be 20/second. If you pause for long enough, the bucket will fill to capacity == burst == 30 in this example.
I'm still thinking about wording.
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.
okay
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.
and thanks for the explanation!
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 a maximum value, but it's not a sustained rate.
For example, if the burst is 100 and the qps is 5, and you have a steady stream of requests you need to make, what happens is initially you can make 100 requests as fast as you're able to do so, and all additional requests will average 5 per second. The only way you get back to 100 (the burst) is if there is a pause in requests for (burst / qps) seconds to allow the bucket to refill (100/5 = 20 seconds).
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.
what kind of usable string length requirements do we have here? (pondering further ...)
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.
"temporary maximum ..." ? "emergency maximum ..." ?
or if a longer string would work:
"one-time maximum number of requests to exceed QPS before pausing to refresh burst"
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.
"short-term maximum number of requests to exceed QPS before pause to refresh burst"
I think this one or the other longer alternative are not too bad (actually useful) if we can accommodate longer string
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.
I think "short-term" or "temporary" is probably good
bdbc268
to
9b0a4e9
Compare
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.
Hi @ffd2subroutine - will you be able to get this updated so we can include it in the upcoming release? Thanks!
pkg/cmd/server/server.go
Outdated
@@ -446,6 +458,8 @@ func (s *server) validateBackupStorageLocations() error { | |||
// - Limit ranges go before pods or controllers so pods can use them. | |||
// - Pods go before controllers so they can be explicitly restored and potentially | |||
// have restic restores run before controllers adopt the pods. | |||
// - Custom Resource Definitions come before Custom Resource so that they can be |
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 has already made it into master
so can be removed from this PR
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.
sorry I was squashing commits for the first time and it squashed everything in between, will remove it
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.
removed
pkg/cmd/server/server.go
Outdated
@@ -456,6 +470,7 @@ var defaultRestorePriorities = []string{ | |||
"limitranges", | |||
"pods", | |||
"replicaset", | |||
"customresourcedefinitions", |
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 has already made it into master
so can be removed from this PR
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.
removed
d157ec7
to
5b89fc2
Compare
5b89fc2
to
28f56b6
Compare
@ncdc @Bradamant3 would like to get this into v0.10, so we just need to finalize help text. WDYT about these: client-burst: maximum number of requests by the server to the Kubernetes API in a short period of time |
Sounds good enough for now! |
@ffd2subroutine if you can update the help text to what I proposed just above, we should be good to merge - thanks! |
28f56b6
to
50a1e71
Compare
@ffd2subroutine thanks - would you mind rewording the commit message so it doesn't have |
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.
Approved pending removal of [wip]
from commit message :)
50a1e71
to
0aac667
Compare
@@ -197,6 +207,8 @@ func newServer(namespace, baseName string, config serverConfig, logger *logrus.L | |||
if err != nil { | |||
return nil, err | |||
} | |||
clientConfig.QPS = config.clientQPS |
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.
I don't know why I didn't think of this sooner - should we validate these are positive numbers?
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.
yeah makes sense, I also forgot
if config.clientQPS <= 0 {
return errors.New("client-qps can be only a positive number")
}
Something like this? Maybe some better wording, not a native english speaker:)
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.
That's good, or client-qps must be positive
Changes addressed, but haven't reviewed latest code.
Signed-off-by: Darko Radisic <[email protected]>
0aac667
to
e5556fe
Compare
LGTM, thanks @ffd2subroutine! |
Signed-off-by: Darko Radisic [email protected]
Fixes #109