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

contrib/internal/httptrace: improve performance of span starts #2128

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

knusbaum
Copy link
Contributor

What does this PR do?

This commit improves the performance of starting a span by reducing work
done, especially allocations.

Motivation

We were seeing a large increase in memory and CPU usage while starting spans compared to previous versions.

Describe how to test/QA your changes

Reviewer's Checklist

  • Changed code has unit tests for its functionality.
  • If this interacts with the agent in a new way, a system test has been added.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has been revoked.
joachifm Joachim F.
This commit improves the performance of starting a span by reducing work
done, especially allocations.
@knusbaum knusbaum requested a review from a team July 19, 2023 16:08
@knusbaum knusbaum requested a review from a team as a code owner July 19, 2023 16:08
@knusbaum
Copy link
Contributor Author

$ benchstat old.bench new.bench 
name                 old time/op    new time/op    delta
StartRequestSpan-16     788ns ±13%     160ns ± 6%  -79.64%  (p=0.000 n=10+10)

name                 old alloc/op   new alloc/op   delta
StartRequestSpan-16      768B ± 0%      224B ± 0%  -70.83%  (p=0.000 n=10+10)

name                 old allocs/op  new allocs/op  delta
StartRequestSpan-16      21.0 ± 0%       5.0 ± 0%  -76.19%  (p=0.000 n=10+10)

@knusbaum knusbaum changed the base branch from main to release-v1.53.x July 19, 2023 16:09
@knusbaum knusbaum changed the title Knusbaum/http perf contrib/internal/httptrace: improve performance of span starts Jul 19, 2023

Verified

This commit was signed with the committer’s verified signature. The key has been revoked.
joachifm Joachim F.
@pr-commenter
Copy link

pr-commenter bot commented Jul 19, 2023

Benchmarks

Benchmark execution time: 2023-07-19 19:53:56

Comparing candidate commit c65db5c in PR branch knusbaum/http-perf with baseline commit f905f70 in branch release-v1.53.x.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics.

fix

Verified

This commit was signed with the committer’s verified signature. The key has been revoked.
joachifm Joachim F.

Verified

This commit was signed with the committer’s verified signature. The key has been revoked.
joachifm Joachim F.
@knusbaum
Copy link
Contributor Author

New benchstat output:

$ benchstat old.bench new.bench 
name                 old time/op    new time/op    delta
StartRequestSpan-16    1.08µs ±13%    0.35µs ± 3%  -67.92%  (p=0.000 n=10+10)

name                 old alloc/op   new alloc/op   delta
StartRequestSpan-16      768B ± 0%      264B ± 0%  -65.62%  (p=0.000 n=10+10)

name                 old allocs/op  new allocs/op  delta
StartRequestSpan-16      21.0 ± 0%      10.0 ± 0%  -52.38%  (p=0.000 n=10+10)

@knusbaum knusbaum merged commit 216e947 into release-v1.53.x Jul 19, 2023
@knusbaum knusbaum deleted the knusbaum/http-perf branch July 19, 2023 20:05
knusbaum added a commit that referenced this pull request Jul 20, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
This commit improves the performance of starting a span by reducing work
done, especially allocations.
knusbaum added a commit that referenced this pull request Jul 20, 2023
…y-pick #2128) (#2135)

This commit improves the performance of starting a span by reducing work done, especially allocations.

Cherry-pick of #2128
katiehockman pushed a commit that referenced this pull request Jul 26, 2023
…y-pick #2128) (#2135)

This commit improves the performance of starting a span by reducing work done, especially allocations.

Cherry-pick of #2128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants