karan kumar created KAFKA-8563: ---------------------------------- Summary: Minor: Remove method call in netoworkSend Key: KAFKA-8563 URL: https://issues.apache.org/jira/browse/KAFKA-8563 Project: Kafka Issue Type: Improvement Components: clients Affects Versions: 2.4.0 Environment: Darwin WM-CXXXXXX 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
ProductName: Mac OS X ProductVersion: 10.14.3 Reporter: karan kumar There was a [https://github.com/apache/kafka/blob/93bf96589471acadfb90e57ebfecbd91f679f77b/clients/src/main/java/org/apache/kafka/common/network/NetworkSend.java#L30] which can be removed from the network send class. Initial JMH benchmarks suggest minimal improvement after removing this method call. Present network send JMH report: {code:java} // code placeholder running JMH with args [-f 2 ByteBufferSendBenchmark] # JMH version: 1.21 # VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09 # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/bin/java # VM options: <none> # Warmup: 5 iterations, 2000 ms each # Measurement: 5 iterations, 5000 ms each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time # Benchmark: org.apache.kafka.jmh.common.ByteBufferSendBenchmark.testMethod # Run progress: 0.00% complete, ETA 00:01:10 # Fork: 1 of 2 # Warmup Iteration 1: 38.961 ops/us # Warmup Iteration 2: 66.493 ops/us # Warmup Iteration 3: 63.502 ops/us # Warmup Iteration 4: 64.205 ops/us # Warmup Iteration 5: 63.676 ops/us Iteration 1: 63.537 ops/us Iteration 2: 63.863 ops/us Iteration 3: 58.472 ops/us Iteration 4: 62.780 ops/us Iteration 5: 63.454 ops/us # Run progress: 50.00% complete, ETA 00:00:35 # Fork: 2 of 2 # Warmup Iteration 1: 41.128 ops/us # Warmup Iteration 2: 66.872 ops/us # Warmup Iteration 3: 64.279 ops/us # Warmup Iteration 4: 64.307 ops/us # Warmup Iteration 5: 64.101 ops/us Iteration 1: 64.315 ops/us Iteration 2: 64.370 ops/us Iteration 3: 64.043 ops/us Iteration 4: 60.844 ops/us Iteration 5: 62.936 ops/us Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.testMethod": 62.861 ±(99.9%) 2.804 ops/us [Average] (min, avg, max) = (58.472, 62.861, 64.370), stdev = 1.854 CI (99.9%): [60.058, 65.665] (assumes normal distribution) # Run complete. Total time: 00:01:10 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 ByteBufferSendBenchmark.testMethod thrpt 10 62.861 ± 2.804 ops/us {code} and after removing the method call {code:java} // code placeholder running JMH with args [-f 2 ByteBufferSendBenchmark] # JMH version: 1.21 # VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09 # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/bin/java # VM options: <none> # Warmup: 5 iterations, 2000 ms each # Measurement: 5 iterations, 5000 ms each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time # Benchmark: org.apache.kafka.jmh.common.ByteBufferSendBenchmark.testMethod # Run progress: 0.00% complete, ETA 00:01:10 # Fork: 1 of 2 # Warmup Iteration 1: 40.512 ops/us # Warmup Iteration 2: 67.002 ops/us # Warmup Iteration 3: 63.399 ops/us # Warmup Iteration 4: 63.288 ops/us # Warmup Iteration 5: 63.776 ops/us Iteration 1: 63.539 ops/us Iteration 2: 63.204 ops/us Iteration 3: 63.114 ops/us Iteration 4: 63.106 ops/us Iteration 5: 63.708 ops/us # Run progress: 50.00% complete, ETA 00:00:35 # Fork: 2 of 2 # Warmup Iteration 1: 40.290 ops/us # Warmup Iteration 2: 65.076 ops/us # Warmup Iteration 3: 62.961 ops/us # Warmup Iteration 4: 63.219 ops/us # Warmup Iteration 5: 63.380 ops/us Iteration 1: 63.186 ops/us Iteration 2: 63.411 ops/us Iteration 3: 63.427 ops/us Iteration 4: 63.441 ops/us Iteration 5: 63.483 ops/us Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.testMethod": 63.362 ±(99.9%) 0.303 ops/us [Average] (min, avg, max) = (63.106, 63.362, 63.708), stdev = 0.200 CI (99.9%): [63.059, 63.665] (assumes normal distribution) # Run complete. Total time: 00:01:10 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 ByteBufferSendBenchmark.testMethod thrpt 10 63.362 ± 0.303 ops/us JMH benchmarks done {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)