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

Improve 4x performance of ContextManagerExtendService.createTraceCont… #698

Merged
merged 2 commits into from
Jun 22, 2024

Conversation

jiangyunpeng
Copy link
Contributor

Improve the performance of ContextManagerExtendService

The benchmark result:

* # JMH version: 1.33
* # VM version: JDK 11.0.21, Java HotSpot(TM) 64-Bit Server VM, 11.0.21+9-LTS-193
* # VM invoker: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/java
* # VM options: -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=60939:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8
* # Blackhole mode: full + dont-inline hint (default, use -Djmh.blackhole.autoDetect=true to auto-detect)
* # Warmup: 3 iterations, 10 s each
* # Measurement: 3 iterations, 10 s each
* # Timeout: 10 min per iteration
* # Threads: 1 thread, will synchronize iterations
* # Benchmark mode: Sampling time
* # Benchmark: org.apache.skywalking.apm.agent.core.context.IgnoreSuffixBenchmark.testHashSet
*
* Benchmark                                                Mode     Cnt        Score    Error   Units
* IgnoreSuffixBenchmark.testArray                         thrpt       3        0.007 ±  0.003  ops/ns
* IgnoreSuffixBenchmark.testHashSet                       thrpt       3        0.084 ±  0.035  ops/ns
* IgnoreSuffixBenchmark.testArray                        sample  823984      183.234 ± 11.201   ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.00        sample               41.000            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.50        sample              166.000            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.90        sample              167.000            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.95        sample              209.000            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.99        sample              375.000            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.999       sample             1124.630            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p0.9999      sample            29971.248            ns/op
* IgnoreSuffixBenchmark.testArray:testArray·p1.00        sample          1130496.000            ns/op
* IgnoreSuffixBenchmark.testHashSet                      sample  972621       27.117 ±  1.788   ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.00    sample                  ≈ 0            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.50    sample               41.000            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.90    sample               42.000            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.95    sample               42.000            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.99    sample               83.000            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.999   sample              167.000            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p0.9999  sample             6827.950            ns/op
* IgnoreSuffixBenchmark.testHashSet:testHashSet·p1.00    sample           478208.000            ns/op

CHANGES.md Outdated Show resolved Hide resolved
@wu-sheng wu-sheng added enhancement New feature or request core labels Jun 21, 2024
@wu-sheng wu-sheng added this to the 9.3.0 milestone Jun 21, 2024
@wu-sheng wu-sheng self-requested a review June 21, 2024 09:36
@wu-sheng
Copy link
Member

  Error:  src/test/java/org/apache/skywalking/apm/agent/core/context/IgnoreSuffixBenchmark.java:[21,35] (imports) AvoidStarImport: Using the '.*' form of import should be avoided - org.openjdk.jmh.annotations.*.
  Error:  src/test/java/org/apache/skywalking/apm/agent/core/context/IgnoreSuffixBenchmark.java:[22,8] (imports) UnusedImports: Unused import - org.openjdk.jmh.results.format.ResultFormatType.
  Error:  Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.2.1:check (validate) on project apm-agent-core: You have 2 Checkstyle violations. -> [Help 1]

I think you don't follow our code style. Please make sure you could pass the CI and local maven check/validation.

@jiangyunpeng
Copy link
Contributor Author

jiangyunpeng commented Jun 21, 2024

Ok, I have fixed

@wu-sheng wu-sheng merged commit 8200cf2 into apache:main Jun 22, 2024
189 of 190 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance of ContextManagerExtendService.createTraceContext()
2 participants