mxsm opened a new issue, #11294:
URL: https://github.com/apache/dubbo/issues/11294

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.x
   * Operating System version: 
   * Java version: jdk8
   
   ### Steps to reproduce this issue
   [openjdk bug report](https://bugs.openjdk.org/browse/JDK-8161372) .
   Methods are used in many places
   
![image](https://user-images.githubusercontent.com/15797831/212445889-b779a2fc-7f9c-46fb-b64f-d593f22cc0f1.png)
   
   use JMH to test it:
   ```java
   import java.util.Map;
   import java.util.concurrent.ConcurrentHashMap;
   import org.openjdk.jmh.annotations.Benchmark;
   import org.openjdk.jmh.annotations.Fork;
   import org.openjdk.jmh.annotations.Level;
   import org.openjdk.jmh.annotations.Measurement;
   import org.openjdk.jmh.annotations.Scope;
   import org.openjdk.jmh.annotations.Setup;
   import org.openjdk.jmh.annotations.State;
   import org.openjdk.jmh.annotations.Threads;
   import org.openjdk.jmh.annotations.Warmup;
   
   
   @Warmup(iterations = 2, time = 5)
   @Measurement(iterations = 3, time = 5)
   @State(Scope.Benchmark)
   @Fork(2)
   public class HashMapBenchmark {
   
       private static final String KEY = "mxsm";
   
       private final Map<String, Object> concurrentMap = new 
ConcurrentHashMap<>();
   
       @Setup(Level.Iteration)
       public void setup() {
           concurrentMap.clear();
       }
   
       @Benchmark
       @Threads(16)
       public Object benchmarkGetBeforeComputeIfAbsent() {
           Object result = concurrentMap.get(KEY);
           if (null == result) {
               result = concurrentMap.computeIfAbsent(KEY, key -> 1);
           }
           return result;
       }
   
       @Benchmark
       @Threads(16)
       public Object benchmarkComputeIfAbsent() {
           return concurrentMap.computeIfAbsent(KEY, key -> 1);
       }
   
   }
   ```
   jdk version:
   openjdk version "1.8.0_312"
   OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~18.04-b07)
   OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
   ```
   root@GZYZFA00088591:/mnt/d/develop/github/benchmark/dledger-benchmark# java 
-jar target/dledger-benchmarks.jar 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark
   # JMH version: 1.35
   # VM version: JDK 1.8.0_312, OpenJDK 64-Bit Server VM, 25.312-b07
   # VM invoker: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
   # VM options: <none>
   # Blackhole mode: full + dont-inline hint (auto-detected, use 
-Djmh.blackhole.autoDetect=false to disable)
   # Warmup: 2 iterations, 5 s each
   # Measurement: 3 iterations, 5 s each
   # Timeout: 10 min per iteration
   # Threads: 16 threads, will synchronize iterations
   # Benchmark mode: Throughput, ops/time
   # Benchmark: 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent
   
   # Run progress: 0.00% complete, ETA 00:01:40
   # Fork: 1 of 2
   # Warmup Iteration   1: 42984830.445 ops/s
   # Warmup Iteration   2: 38416032.086 ops/s
   Iteration   1: 39423217.883 ops/s
   Iteration   2: 41176380.793 ops/s
   Iteration   3: 41146374.512 ops/s
   
   # Run progress: 25.00% complete, ETA 00:01:15
   # Fork: 2 of 2
   # Warmup Iteration   1: 42000026.386 ops/s
   # Warmup Iteration   2: 37801042.365 ops/s
   Iteration   1: 38829603.637 ops/s
   Iteration   2: 39873697.470 ops/s
   Iteration   3: 39745609.268 ops/s
   
   
   Result 
"com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent":
     40032480.594 ±(99.9%) 2652852.116 ops/s [Average]
     (min, avg, max) = (38829603.637, 40032480.594, 41176380.793), stdev = 
946032.620
     CI (99.9%): [37379628.478, 42685332.710] (assumes normal distribution)
   
   
   # JMH version: 1.35
   # VM version: JDK 1.8.0_312, OpenJDK 64-Bit Server VM, 25.312-b07
   # VM invoker: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
   # VM options: <none>
   # Blackhole mode: full + dont-inline hint (auto-detected, use 
-Djmh.blackhole.autoDetect=false to disable)
   # Warmup: 2 iterations, 5 s each
   # Measurement: 3 iterations, 5 s each
   # Timeout: 10 min per iteration
   # Threads: 16 threads, will synchronize iterations
   # Benchmark mode: Throughput, ops/time
   # Benchmark: 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent
   
   # Run progress: 50.00% complete, ETA 00:00:50
   # Fork: 1 of 2
   # Warmup Iteration   1: 867041643.912 ops/s
   # Warmup Iteration   2: 879285059.514 ops/s
   Iteration   1: 946381466.173 ops/s
   Iteration   2: 829405048.842 ops/s
   Iteration   3: 904068960.001 ops/s
   
   # Run progress: 75.00% complete, ETA 00:00:25
   # Fork: 2 of 2
   # Warmup Iteration   1: 801375284.635 ops/s
   # Warmup Iteration   2: 1023301849.860 ops/s
   Iteration   1: 864155832.112 ops/s
   Iteration   2: 939504012.429 ops/s
   Iteration   3: 913166819.166 ops/s
   
   
   Result 
"com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent":
     899447023.121 ±(99.9%) 126458224.528 ops/s [Average]
     (min, avg, max) = (829405048.842, 899447023.121, 946381466.173), stdev = 
45096221.050
     CI (99.9%): [772988798.593, 1025905247.649] (assumes normal distribution)
   
   
   # Run complete. Total time: 00:01:41
   
   REMEMBER: The numbers below are just data. To gain reusable insights, you 
need to follow up on
   why the numbers are the way they are. Use profilers (see -prof, -lprof), 
design factorial
   experiments, perform baseline and negative tests that provide experimental 
control, make sure
   the benchmarking environment is safe on JVM/OS/HW level, ask for reviews 
from the domain experts.
   Do not assume the numbers tell you what you want them to tell.
   
   Benchmark                                                      Mode  Cnt     
     Score           Error  Units
   ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent           thrpt    6   
40032480.594 ±   2652852.116  ops/s
   ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent  thrpt    6  
899447023.121 ± 126458224.528  ops/s
   ```
   jdk11 version:
   openjdk version "11.0.14.1" 2022-02-08
   OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.18.04)
   OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.18.04, mixed 
