You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/03/22 22:13:44 UTC

[GitHub] merlimat closed pull request #1422: Performance consumer end-to-end latency can be negative when running ���

merlimat closed pull request #1422: Performance consumer end-to-end latency can be negative when running …
URL: https://github.com/apache/incubator-pulsar/pull/1422
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
index e508412e6..12ee1b607 100644
--- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
+++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
@@ -202,8 +202,10 @@ public static void main(String[] args) throws Exception {
             }
 
             long latencyMillis = System.currentTimeMillis() - msg.getPublishTime();
-            recorder.recordValue(latencyMillis);
-            cumulativeRecorder.recordValue(latencyMillis);
+            if (latencyMillis >= 0) {
+                recorder.recordValue(latencyMillis);
+                cumulativeRecorder.recordValue(latencyMillis);
+            }
 
             consumer.acknowledgeAsync(msg);
         };
@@ -304,20 +306,14 @@ public void run() {
             double rate = messagesReceived.sumThenReset() / elapsed;
             double throughput = bytesReceived.sumThenReset() / elapsed * 8 / 1024 / 1024;
 
-            log.info("Throughput received: {}  msg/s -- {} Mbit/s", dec.format(rate), dec.format(throughput));
-
             reportHistogram = recorder.getIntervalHistogram(reportHistogram);
 
             log.info(
                     "Throughput received: {}  msg/s -- {} Mbit/s --- Latency: mean: {} ms - med: {} - 95pct: {} - 99pct: {} - 99.9pct: {} - 99.99pct: {} - Max: {}",
-                    dec.format(rate), dec.format(throughput),
-                    dec.format(reportHistogram.getMean()),
-                    dec.format(reportHistogram.getValueAtPercentile(50)),
-                    dec.format(reportHistogram.getValueAtPercentile(95)),
-                    dec.format(reportHistogram.getValueAtPercentile(99)),
-                    dec.format(reportHistogram.getValueAtPercentile(99.9)),
-                    dec.format(reportHistogram.getValueAtPercentile(99.99)),
-                    dec.format(reportHistogram.getMaxValue()));
+                    dec.format(rate), dec.format(throughput), dec.format(reportHistogram.getMean()),
+                    (long) reportHistogram.getValueAtPercentile(50), (long) reportHistogram.getValueAtPercentile(95),
+                    (long) reportHistogram.getValueAtPercentile(99), (long) reportHistogram.getValueAtPercentile(99.9),
+                    (long) reportHistogram.getValueAtPercentile(99.99), (long) reportHistogram.getMaxValue());
 
             reportHistogram.reset();
             oldTime = now;
@@ -325,19 +321,16 @@ public void run() {
 
         pulsarClient.close();
     }
+
     private static void printAggregatedStats() {
         Histogram reportHistogram = cumulativeRecorder.getIntervalHistogram();
 
         log.info(
                 "Aggregated latency stats --- Latency: mean: {} ms - med: {} - 95pct: {} - 99pct: {} - 99.9pct: {} - 99.99pct: {} - 99.999pct: {} - Max: {}",
-                dec.format(reportHistogram.getMean() / 1000.0),
-                dec.format(reportHistogram.getValueAtPercentile(50)),
-                dec.format(reportHistogram.getValueAtPercentile(95)),
-                dec.format(reportHistogram.getValueAtPercentile(99)),
-                dec.format(reportHistogram.getValueAtPercentile(99.9)),
-                dec.format(reportHistogram.getValueAtPercentile(99.99)),
-                dec.format(reportHistogram.getValueAtPercentile(99.999)),
-                dec.format(reportHistogram.getMaxValue()));
+                dec.format(reportHistogram.getMean()), (long) reportHistogram.getValueAtPercentile(50),
+                (long) reportHistogram.getValueAtPercentile(95), (long) reportHistogram.getValueAtPercentile(99),
+                (long) reportHistogram.getValueAtPercentile(99.9), (long) reportHistogram.getValueAtPercentile(99.99),
+                (long) reportHistogram.getValueAtPercentile(99.999), (long) reportHistogram.getMaxValue());
     }
 
     private static final Logger log = LoggerFactory.getLogger(PerformanceConsumer.class);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services