matt-welch commented on code in PR #17340:
URL: https://github.com/apache/kafka/pull/17340#discussion_r1919344741


##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -506,6 +584,9 @@ public ConfigPostProcessor(ArgumentParser parser, String[] 
args) throws IOExcept
             if (numRecords != null && numRecords <= 0) {
                 throw new ArgumentParserException("--num-records should be 
greater than zero", parser);
             }
+            if (warmupRecords != null && warmupRecords >= numRecords) {

Review Comment:
   Done



##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -94,7 +98,18 @@ void start(String[] args) throws IOException {
                 record = new ProducerRecord<>(config.topicName, payload);
 
                 long sendStartMs = System.currentTimeMillis();
-                cb = new PerfCallback(sendStartMs, payload.length, stats);
+                if (config.warmupRecords > 0) {
+                    if (i < config.warmupRecords) {
+                        cb = new PerfCallback(sendStartMs, payload.length, 
stats);
+                    } else {
+                        if (i == config.warmupRecords) {
+                            steadyStateStats = new Stats(config.numRecords - 
config.warmupRecords, DEFAULT_REPORTING_INTERVAL_MS, config.warmupRecords > 0);

Review Comment:
   Hi @chia7712, to address your concern, I have temporarily added a DEBUG 
message that prints the value of config.warmupRecords and the value of the 
conditional (config.warmupRecords > 0) before the test.  Some sample output of 
running the test with various values of warmupRecords follows.  Note that, when 
negative values of warmupRecords are supplied on the CLI, we set 
config.warmupRecords to 0.
   
   ```
   # warmupRecords = -1
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup--1-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records -1
   DEBUG: config.warmupRecords=0, (config.warmupRecords > 0)=false
   49987 records sent, 9997.4 records/sec (9.76 MB/sec), 18.8 ms avg latency, 
290.0 ms max latency.
   50005 records sent, 10001.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
9.0 ms max latency.
   50019 records sent, 10001.8 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
9.0 ms max latency.
   50005 records sent, 10001.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50006 records sent, 9999.2 records/sec (9.76 MB/sec), 0.7 ms avg latency, 
3.0 ms max latency.
   49930 records sent, 9960.1 records/sec (9.73 MB/sec), 0.7 ms avg latency, 
22.0 ms max latency.
   50229 records sent, 10045.8 records/sec (9.81 MB/sec), 0.7 ms avg latency, 
23.0 ms max latency.
   50015 records sent, 10003.0 records/sec (9.77 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   49995 records sent, 9997.0 records/sec (9.76 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   500000 records sent, 9996.801024 records/sec (9.76 MB/sec), 2.49 ms avg 
latency, 290.00 ms max latency, 1 ms 50th, 1 ms 95th, 82 ms 99th, 219 ms 99.9th.
   
   # warmupRecords = 0
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup-0-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records 0
   DEBUG: config.warmupRecords=0, (config.warmupRecords > 0)=false
   49982 records sent, 9996.4 records/sec (9.76 MB/sec), 2.3 ms avg latency, 
177.0 ms max latency.
   50010 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
4.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
12.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
3.0 ms max latency.
   50020 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50008 records sent, 10001.6 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   500000 records sent, 9997.200784 records/sec (9.76 MB/sec), 0.83 ms avg 
latency, 177.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 44 ms 99.9th.
   
   # warmupRecords = 1
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup-1-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records 1
   DEBUG: config.warmupRecords=1, (config.warmupRecords > 0)=true
   Warmup first 1 records. Steady state results will print after the complete 
test summary.
   Beginning steady state.
   51651 records sent, 10328.1 records/sec (10.09 MB/sec), 2.7 ms avg latency, 
63.0 ms max latency.
   50015 records sent, 10003.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
3.0 ms max latency.
   49995 records sent, 9999.0 records/sec (9.76 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50013 records sent, 10002.6 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
3.0 ms max latency.
   50016 records sent, 10001.2 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50011 records sent, 10000.2 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
19.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   500000 records sent, 9997.800484 records/sec (9.76 MB/sec), 0.87 ms avg 
latency, 177.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 54 ms 99.9th.
   499999 steady state records sent, 10030.070211 records/sec (9.79 MB/sec), 
0.87 ms avg latency, 63.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 54 
ms 99.9th.
   
   # warmupRecords = 10000
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup-10000-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records 10000
   DEBUG: config.warmupRecords=10000, (config.warmupRecords > 0)=true
   Warmup first 10000 records. Steady state results will print after the 
complete test summary.
   Beginning steady state.
   49982 records sent, 9996.4 records/sec (9.76 MB/sec), 0.7 ms avg latency, 
4.0 ms max latency.
   50010 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
3.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50020 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
7.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
4.0 ms max latency.
   50009 records sent, 10001.8 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50001 records sent, 9998.2 records/sec (9.76 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   500000 records sent, 9996.201443 records/sec (9.76 MB/sec), 0.83 ms avg 
latency, 178.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 46 ms 99.9th.
   490000 steady state records sent, 9995.308325 records/sec (9.76 MB/sec), 
0.66 ms avg latency, 7.00 ms max latency, 1 ms 50th, 1 ms 95th, 1 ms 99th, 2 ms 
99.9th.
   
   # warmupRecords = 50000
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup-50000-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records 50000
   DEBUG: config.warmupRecords=50000, (config.warmupRecords > 0)=true
   Warmup first 50000 records. Steady state results will print after the 
complete test summary.
   Beginning steady state.
   49991 records sent, 9998.2 records/sec (9.76 MB/sec), 0.6 ms avg latency, 
3.0 ms max latency.
   50011 records sent, 10002.2 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
25.0 ms max latency.
   50010 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
12.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
4.0 ms max latency.
   50020 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   50020 records sent, 10002.0 records/sec (9.77 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   500000 records sent, 9997.600576 records/sec (9.76 MB/sec), 0.81 ms avg 
latency, 172.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 40 ms 99.9th.
   450000 steady state records sent, 9996.001599 records/sec (9.76 MB/sec), 
0.66 ms avg latency, 25.00 ms max latency, 1 ms 50th, 1 ms 95th, 1 ms 99th, 4 
ms 99.9th.
   
   # warmupRecords = 100000
   ./kafka-producer-perf-test.sh --producer.config 
../config/producer.properties --topic warmup-100000-records-test --num-records 
500000 --record-size 1024 --producer-props bootstrap.servers=127.0.0.1:9092 
acks=all compression.type=none batch.size=16384 linger.ms=0 --throughput 10000 
--warmup-records 100000
   DEBUG: config.warmupRecords=100000, (config.warmupRecords > 0)=true
   Warmup first 100000 records. Steady state results will print after the 
complete test summary.
   49994 records sent, 9996.8 records/sec (9.76 MB/sec), 2.2 ms avg latency, 
184.0 ms max latency.
   Beginning steady state.
   49991 records sent, 9994.2 records/sec (9.76 MB/sec), 0.6 ms avg latency, 
2.0 ms max latency.
   50006 records sent, 10001.2 records/sec (9.77 MB/sec), 0.9 ms avg latency, 
31.0 ms max latency.
   49995 records sent, 9999.0 records/sec (9.76 MB/sec), 0.6 ms avg latency, 
8.0 ms max latency.
   50020 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
4.0 ms max latency.
   50000 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10002.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
2.0 ms max latency.
   50010 records sent, 10000.0 records/sec (9.77 MB/sec), 0.7 ms avg latency, 
7.0 ms max latency.
   500000 records sent, 9997.200784 records/sec (9.76 MB/sec), 0.84 ms avg 
latency, 184.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 42 ms 99.9th.
   400000 steady state records sent, 9995.002499 records/sec (9.76 MB/sec), 
0.69 ms avg latency, 31.00 ms max latency, 1 ms 50th, 1 ms 95th, 2 ms 99th, 17 
ms 99.9th.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to