qxo commented on issue #3068: improve ContextManager.stopSpan performance: call ThreadLocal only once URL: https://github.com/apache/skywalking/pull/3068#issuecomment-511170161 Should we change ContextManager.get from "private" to "default", so I change commit JMH Benchmark for ContextManager ``` mvn exec:java -Dexec.mainClass="org.openjdk.jmh.Main" -Dexec.args="org.apache.skywalking.apm.agent.core.context.ContextManageStopSpanBenchmark -w 1 -r 1 -wi 5 -i 10 -f 0 -tu ms" -Dexec.classpathScope=test -f apm-sniffer/apm-agent-core/pom.xml # VM version: JDK 1.8.0_211, Java HotSpot(TM) 64-Bit Server VM, 25.211-b12 # VM invoker: D:\JDK\jdk1.8.0X64\jre\bin\java.exe # VM options: -Dclassworlds.conf=D:\maven\maven\bin\..\bin\m2.conf -Dmaven.home=D:\maven\maven\bin\.. -Dlibrary.jansi.path=D:\maven\maven\bin\..\lib\jansi-native -Dmaven.multiModuleProjectDirectory=E:\GitHub\dev4skywalking1 -Djava.library.path=D:/java/nativelib # Warmup: 5 iterations, 1 s each # Measurement: 10 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time the test T480 ComputerInfo [ CPU=8 cpu Intel Core(TM) i5-8250U CPU @ 1.60GHz 1800MHz SYS total:31 GB free:16 GB used:15 GB OS=Windows 8.1 amd64 6.3 ] Benchmark Mode Cnt Score Error Units Score/min ContextManageStopSpanBenchmark.getThreadLocalFour thrpt 10 24136.954 ± 392.072 ops/ms 1.000 ContextManageStopSpanBenchmark.getThreadLocalOnce1 thrpt 10 27836.886 ± 170.766 ops/ms 1.153 ContextManageStopSpanBenchmark.getThreadLocalTwice thrpt 10 26757.700 ± 349.324 ops/ms 1.109 ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
