Skip to content
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

istioctl bug-report: Speed improvement from concurrency limiting #47712

Merged
merged 3 commits into from
Nov 4, 2023

Conversation

tonya11en
Copy link
Contributor

The istioctl bug-report currently limits the request rate to the kube API to 10 RPS. This is rather conservative and causes the bug report generation to take an unreasonable amount of time in some cases. This patch speeds things up by limiting request concurrency instead of request rate. It results in dramatic speed increases in my local testing (1:12 -> 0:15).

To protect the api server from overload in cases where request concurrency is low and the rate is high, the bug-report will rely on server-side rate limiting to mitigate the overload risk.

Before:

istioctl bug-report  9.38s user 3.41s system 17% cpu 1:12.19 total

After:

out/linux_amd64/istioctl bug-report  10.54s user 3.70s system 97% cpu 14.566 total

@tonya11en tonya11en requested a review from a team as a code owner November 3, 2023 02:07
@istio-policy-bot
Copy link

😊 Welcome @tonya11en! This is either your first contribution to the Istio istio repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2023
Copy link

linux-foundation-easycla bot commented Nov 3, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@istio-testing
Copy link
Collaborator

Hi @tonya11en. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: Tony Allen <tony@allen.gg>
@tonya11en tonya11en force-pushed the tallen/bug-report-speed branch from 46e38af to 34b6a6f Compare November 3, 2023 02:09
@tonya11en
Copy link
Contributor Author

I'll figure out this CLA thing tomorrow.

@hanxiaop
Copy link
Member

hanxiaop commented Nov 3, 2023

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Nov 3, 2023
# - installation
# - istioctl
# - documentation
area: telemetry
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
area: telemetry
area: istioctl

@@ -96,10 +96,9 @@ func addFlags(cmd *cobra.Command, args *config2.BugReportConfig) {
cmd.PersistentFlags().StringVar(&outputDir, "output-dir", "",
"Set a specific directory for output archive file.")

// requests per second limit
cmd.PersistentFlags().IntVar(&args.RequestsPerSecondLimit, "rps-limit", 0,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should remove flags directly like this without any deprecation notes. Can we provide an alternative option instead?

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we need strict compatibility for bug-report. But I don't mind keeping rps-limit if there is some desire, just defaulting to infinite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My reasoning for removing the rate is that it doesn't make much sense to follow any deprecation procedure the bug-report utility. Isn't this essentially a script that's run only in certain circumstances?

I'm happy to add it back if there are concerns around compatibility, though.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.

@howardjohn howardjohn added the do-not-merge/hold Block automatic merging of a PR. label Nov 3, 2023
Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

LGTM but put a hold since @hanxiaop had some comments.

clientConfig := kube.BuildClientCmd(kubeconfig, kubeContext, func(co *clientcmd.ConfigOverrides) {
co.Timeout = defaultTimeoutDurationStr
})
restConfig, err := clientConfig.ClientConfig()
if err != nil {
return nil, nil, err
}
if qpsLimit > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

IME in the past, not setting restConfig.QPS meant it defaulted to 5, or something low. But they may have removed that - I know there has been a wider movement to kill client-side rate limiting so maybe they did it in this way. Given it ran faster for you I guess it must not be set to 5 now...

@@ -96,10 +96,9 @@ func addFlags(cmd *cobra.Command, args *config2.BugReportConfig) {
cmd.PersistentFlags().StringVar(&outputDir, "output-dir", "",
"Set a specific directory for output archive file.")

// requests per second limit
cmd.PersistentFlags().IntVar(&args.RequestsPerSecondLimit, "rps-limit", 0,
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we need strict compatibility for bug-report. But I don't mind keeping rps-limit if there is some desire, just defaulting to infinite

Signed-off-by: Tony Allen <tony@allen.gg>
@tonya11en tonya11en requested a review from hanxiaop November 3, 2023 21:05
Signed-off-by: Tony Allen <tony@allen.gg>
@tonya11en
Copy link
Contributor Author

/retest

@hanxiaop hanxiaop removed the do-not-merge/hold Block automatic merging of a PR. label Nov 4, 2023
@istio-testing istio-testing merged commit 39d9fbd into istio:master Nov 4, 2023
1 check passed
@tonya11en tonya11en deleted the tallen/bug-report-speed branch November 5, 2023 18:28
@syw14 syw14 added the cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch label Dec 6, 2023
@istio-testing
Copy link
Collaborator

In response to a cherrypick label: new pull request created: #48195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants