kubernetes-sigs / kube-scheduler-wasm-extension

All the things to make the scheduler extendable with wasm.
Apache License 2.0
86 stars 17 forks source link

Make profiler work #51

Closed pelletier closed 10 months ago

pelletier commented 10 months ago

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fix wzprof usage to enable profiling.

Which issue(s) this PR fixes:

none

Special notes for your reviewer:

A couple things were missing:

As you can see the method to get access to the CompiledModule from the profiler main function is a bit hacky. Feel free to edit.

Does this PR introduce a user-facing change?

NONE

What are the benchmark results of this change?

N/A

linux-foundation-easycla[bot] commented 10 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

k8s-ci-robot commented 10 months ago

Welcome @pelletier!

It looks like this is your first PR to kubernetes-sigs/kube-scheduler-wasm-extension 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kube-scheduler-wasm-extension has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot commented 10 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: codefromthecrypt, pelletier

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension/blob/main/OWNERS)~~ [codefromthecrypt] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
pelletier commented 10 months ago

@codefromthecrypt here's the benchstat

goos: linux
goarch: amd64
pkg: sigs.k8s.io/kube-scheduler-wasm-extension/internal/e2e
cpu: AMD Ryzen 9 5950X 16-Core Processor
                                                        │ before.txt  │             after.txt             │
                                                        │   sec/op    │   sec/op     vs base              │
PluginFilter/noop-wat/params:_small-32                    325.1n ± 1%   322.6n ± 1%  -0.77% (p=0.002 n=6)
PluginFilter/noop-wat/params:_real-32                     326.3n ± 2%   322.1n ± 1%  -1.30% (p=0.026 n=6)
PluginFilter/noop/params:_small-32                        520.6n ± 1%   504.5n ± 1%  -3.10% (p=0.002 n=6)
PluginFilter/noop/params:_real-32                         517.6n ± 1%   504.6n ± 1%  -2.53% (p=0.002 n=6)
PluginFilter/test/params:_small-32                        7.113µ ± 1%   7.148µ ± 2%       ~ (p=0.310 n=6)
PluginFilter/test/params:_real-32                         116.4µ ± 1%   116.3µ ± 2%       ~ (p=0.937 n=6)
PluginScore/noop-wat/params:_small-32                     322.0n ± 1%   315.5n ± 1%  -2.00% (p=0.002 n=6)
PluginScore/noop-wat/params:_real-32                      323.7n ± 4%   319.2n ± 1%  -1.41% (p=0.017 n=6)
PluginScore/noop/params:_small-32                         589.4n ± 2%   577.6n ± 1%       ~ (p=0.093 n=6)
PluginScore/noop/params:_real-32                          531.0n ± 1%   518.1n ± 1%  -2.42% (p=0.002 n=6)
PluginScore/test/params:_small-32                         3.876µ ± 3%   3.778µ ± 0%  -2.52% (p=0.002 n=6)
PluginScore/test/params:_real-32                          49.20µ ± 2%   49.80µ ± 1%  +1.22% (p=0.015 n=6)
PluginPrefilterFilterAndScore/noop-wat/params:_small-32   491.0n ± 1%   482.5n ± 0%  -1.73% (p=0.002 n=6)
PluginPrefilterFilterAndScore/noop-wat/params:_real-32    491.5n ± 0%   483.9n ± 1%  -1.57% (p=0.002 n=6)
PluginPrefilterFilterAndScore/noop/params:_small-32       818.5n ± 1%   821.6n ± 1%       ~ (p=0.180 n=6)
PluginPrefilterFilterAndScore/noop/params:_real-32        813.4n ± 1%   817.0n ± 2%       ~ (p=0.197 n=6)
PluginPrefilterFilterAndScore/test/params:_small-32       8.396µ ± 0%   8.537µ ± 1%  +1.68% (p=0.004 n=6)
PluginPrefilterFilterAndScore/test/params:_real-32        118.6µ ± 2%   119.9µ ± 2%       ~ (p=0.240 n=6)
geomean                                                   1.749µ        1.734µ       -0.90%
codefromthecrypt commented 10 months ago

sorry, there's a tidy related concern. If you can run make check and then squash + force-push for merge, much obliged.

codefromthecrypt commented 10 months ago

ps I noticed this is on your main, so don't worry about rebase or anything. if you can push the tidy commit, all good (I can't because I can't write to your main)

pelletier commented 10 months ago

Odd I thought I this would allow you to push changes:

image

Pushed the make check commits (not sure why there is a diff on go.mod 🤷🏻 )!

codefromthecrypt commented 10 months ago

@pelletier yeah no idea.. at first I wondered if main was a special case. Anyway thanks for the help!

codefromthecrypt commented 10 months ago

thanks for the help, this will be handy again as we look at impact of passing state around 🥇