Skip to content

Support to set QPS and burst by configuration. #3969

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KunWuLuan
Copy link
Contributor

@KunWuLuan KunWuLuan commented Aug 18, 2025

Why are these changes needed?

Related issue number

Closes #2367

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@KunWuLuan KunWuLuan force-pushed the upstrea-own/feat-qps-busrt branch 3 times, most recently from 48fef17 to acedbe9 Compare August 18, 2025 09:33
CN: 支持通过configuration设置qps和burst.

Signed-off-by: KunWuLuan <[email protected]>
@KunWuLuan KunWuLuan force-pushed the upstrea-own/feat-qps-busrt branch from acedbe9 to 71e13ae Compare August 18, 2025 11:06
Signed-off-by: KunWuLuan <[email protected]>
@KunWuLuan KunWuLuan force-pushed the upstrea-own/feat-qps-busrt branch from 1da0e31 to 2f7cb92 Compare August 18, 2025 11:15
@KunWuLuan
Copy link
Contributor Author

@kevin85421 Hi, does the golangci-lint run correctly? I don't think it should modify these files.

image image

https://github.com/ray-project/kuberay/actions/runs/17038972879/job/48297938933?pr=3969

Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Copy link
Member

@Future-Outlier Future-Outlier left a comment

Choose a reason for hiding this comment

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

I can open a follow-up PR for helm chart setting.

Copy link
Member

@Future-Outlier Future-Outlier left a comment

Choose a reason for hiding this comment

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

LGTM—I can open a PR to add Helm chart settings as a follow-up!

@@ -101,6 +103,8 @@ func main() {
"Use Kubernetes proxy subresource when connecting to the Ray Head node.")
flag.StringVar(&featureGates, "feature-gates", "", "A set of key=value pairs that describe feature gates. E.g. FeatureOne=true,FeatureTwo=false,...")
flag.BoolVar(&enableMetrics, "enable-metrics", false, "Enable the emission of control plane metrics.")
flag.Float64Var(&qps, "qps", float64(configapi.DefaultQPS), "The qps value for the client.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flag.Float64Var(&qps, "qps", float64(configapi.DefaultQPS), "The qps value for the client.")
flag.Float64Var(&qps, "qps", float64(configapi.DefaultQPS), "The QPS value for the client communicating with the Kubernetes API server.")

@@ -101,6 +103,8 @@ func main() {
"Use Kubernetes proxy subresource when connecting to the Ray Head node.")
flag.StringVar(&featureGates, "feature-gates", "", "A set of key=value pairs that describe feature gates. E.g. FeatureOne=true,FeatureTwo=false,...")
flag.BoolVar(&enableMetrics, "enable-metrics", false, "Enable the emission of control plane metrics.")
flag.Float64Var(&qps, "qps", float64(configapi.DefaultQPS), "The qps value for the client.")
flag.IntVar(&burst, "burst", configapi.DefaultBurst, "The burst value for the client.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flag.IntVar(&burst, "burst", configapi.DefaultBurst, "The burst value for the client.")
flag.IntVar(&burst, "burst", configapi.DefaultBurst, "The maximum burst for throttling requests from this client to the Kubernetes API server.")

@@ -101,6 +103,8 @@ func main() {
"Use Kubernetes proxy subresource when connecting to the Ray Head node.")
flag.StringVar(&featureGates, "feature-gates", "", "A set of key=value pairs that describe feature gates. E.g. FeatureOne=true,FeatureTwo=false,...")
flag.BoolVar(&enableMetrics, "enable-metrics", false, "Enable the emission of control plane metrics.")
flag.Float64Var(&qps, "qps", float64(configapi.DefaultQPS), "The qps value for the client.")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment linking to https://pkg.go.dev/k8s.io/client-go/rest#Config? It’s not straightforward for readers to understand what “client” refers to.

@@ -10,6 +10,8 @@ const (
DefaultProbeAddr = ":8082"
DefaultEnableLeaderElection = true
DefaultReconcileConcurrency = 1
DefaultQPS = float64(100)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any rationale behind choosing 100 and 200? They’re 20× the default values—was that intentional?

Can you help me understand the impact from the user’s perspective? For example:

  • Experiment 1: 1 goroutine; QPS = 5 and Burst = 10 → X RayCluster CRs become ready in Y1 minutes.
  • Experiment 2: 1 goroutine; QPS = 100 and Burst = 200 → X RayCluster CRs become ready in Y2 minutes.

Additionally, Y2 is smaller than Y1.

In addition, what's your KubeRay operator Pod resource configuration? Does it require more CPU / memory?

},
{
name: "set QPS and Burst",
configData: `apiVersion: config.ray.io/v1beta1
Copy link
Member

Choose a reason for hiding this comment

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

why not use v1alpha1 instead to avoid the error?

t.Logf("actual config: %v", config)
t.Logf("expected config: %v", testcase.expectedConfig)
t.Error("unexpected config")
if diff := cmp.Diff(config, testcase.expectedConfig, cmpopts.IgnoreFields(configapi.Configuration{}, "QPS", "Burst")); diff != "" {
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit hacky. Can we use logic like:

defaults := map[string]any{
    MetricsAddr: ...,
    QPS:         ...,
}

cfg, err := decodeConfig([]byte(testcase.configData), scheme)
if err != nil {
    return err
}
if cfg == nil {
    cfg = make(map[string]any)
}

for k, v := range defaults {
    if _, ok := cfg[k]; !ok {
        cfg[k] = v
    }
}

# compare cfg and the expected config

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.

[Feature] Support setting QPS and Burst in configuration and command line flags
3 participants