Skip to content

Parallelize fetching resource for all projects#216

Merged
ctrox merged 5 commits intoninech:mainfrom
rnestler:parallelize-fetching-all-apps
Mar 25, 2025
Merged

Parallelize fetching resource for all projects#216
ctrox merged 5 commits intoninech:mainfrom
rnestler:parallelize-fetching-all-apps

Conversation

@rnestler
Copy link
Copy Markdown
Contributor

@rnestler rnestler commented Mar 21, 2025

This improves fetching all applications for our organization by a factor of ~14:

% hyperfine --warmup 1 "./nctl get applications -A" "nctl get applications -A"
Benchmark 1: ./nctl get applications -A
  Time (mean ± σ):     243.6 ms ±  27.1 ms    [User: 128.8 ms, System: 59.8 ms]
  Range (min … max):   216.0 ms … 292.8 ms    11 runs

Benchmark 2: nctl get applications -A
  Time (mean ± σ):      3.389 s ±  0.012 s    [User: 0.144 s, System: 0.067 s]
  Range (min … max):    3.374 s …  3.409 s    10 runs

Summary
  ./nctl get applications -A ran
   13.91 ± 1.55 times faster than nctl get applications -A

The same holds for getting all postgres databases:

% hyperfine --warmup 1 "./nctl get postgres -A" "nctl get postgres -A"
Benchmark 1: ./nctl get postgres -A
  Time (mean ± σ):     248.7 ms ±  30.3 ms    [User: 158.9 ms, System: 61.3 ms]
  Range (min … max):   213.0 ms … 300.5 ms    10 runs

Benchmark 2: nctl get postgres -A
  Time (mean ± σ):      3.433 s ±  0.064 s    [User: 0.150 s, System: 0.060 s]
  Range (min … max):    3.389 s …  3.602 s    10 runs

Summary
  ./nctl get postgres -A ran
   13.81 ± 1.70 times faster than nctl get postgres -A

@rnestler rnestler force-pushed the parallelize-fetching-all-apps branch from 517ba68 to 4dbcd63 Compare March 25, 2025 15:14
@rnestler rnestler requested a review from ctrox March 25, 2025 15:35
@rnestler rnestler changed the title Parallelize fetching all apps Parallelize fetching resource for all projects Mar 25, 2025
Copy link
Copy Markdown
Contributor

@ctrox ctrox left a comment

Choose a reason for hiding this comment

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

One thing that can be a bit annoying is that if you do run into the rate limit (which is not too likely at the moment), client-go outputs a (rather ugly) warning message. I tried to suppress it by discarding klog output but I was unable to get it to work right now. It's a detail, we can revisit it later if it bothers us too much.

So LGTM, thanks!

@ctrox ctrox merged commit 0d950cd into ninech:main Mar 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants