这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove allocations from randomChoice2 policy #9506

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

Merged
merged 2 commits into from
Sep 22, 2020

Conversation

markusthoemmes
Copy link
Contributor

Proposed Changes

This is run as part of each request that has CC=0. Might as well make that as quick and cheap as we can.

benchmark                                                               old ns/op     new ns/op     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       50.4          10.1          -79.96%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         35.9          24.2          -32.59%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       34.8          9.84          -71.72%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         38.8          40.4          +4.12%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       63.1          34.9          -44.69%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         487           410           -15.81%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      70.2          40.4          -42.45%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        537           447           -16.76%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     69.1          39.2          -43.27%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       550           492           -10.55%

benchmark                                                               old allocs     new allocs     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       1              0              -100.00%

benchmark                                                               old bytes     new bytes     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       32            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         32            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       16            0             -100.00%

Release Note

NONE

/assign @julz @vagababov

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 22, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 22, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@markusthoemmes: 0 warnings.

In response to this:

Proposed Changes

This is run as part of each request that has CC=0. Might as well make that as quick and cheap as we can.

benchmark                                                               old ns/op     new ns/op     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       50.4          10.1          -79.96%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         35.9          24.2          -32.59%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       34.8          9.84          -71.72%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         38.8          40.4          +4.12%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       63.1          34.9          -44.69%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         487           410           -15.81%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      70.2          40.4          -42.45%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        537           447           -16.76%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     69.1          39.2          -43.27%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       550           492           -10.55%

benchmark                                                               old allocs     new allocs     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     1              0              -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       1              0              -100.00%

benchmark                                                               old bytes     new bytes     delta
BenchmarkPolicy/random-power-of-2-choice-1-trackers-sequential-16       32            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-1-trackers-parallel-16         32            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-sequential-16       16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-2-trackers-parallel-16         16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-sequential-16       16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-3-trackers-parallel-16         16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-sequential-16      16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-10-trackers-parallel-16        16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-sequential-16     16            0             -100.00%
BenchmarkPolicy/random-power-of-2-choice-100-trackers-parallel-16       16            0             -100.00%

Release Note

NONE

/assign @julz @vagababov

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.

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 22, 2020
@codecov
Copy link

codecov bot commented Sep 22, 2020

Codecov Report

Merging #9506 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9506      +/-   ##
==========================================
+ Coverage   88.60%   88.62%   +0.01%     
==========================================
  Files         209      210       +1     
  Lines        9374     9370       -4     
==========================================
- Hits         8306     8304       -2     
+ Misses        813      811       -2     
  Partials      255      255              
Impacted Files Coverage Δ
pkg/activator/net/lb_policy.go 91.17% <100.00%> (-0.72%) ⬇️
pkg/activator/net/throttler.go 88.07% <100.00%> (+0.03%) ⬆️
cmd/queue/main.go 10.13% <0.00%> (-7.26%) ⬇️
pkg/autoscaler/statforwarder/forwarder.go 83.33% <0.00%> (-1.73%) ⬇️
pkg/reconciler/autoscaling/kpa/scaler.go 88.40% <0.00%> (-1.45%) ⬇️
pkg/reconciler/revision/controller.go 85.10% <0.00%> (ø)
pkg/queue/handler.go 71.87% <0.00%> (ø)
pkg/reconciler/revision/resolve.go 93.10% <0.00%> (+0.51%) ⬆️
pkg/reconciler/configuration/configuration.go 89.16% <0.00%> (+1.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e570d9...95b9236. Read the comment docs.

}

func (p *podTracker) addWeight(w int32) {
p.weight.Add(w)
func (p *podTracker) increaseWeight() func() {
Copy link
Member

Choose a reason for hiding this comment

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

Im sort of wondering if we actually need the increaseWeight() function to return a callback here, because it sort of confused me on first pass why an increaseWeight function is returning a decreaseWeight method. What if this function didn't return anything and randomChoice2 just did pick.increaseWeight(); return pick.decreaseWeight, pick?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ehr, true! Artifact of playing with different versions I guess.

Copy link
Member

@julz julz left a comment

Choose a reason for hiding this comment

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

nice :D

Copy link
Member

@julz julz left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 22, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: julz, markusthoemmes

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

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/activator/net/lb_policy.go 94.1% 93.9% -0.2
pkg/activator/net/throttler.go 91.5% 91.7% 0.1

@knative-prow-robot knative-prow-robot merged commit e2698a3 into knative:master Sep 22, 2020
whaught pushed a commit to whaught/serving that referenced this pull request Sep 24, 2020
* Remove allocations from randomChoice2 policy

* Less callback shenanigans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/autoscale area/networking cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. 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