[ 
https://issues.apache.org/jira/browse/KAFKA-8563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

karan kumar updated KAFKA-8563:
-------------------------------
    Description: 
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 no performance penalty.

 

Present network send JMH report:

 
{code:java}
jmh-benchmarks git:(trunk) ✗ ./jmh.sh -f 2 ByteBufferSendBenchmark
running gradlew :jmh-benchmarks:clean :jmh-benchmarks:shadowJar in quiet mode
./jmh.sh: line 34: ../gradlew: No such file or directory
gradle build done
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.benchmarkMethod

# Run progress: 0.00% complete, ETA 00:01:10
# Fork: 1 of 2
# Warmup Iteration 1: 35.049 ops/us
# Warmup Iteration 2: 60.877 ops/us
# Warmup Iteration 3: 59.207 ops/us
# Warmup Iteration 4: 59.077 ops/us
# Warmup Iteration 5: 59.327 ops/us
Iteration 1: 58.516 ops/us
Iteration 2: 58.952 ops/us
Iteration 3: 58.596 ops/us
Iteration 4: 59.126 ops/us
Iteration 5: 58.557 ops/us

# Run progress: 50.00% complete, ETA 00:00:35
# Fork: 2 of 2
# Warmup Iteration 1: 36.377 ops/us
# Warmup Iteration 2: 61.741 ops/us
# Warmup Iteration 3: 59.683 ops/us
# Warmup Iteration 4: 59.571 ops/us
# Warmup Iteration 5: 59.351 ops/us
Iteration 1: 59.044 ops/us
Iteration 2: 59.107 ops/us
Iteration 3: 57.771 ops/us
Iteration 4: 59.648 ops/us
Iteration 5: 59.408 ops/us


Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.benchmarkMethod":
58.872 ±(99.9%) 0.806 ops/us [Average]
(min, avg, max) = (57.771, 58.872, 59.648), stdev = 0.533
CI (99.9%): [58.066, 59.679] (assumes normal distribution)


# Run complete. Total time: 00:01:11

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.benchmarkMethod thrpt 10 58.872 ± 0.806 ops/us*
JMH benchmarks done

{code}
and after removing the method call

 
{code:java}
// code placeholder

./jmh.sh: line 34: ../gradlew: No such file or directory
gradle build done
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.benchmarkMethod

# Run progress: 0.00% complete, ETA 00:01:10
# Fork: 1 of 2
# Warmup Iteration 1: 34.273 ops/us
# Warmup Iteration 2: 61.565 ops/us
# Warmup Iteration 3: 59.307 ops/us
# Warmup Iteration 4: 57.081 ops/us
# Warmup Iteration 5: 59.970 ops/us
Iteration 1: 59.657 ops/us
Iteration 2: 59.607 ops/us
Iteration 3: 59.931 ops/us
Iteration 4: 59.871 ops/us
Iteration 5: 59.504 ops/us

# Run progress: 50.00% complete, ETA 00:00:35
# Fork: 2 of 2
# Warmup Iteration 1: 38.849 ops/us
# Warmup Iteration 2: 62.525 ops/us
# Warmup Iteration 3: 58.492 ops/us
# Warmup Iteration 4: 59.954 ops/us
# Warmup Iteration 5: 60.017 ops/us
Iteration 1: 59.819 ops/us
Iteration 2: 60.102 ops/us
Iteration 3: 60.195 ops/us
Iteration 4: 59.975 ops/us
Iteration 5: 60.159 ops/us


Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.benchmarkMethod":
59.882 ±(99.9%) 0.359 ops/us [Average]
(min, avg, max) = (59.504, 59.882, 60.195), stdev = 0.237
CI (99.9%): [59.523, 60.241] (assumes normal distribution)


# Run complete. Total time: 00:01:11

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.benchmarkMethod thrpt 10 59.882 ± 0.359 ops/us*
JMH benchmarks done



{code}
 

  was:
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 no performance penalty.

 

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}
 


> Minor: Remove method call in networkSend. Rely on java's vargs 
> boxing/autoboxing
> --------------------------------------------------------------------------------
>
>                 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
> java version "1.8.0_201"
> Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
> Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
>            Reporter: karan kumar
>            Priority: Minor
>
> 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 no performance penalty.
>  
> Present network send JMH report:
>  
> {code:java}
> jmh-benchmarks git:(trunk) ✗ ./jmh.sh -f 2 ByteBufferSendBenchmark
> running gradlew :jmh-benchmarks:clean :jmh-benchmarks:shadowJar in quiet mode
> ./jmh.sh: line 34: ../gradlew: No such file or directory
> gradle build done
> 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.benchmarkMethod
> # Run progress: 0.00% complete, ETA 00:01:10
> # Fork: 1 of 2
> # Warmup Iteration 1: 35.049 ops/us
> # Warmup Iteration 2: 60.877 ops/us
> # Warmup Iteration 3: 59.207 ops/us
> # Warmup Iteration 4: 59.077 ops/us
> # Warmup Iteration 5: 59.327 ops/us
> Iteration 1: 58.516 ops/us
> Iteration 2: 58.952 ops/us
> Iteration 3: 58.596 ops/us
> Iteration 4: 59.126 ops/us
> Iteration 5: 58.557 ops/us
> # Run progress: 50.00% complete, ETA 00:00:35
> # Fork: 2 of 2
> # Warmup Iteration 1: 36.377 ops/us
> # Warmup Iteration 2: 61.741 ops/us
> # Warmup Iteration 3: 59.683 ops/us
> # Warmup Iteration 4: 59.571 ops/us
> # Warmup Iteration 5: 59.351 ops/us
> Iteration 1: 59.044 ops/us
> Iteration 2: 59.107 ops/us
> Iteration 3: 57.771 ops/us
> Iteration 4: 59.648 ops/us
> Iteration 5: 59.408 ops/us
> Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.benchmarkMethod":
> 58.872 ±(99.9%) 0.806 ops/us [Average]
> (min, avg, max) = (57.771, 58.872, 59.648), stdev = 0.533
> CI (99.9%): [58.066, 59.679] (assumes normal distribution)
> # Run complete. Total time: 00:01:11
> 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.benchmarkMethod thrpt 10 58.872 ± 0.806 ops/us*
> JMH benchmarks done
> {code}
> and after removing the method call
>  
> {code:java}
> // code placeholder
> ./jmh.sh: line 34: ../gradlew: No such file or directory
> gradle build done
> 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.benchmarkMethod
> # Run progress: 0.00% complete, ETA 00:01:10
> # Fork: 1 of 2
> # Warmup Iteration 1: 34.273 ops/us
> # Warmup Iteration 2: 61.565 ops/us
> # Warmup Iteration 3: 59.307 ops/us
> # Warmup Iteration 4: 57.081 ops/us
> # Warmup Iteration 5: 59.970 ops/us
> Iteration 1: 59.657 ops/us
> Iteration 2: 59.607 ops/us
> Iteration 3: 59.931 ops/us
> Iteration 4: 59.871 ops/us
> Iteration 5: 59.504 ops/us
> # Run progress: 50.00% complete, ETA 00:00:35
> # Fork: 2 of 2
> # Warmup Iteration 1: 38.849 ops/us
> # Warmup Iteration 2: 62.525 ops/us
> # Warmup Iteration 3: 58.492 ops/us
> # Warmup Iteration 4: 59.954 ops/us
> # Warmup Iteration 5: 60.017 ops/us
> Iteration 1: 59.819 ops/us
> Iteration 2: 60.102 ops/us
> Iteration 3: 60.195 ops/us
> Iteration 4: 59.975 ops/us
> Iteration 5: 60.159 ops/us
> Result "org.apache.kafka.jmh.common.ByteBufferSendBenchmark.benchmarkMethod":
> 59.882 ±(99.9%) 0.359 ops/us [Average]
> (min, avg, max) = (59.504, 59.882, 60.195), stdev = 0.237
> CI (99.9%): [59.523, 60.241] (assumes normal distribution)
> # Run complete. Total time: 00:01:11
> 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.benchmarkMethod thrpt 10 59.882 ± 0.359 ops/us*
> JMH benchmarks done
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to