mode, sharing)
   ```
   root@GZYZFA00088591:/mnt/d/develop/github/benchmark/dledger-benchmark# java 
-jar target/dledger-benchmarks.jar 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark
   WARNING: An illegal reflective access operation has occurred
   WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils 
(file:/mnt/d/develop/github/benchmark/dledger-benchmark/target/dledger-benchmarks.jar)
 to method java.io.Console.encoding()
   WARNING: Please consider reporting this to the maintainers of 
org.openjdk.jmh.util.Utils
   WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
   WARNING: All illegal access operations will be denied in a future release
   # JMH version: 1.35
   # VM version: JDK 11.0.14.1, OpenJDK 64-Bit Server VM, 
11.0.14.1+1-Ubuntu-0ubuntu1.18.04
   # VM invoker: /usr/lib/jvm/java-11-openjdk-amd64/bin/java
   # VM options: <none>
   # Blackhole mode: full + dont-inline hint (auto-detected, use 
-Djmh.blackhole.autoDetect=false to disable)
   # Warmup: 2 iterations, 5 s each
   # Measurement: 3 iterations, 5 s each
   # Timeout: 10 min per iteration
   # Threads: 16 threads, will synchronize iterations
   # Benchmark mode: Throughput, ops/time
   # Benchmark: 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent
   
   # Run progress: 0.00% complete, ETA 00:01:40
   # Fork: 1 of 2
   # Warmup Iteration   1: 734790850.730 ops/s
   # Warmup Iteration   2: 723040919.893 ops/s
   Iteration   1: 641529840.743 ops/s
   Iteration   2: 711719044.738 ops/s
   Iteration   3: 683114525.450 ops/s
   
   # Run progress: 25.00% complete, ETA 00:01:16
   # Fork: 2 of 2
   # Warmup Iteration   1: 658869896.647 ops/s
   # Warmup Iteration   2: 634635199.677 ops/s
   Iteration   1: 682154939.057 ops/s
   Iteration   2: 684056273.846 ops/s
   Iteration   3: 684466801.465 ops/s
   
   
   Result 
"com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent":
     681173570.883 ±(99.9%) 63060380.600 ops/s [Average]
     (min, avg, max) = (641529840.743, 681173570.883, 711719044.738), stdev = 
22487939.188
     CI (99.9%): [618113190.283, 744233951.483] (assumes normal distribution)
   
   
   # JMH version: 1.35
   # VM version: JDK 11.0.14.1, OpenJDK 64-Bit Server VM, 
11.0.14.1+1-Ubuntu-0ubuntu1.18.04
   # VM invoker: /usr/lib/jvm/java-11-openjdk-amd64/bin/java
   # VM options: <none>
   # Blackhole mode: full + dont-inline hint (auto-detected, use 
-Djmh.blackhole.autoDetect=false to disable)
   # Warmup: 2 iterations, 5 s each
   # Measurement: 3 iterations, 5 s each
   # Timeout: 10 min per iteration
   # Threads: 16 threads, will synchronize iterations
   # Benchmark mode: Throughput, ops/time
   # Benchmark: 
com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent
   
   # Run progress: 50.00% complete, ETA 00:00:50
   # Fork: 1 of 2
   # Warmup Iteration   1: 913175624.693 ops/s
   # Warmup Iteration   2: 889999077.476 ops/s
   Iteration   1: 755423064.811 ops/s
   Iteration   2: 819973081.401 ops/s
   Iteration   3: 819069238.312 ops/s
   
   # Run progress: 75.00% complete, ETA 00:00:25
   # Fork: 2 of 2
   # Warmup Iteration   1: 755788304.744 ops/s
   # Warmup Iteration   2: 749372817.128 ops/s
   Iteration   1: 840515776.127 ops/s
   Iteration   2: 872478443.625 ops/s
   Iteration   3: 848340384.022 ops/s
   
   
   Result 
"com.github.mxsm.dledger.benchmark.ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent":
     825966664.716 ±(99.9%) 111714396.868 ops/s [Average]
     (min, avg, max) = (755423064.811, 825966664.716, 872478443.625), stdev = 
39838430.078
     CI (99.9%): [714252267.848, 937681061.585] (assumes normal distribution)
   
   
   # Run complete. Total time: 00:01:41
   
   REMEMBER: The numbers below are just data. To gain reusable insights, you 
need to follow up on
   why the numbers are the way they are. Use profilers (see -prof, -lprof), 
design factorial
   experiments, perform baseline and negative tests that provide experimental 
control, make sure
   the benchmarking environment is safe on JVM/OS/HW level, ask for reviews 
from the domain experts.
   Do not assume the numbers tell you what you want them to tell.
   
   Benchmark                                                      Mode  Cnt     
     Score           Error  Units
   ConcurrentHashMapBenchmark.benchmarkComputeIfAbsent           thrpt    6  
681173570.883 ±  63060380.600  ops/s
   ConcurrentHashMapBenchmark.benchmarkGetBeforeComputeIfAbsent  thrpt    6  
825966664.716 ± 111714396.868  ops/s
   ```
   jdk version >= 9 has fixed it.  RocketMQ run on jdk8+ so we need to solve it.
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   
   <!-- What do you expect from the above steps?-->
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   If there is an exception, please attach the exception trace:
   
   ```
   Just put your stack trace here!
   ```
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to