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

scheduler: optimize reservation BeforePreFilter performance #1695

Conversation

eahydra
Copy link
Member

@eahydra eahydra commented Oct 1, 2023

Ⅰ. Describe what this PR does

Optimize plugin Reservation's BeforePreFilter performance.

goos: darwin
goarch: amd64
pkg: github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/reservation
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

benchmark                                       old ns/op     new ns/op     delta
BenchmarkBeforePrefilterWithMatchedPod-12       7191996       3728866       -48.15%
BenchmarkBeforePrefilterWithMatchedPod-12       6965735       4111975       -40.97%
BenchmarkBeforePrefilterWithMatchedPod-12       7242072       3918338       -45.89%
BenchmarkBeforePrefilterWithMatchedPod-12       7099550       3754856       -47.11%
BenchmarkBeforePrefilterWithMatchedPod-12       7360839       3836024       -47.89%
BenchmarkBeforePrefilterWithMatchedPod-12       7233161       4295326       -40.62%
BenchmarkBeforePrefilterWithMatchedPod-12       7480983       4074013       -45.54%
BenchmarkBeforePrefilterWithMatchedPod-12       7236430       4320509       -40.30%
BenchmarkBeforePrefilterWithMatchedPod-12       6774842       4410080       -34.91%
BenchmarkBeforePrefilterWithMatchedPod-12       6926647       4682762       -32.39%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7741868       2451607       -68.33%
BenchmarkBeforePrefilterWithUnmatchedPod-12     8023967       2744553       -65.80%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7538820       2640237       -64.98%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7633984       2493778       -67.33%
BenchmarkBeforePrefilterWithUnmatchedPod-12     8053347       2841502       -64.72%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7839942       2779620       -64.55%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7826316       2923067       -62.65%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7310364       2461115       -66.33%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7578863       2605870       -65.62%
BenchmarkBeforePrefilterWithUnmatchedPod-12     7700427       2374196       -69.17%


                                   │   old.txt   │               new.txt               │
                                   │   sec/op    │   sec/op     vs base                │
BeforePrefilterWithMatchedPod-12     7.213m ± 4%   4.093m ± 8%  -43.25% (p=0.000 n=10)
BeforePrefilterWithUnmatchedPod-12   7.721m ± 4%   2.623m ± 8%  -66.03% (p=0.000 n=10)
geomean                              7.463m        3.277m       -56.09%

Ⅱ. Does this pull request fix one issue?

fix #1696

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

V. Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in make test

@codecov
Copy link

codecov bot commented Oct 7, 2023

Codecov Report

Attention: 66 lines in your changes are missing coverage. Please review.

Comparison is base (d04f86b) 65.93% compared to head (b3d517b) 65.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1695      +/-   ##
==========================================
- Coverage   65.93%   65.92%   -0.01%     
==========================================
  Files         384      384              
  Lines       41474    41557      +83     
==========================================
+ Hits        27344    27396      +52     
- Misses      12106    12136      +30     
- Partials     2024     2025       +1     
Flag Coverage Δ
unittests 65.92% <58.75%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/scheduler/plugins/reservation/cache.go 84.74% <100.00%> (+0.62%) ⬆️
pkg/scheduler/plugins/reservation/plugin.go 76.19% <100.00%> (+0.16%) ⬆️
pkg/util/reservation/reservation.go 59.94% <81.25%> (+1.18%) ⬆️
pkg/scheduler/frameworkext/reservation_info.go 30.58% <25.80%> (+0.63%) ⬆️
pkg/scheduler/plugins/reservation/transformer.go 58.89% <53.16%> (-5.63%) ⬇️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eahydra eahydra force-pushed the optimize_reservation_transformer_perf branch from d31b00d to 518837b Compare October 7, 2023 15:45
@koordinator-bot koordinator-bot bot added size/XL and removed size/L labels Oct 7, 2023
@eahydra eahydra marked this pull request as ready for review October 7, 2023 15:45
@koordinator-bot koordinator-bot bot requested review from buptcozy and FillZpp October 7, 2023 15:45
@eahydra eahydra force-pushed the optimize_reservation_transformer_perf branch from 518837b to b3d517b Compare October 7, 2023 15:48
@eahydra eahydra requested review from hormes and ZiMengSheng October 7, 2023 15:49
Copy link
Member

@FillZpp FillZpp left a comment

Choose a reason for hiding this comment

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

/lgtm

Nice optimization!

Copy link
Member

@jasonliu747 jasonliu747 left a comment

Choose a reason for hiding this comment

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

/lgtm

@jasonliu747
Copy link
Member

image

@hormes
Copy link
Member

hormes commented Oct 8, 2023

/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FillZpp, hormes, jasonliu747

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@koordinator-bot koordinator-bot bot merged commit 9a80fe4 into koordinator-sh:main Oct 8, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Performance issues of Scheduler’s Reservation
4 participants