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

Bypass tracing handler if tracing is disabled #11016

Merged
merged 2 commits into from
Mar 24, 2021

Conversation

markusthoemmes
Copy link
Contributor

@markusthoemmes markusthoemmes commented Mar 23, 2021

Proposed Changes

This drops a whopping 55 allocations per request from both the activator and the queue-proxy if tracing is disabled. We'd love to reduce the tracing overhead in general of course, but this at least relieves the situation for people that are not running tracing at all.

Benchmark results

benchmark                               old ns/op     new ns/op     delta
BenchmarkHandlerChain/sequential-16     21598         13875         -35.76%
BenchmarkHandlerChain/parallel-16       20688         14301         -30.87%

benchmark                               old allocs     new allocs     delta
BenchmarkHandlerChain/sequential-16     125            70             -44.00%
BenchmarkHandlerChain/parallel-16       125            70             -44.00%

benchmark                               old bytes     new bytes     delta
BenchmarkHandlerChain/sequential-16     7701          4686          -39.15%
BenchmarkHandlerChain/parallel-16       7849          4793          -38.93%

Release Note

NONE

/assign @julz @vagababov

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 23, 2021
@knative-prow-robot knative-prow-robot added area/autoscale area/networking size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 23, 2021
Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 23, 2021
@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #11016 (8242fc9) into main (d5d489c) will increase coverage by 0.02%.
The diff coverage is 70.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11016      +/-   ##
==========================================
+ Coverage   88.01%   88.03%   +0.02%     
==========================================
  Files         189      190       +1     
  Lines        9134     9142       +8     
==========================================
+ Hits         8039     8048       +9     
  Misses        839      839              
+ Partials      256      255       -1     
Impacted Files Coverage Δ
cmd/activator/main.go 0.00% <0.00%> (ø)
cmd/queue/main.go 0.51% <0.00%> (-0.01%) ⬇️
pkg/activator/handler/tracing_handler.go 100.00% <100.00%> (ø)
pkg/reconciler/autoscaling/kpa/scaler.go 90.14% <0.00%> (+1.40%) ⬆️

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 d5d489c...8242fc9. Read the comment docs.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2021
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 except maybe a copypaste mistake on copyright header?

pkg/activator/handler/tracing_handler_test.go Outdated Show resolved Hide resolved

resp := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodPost, "http://example.com", nil)
const traceID = "821e0d50d931235a5ba3fa42eddddd8f"
Copy link
Member

Choose a reason for hiding this comment

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

this is very specific :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is, but the thing wants something that looks like an actual ID. "foo" doesn't work 😂

pkg/activator/handler/tracing_handler_test.go Outdated Show resolved Hide resolved
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 Mar 24, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2021
@knative-prow-robot knative-prow-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 24, 2021
@julz
Copy link
Member

julz commented Mar 24, 2021

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2021
@markusthoemmes
Copy link
Contributor Author

/retest

1 similar comment
@markusthoemmes
Copy link
Contributor Author

/retest

@knative-prow-robot knative-prow-robot merged commit d55482e into knative:main Mar 24, 2021
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants