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

Http trace context benchmark #815

Merged
merged 22 commits into from
Feb 18, 2020

Conversation

DotSpy
Copy link
Member

@DotSpy DotSpy commented Feb 4, 2020

Extract and inject benchmarks for http context #792

@codecov-io
Copy link

codecov-io commented Feb 4, 2020

Codecov Report

Merging #815 into master will increase coverage by 1.73%.
The diff coverage is 84.15%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #815      +/-   ##
============================================
+ Coverage     78.98%   80.71%   +1.73%     
- Complexity      789      820      +31     
============================================
  Files           105      108       +3     
  Lines          2845     2899      +54     
  Branches        273      265       -8     
============================================
+ Hits           2247     2340      +93     
+ Misses          494      452      -42     
- Partials        104      107       +3
Impacted Files Coverage Δ Complexity Δ
...ntelemetry/sdk/trace/RecordEventsReadableSpan.java 91.51% <ø> (ø) 45 <0> (ø) ⬇️
...ntelemetry/exporters/inmemory/InMemoryTracing.java 85.71% <ø> (ø) 5 <0> (ø) ⬇️
...lemetry/sdk/trace/export/SimpleSpansProcessor.java 87.5% <ø> (ø) 7 <0> (ø) ⬇️
...metry/exporters/jaeger/JaegerGrpcSpanExporter.java 67.79% <ø> (ø) 4 <0> (ø) ⬇️
...ava/io/opentelemetry/sdk/trace/SpanBuilderSdk.java 93.87% <ø> (ø) 36 <0> (ø) ⬇️
...o/opentelemetry/sdk/trace/export/SpanExporter.java 100% <ø> (ø) 0 <0> (ø) ⬇️
...elemetry/sdk/trace/export/BatchSpansProcessor.java 88.79% <ø> (-0.87%) 7 <0> (ø)
...ava/io/opentelemetry/exporters/jaeger/Adapter.java 96.2% <ø> (ø) 16 <0> (ø) ⬇️
...ntelemetry/sdk/trace/export/MultiSpanExporter.java 100% <ø> (ø) 12 <0> (ø) ⬇️
...java/io/opentelemetry/sdk/trace/data/SpanData.java 100% <ø> (ø) 2 <0> (?)
... and 33 more

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 c9f61a6...da76a06. Read the comment docs.

jmh.gradle Outdated Show resolved Hide resolved
@jkwatson
Copy link
Contributor

jkwatson commented Feb 4, 2020

This looks like a good start. Can you publish the current benchmarks as a part of the PR description, along with what hardware you're running on?

@DotSpy
Copy link
Member Author

DotSpy commented Feb 5, 2020

This looks like a good start. Can you publish the current benchmarks as a part of the PR description, along with what hardware you're running on?

This is my first approach for jmh, after we will agree on current state of tests i will run it under my home laptop

@DotSpy
Copy link
Member Author

DotSpy commented Feb 5, 2020

@jkwatson @carlosalberto btw
should we have jmh tests for such things as:
extract_SampledContext
extract_NotSampledContext
and etc like we have in tests
https:/open-telemetry/opentelemetry-java/blob/c19174ee53ddf6b2a1a0b8265432b9256d8a4b1c/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java

@jkwatson
Copy link
Contributor

jkwatson commented Feb 5, 2020

@jkwatson @carlosalberto btw
should we have jmh tests for such things as:
extract_SampledContext
extract_NotSampledContext
and etc like we have in tests
https:/open-telemetry/opentelemetry-java/blob/c19174ee53ddf6b2a1a0b8265432b9256d8a4b1c/api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java

Yes, but let's add them as a follow-on PR. Benchmarks for parsing of trace-context headers would be extremely useful.

@bogdandrutu
Copy link
Member

Please rebase :)

@DotSpy
Copy link
Member Author

DotSpy commented Feb 8, 2020

Windows 10 Pro
i7-8750h 2.20 ghz
16 GB RAM

Benchmark                                          (spanIdBase16)                   (traceIdBase16)   Mode  Cnt         Score         Error  Units
HttpTraceContextExtractBenchmark.measureExtract  9909983295041501  905734c59b913b4a905734c59b913b4a  thrpt   10   2160692,917   410923,633  ops/s
HttpTraceContextExtractBenchmark.measureExtract  9909983295041501  21196a77f299580e21196a77f299580e  thrpt   10   2152158,416   431128,467  ops/s
HttpTraceContextExtractBenchmark.measureExtract  9909983295041501  2e7d0ad2390617702e7d0ad239061770  thrpt   10   2081894,755   454641,142  ops/s
HttpTraceContextExtractBenchmark.measureExtract  9909983295041501  905734c59b913b4a905734c59b913b4a  thrpt   10   2177649,524   423558,808  ops/s
HttpTraceContextExtractBenchmark.measureExtract  9909983295041501  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10   1982762,603   596354,798  ops/s
HttpTraceContextExtractBenchmark.measureExtract  993a97ee3691eb26  905734c59b913b4a905734c59b913b4a  thrpt   10   2319532,739   124120,489  ops/s
HttpTraceContextExtractBenchmark.measureExtract  993a97ee3691eb26  21196a77f299580e21196a77f299580e  thrpt   10   1914094,861   613884,885  ops/s
HttpTraceContextExtractBenchmark.measureExtract  993a97ee3691eb26  2e7d0ad2390617702e7d0ad239061770  thrpt   10   2057845,130   543978,168  ops/s
HttpTraceContextExtractBenchmark.measureExtract  993a97ee3691eb26  905734c59b913b4a905734c59b913b4a  thrpt   10   1852003,956   589733,155  ops/s
HttpTraceContextExtractBenchmark.measureExtract  993a97ee3691eb26  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10   1766992,195   879928,936  ops/s
HttpTraceContextExtractBenchmark.measureExtract  d49582a2de984b86  905734c59b913b4a905734c59b913b4a  thrpt   10   1800782,763   818951,973  ops/s
HttpTraceContextExtractBenchmark.measureExtract  d49582a2de984b86  21196a77f299580e21196a77f299580e  thrpt   10   1565988,197   576598,519  ops/s
HttpTraceContextExtractBenchmark.measureExtract  d49582a2de984b86  2e7d0ad2390617702e7d0ad239061770  thrpt   10   1704600,001   801254,709  ops/s
HttpTraceContextExtractBenchmark.measureExtract  d49582a2de984b86  905734c59b913b4a905734c59b913b4a  thrpt   10   1982802,800   614987,268  ops/s
HttpTraceContextExtractBenchmark.measureExtract  d49582a2de984b86  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10   1961533,275   666982,873  ops/s
HttpTraceContextExtractBenchmark.measureExtract  776ff807b787538a  905734c59b913b4a905734c59b913b4a  thrpt   10   1655059,992   835886,545  ops/s
HttpTraceContextExtractBenchmark.measureExtract  776ff807b787538a  21196a77f299580e21196a77f299580e  thrpt   10   1922076,896   676507,438  ops/s
HttpTraceContextExtractBenchmark.measureExtract  776ff807b787538a  2e7d0ad2390617702e7d0ad239061770  thrpt   10   1984693,465   727338,126  ops/s
HttpTraceContextExtractBenchmark.measureExtract  776ff807b787538a  905734c59b913b4a905734c59b913b4a  thrpt   10   2071729,747   368732,673  ops/s
HttpTraceContextExtractBenchmark.measureExtract  776ff807b787538a  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10   1902748,446   810421,349  ops/s
HttpTraceContextExtractBenchmark.measureExtract  68ec932c33b3f2ee  905734c59b913b4a905734c59b913b4a  thrpt   10   1909071,216   796991,287  ops/s
HttpTraceContextExtractBenchmark.measureExtract  68ec932c33b3f2ee  21196a77f299580e21196a77f299580e  thrpt   10   2015508,115   299557,606  ops/s
HttpTraceContextExtractBenchmark.measureExtract  68ec932c33b3f2ee  2e7d0ad2390617702e7d0ad239061770  thrpt   10   1958856,246   703216,214  ops/s
HttpTraceContextExtractBenchmark.measureExtract  68ec932c33b3f2ee  905734c59b913b4a905734c59b913b4a  thrpt   10   2083232,006   575294,967  ops/s
HttpTraceContextExtractBenchmark.measureExtract  68ec932c33b3f2ee  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10   1910702,868   612561,721  ops/s
HttpTraceContextInjectBenchmark.measureInject    9909983295041501  905734c59b913b4a905734c59b913b4a  thrpt   10  16236501,532  4914868,744  ops/s
HttpTraceContextInjectBenchmark.measureInject    9909983295041501  21196a77f299580e21196a77f299580e  thrpt   10  17014185,930  3358858,284  ops/s
HttpTraceContextInjectBenchmark.measureInject    9909983295041501  2e7d0ad2390617702e7d0ad239061770  thrpt   10  17062161,440  5118424,738  ops/s
HttpTraceContextInjectBenchmark.measureInject    9909983295041501  905734c59b913b4a905734c59b913b4a  thrpt   10  17727802,624  2303205,212  ops/s
HttpTraceContextInjectBenchmark.measureInject    9909983295041501  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10  16385836,677  4650707,584  ops/s
HttpTraceContextInjectBenchmark.measureInject    993a97ee3691eb26  905734c59b913b4a905734c59b913b4a  thrpt   10  17573641,146  3816123,153  ops/s
HttpTraceContextInjectBenchmark.measureInject    993a97ee3691eb26  21196a77f299580e21196a77f299580e  thrpt   10  14812990,763  7839888,653  ops/s
HttpTraceContextInjectBenchmark.measureInject    993a97ee3691eb26  2e7d0ad2390617702e7d0ad239061770  thrpt   10  16369064,971  4130374,459  ops/s
HttpTraceContextInjectBenchmark.measureInject    993a97ee3691eb26  905734c59b913b4a905734c59b913b4a  thrpt   10  18201567,375  2309411,168  ops/s
HttpTraceContextInjectBenchmark.measureInject    993a97ee3691eb26  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10  15317090,647  6261912,617  ops/s
HttpTraceContextInjectBenchmark.measureInject    d49582a2de984b86  905734c59b913b4a905734c59b913b4a  thrpt   10  16427963,542  5387944,506  ops/s
HttpTraceContextInjectBenchmark.measureInject    d49582a2de984b86  21196a77f299580e21196a77f299580e  thrpt   10  17197662,386  3352981,659  ops/s
HttpTraceContextInjectBenchmark.measureInject    d49582a2de984b86  2e7d0ad2390617702e7d0ad239061770  thrpt   10  15603153,355  3997896,303  ops/s
HttpTraceContextInjectBenchmark.measureInject    d49582a2de984b86  905734c59b913b4a905734c59b913b4a  thrpt   10  17688122,525  4613398,583  ops/s
HttpTraceContextInjectBenchmark.measureInject    d49582a2de984b86  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10  15048333,561  4731949,367  ops/s
HttpTraceContextInjectBenchmark.measureInject    776ff807b787538a  905734c59b913b4a905734c59b913b4a  thrpt   10  16006875,071  3768708,692  ops/s
HttpTraceContextInjectBenchmark.measureInject    776ff807b787538a  21196a77f299580e21196a77f299580e  thrpt   10  16806363,350  4453704,747  ops/s
HttpTraceContextInjectBenchmark.measureInject    776ff807b787538a  2e7d0ad2390617702e7d0ad239061770  thrpt   10  17909435,162  2807658,353  ops/s
HttpTraceContextInjectBenchmark.measureInject    776ff807b787538a  905734c59b913b4a905734c59b913b4a  thrpt   10  16527148,905  3688255,410  ops/s
HttpTraceContextInjectBenchmark.measureInject    776ff807b787538a  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10  17131247,471  4207623,511  ops/s
HttpTraceContextInjectBenchmark.measureInject    68ec932c33b3f2ee  905734c59b913b4a905734c59b913b4a  thrpt   10  17167537,071  3936160,781  ops/s
HttpTraceContextInjectBenchmark.measureInject    68ec932c33b3f2ee  21196a77f299580e21196a77f299580e  thrpt   10  16690901,608  3714511,673  ops/s
HttpTraceContextInjectBenchmark.measureInject    68ec932c33b3f2ee  2e7d0ad2390617702e7d0ad239061770  thrpt   10  15438115,033  4075059,125  ops/s
HttpTraceContextInjectBenchmark.measureInject    68ec932c33b3f2ee  905734c59b913b4a905734c59b913b4a  thrpt   10  18125053,622  2149601,783  ops/s
HttpTraceContextInjectBenchmark.measureInject    68ec932c33b3f2ee  68ec932c33b3f2ee68ec932c33b3f2ee  thrpt   10  14308599,823  5389188,787  ops/s

@jkwatson i think we should have some hardware to run performance tests on, also i have issue with encoding on windows dunno how to solve for now
image

  • we need ability to create jmh report file, it will be much more easier to look on graphics with smth like https://jmh.morethan.io/ than raw numbers

Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

looks good!

@bogdandrutu
Copy link
Member

First: Results are very hard to read, in opencensus I used jmhreport https:/census-instrumentation/opencensus-java/blob/master/build.gradle#L17 to expose things in a nicer format.

Second: I am very confused about the fact that we want to benchmark with different inputs, I think we should just create N random TraceParent (don't measure this) then extract all of them.

@DotSpy
Copy link
Member Author

DotSpy commented Feb 12, 2020

Thanks for response @bogdandrutu, i will add this plugin. After i will show u result with it
About N traces i think it much more clearer to work with One method in benchmark but not with N because JMH stands for Microbenchmark, it is not suggested to use loops to iterate over N traceparents and feed them in benchmark https://hg.openjdk.java.net/code-tools/jmh/file/a61ab96aafb9/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_11_Loops.java
also if we wanna see the time for N we can use results of current N tests

@bogdandrutu
Copy link
Member

@DotSpy my point is that because we have a lot of combinations span_id/trace_id the benchmarks run only 10 time each, so the numbers are not very stable/relevant. So my suggestion was to actually have maybe just one span_id/trace_id combination and have that benchmark run more times to be able to determine the average better.

@DotSpy
Copy link
Member Author

DotSpy commented Feb 12, 2020

@bogdandrutu i just pre-generated a bunch of random trace/span ids as we discuss in comments with @jkwatson and @carlosalberto, i think it will be good for now just increase iterations to 50 per pair of span-id\trace-id.
btw what are u thinking about switching to https:/melix/jmh-gradle-plugin so we can easy pass such params to jmh as generating result files and etc?

@bogdandrutu
Copy link
Member

@DotSpy I am still confused why we need to have only 50 iterations, in my previous life I used to have 100K iterations to see something useful (like percentile, etc.). I would strongly suggest to have more than 10K anyway.

I think what we can do is to build a vector of trace-parents with these ideas and do something like:
every iteration we use trace_parents[iter % num_trace_parents]

@DotSpy
Copy link
Member Author

DotSpy commented Feb 15, 2020

@bogdandrutu if i got u right i did it with iterations\params, should i provide now results via jmhReport plugin?

@bogdandrutu
Copy link
Member

@DotSpy nice, this looks how I was thinking :). Some new results would be very good :)

@DotSpy
Copy link
Member Author

DotSpy commented Feb 17, 2020

image
Done

@DotSpy
Copy link
Member Author

DotSpy commented Feb 17, 2020

CI will fail until #866 merged

@DotSpy
Copy link
Member Author

DotSpy commented Feb 18, 2020

Please rerun CI and if all ok it can be merged

@bogdandrutu
Copy link
Member

Did you rebase?

@DotSpy
Copy link
Member Author

DotSpy commented Feb 18, 2020

@bogdandrutu sry, now seems ok

@bogdandrutu bogdandrutu merged commit 1fced48 into open-telemetry:master Feb 18, 2020
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.

6 participants