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 2021/06/01 09:50:31 UTC

[GitHub] [pulsar] eolivelli opened a new pull request #10765: pulsar-perf: print total number of messages

eolivelli opened a new pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765


   
   ### Motivation
   
   When you run pulsar-perf manually or even in some automated job, it is very useful to see the progress, in terms of number of messages produced/consumed, this way you have a feedback about the progress of the execution.
   
   
   ### Modifications
   
   Add the total number of produced and consumed messages
   


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

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



[GitHub] [pulsar] lhotari commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
lhotari commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644495217



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       is `total` all messages that have been consumed? just wondering if `.sumThenReset` will actually do what it would expected to do, reset to 0 after returning the value?




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

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



[GitHub] [pulsar] eolivelli commented on pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#issuecomment-854663786


   @sijie can you please take a look again ?
   I removed that blank space.


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

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



[GitHub] [pulsar] lhotari commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
lhotari commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644549960



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       Thanks for the clarification.




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

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



[GitHub] [pulsar] eolivelli commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644544878



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       @lhotari this is really a good point.
   I tested it and it looks like it work very well, I mean the number is never reset, it is a always increasing value

##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       @lhotari I have retested it and you were right.
   
   I updated the patch.
   
   good catch !




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

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



[GitHub] [pulsar] sijie commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644914601



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
##########
@@ -453,15 +453,16 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-
-            double rate = messagesSent.sumThenReset() / elapsed;
+            long total = totalMessagesSent.sum();
+            double rate =  messagesSent.sumThenReset() / elapsed;

Review comment:
       ```suggestion
               double rate = messagesSent.sumThenReset() / elapsed;
   ```
   




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

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



[GitHub] [pulsar] lhotari commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
lhotari commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644495217



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       is `total` all messages that have been consumed? just wondering if `.sumThenReset` will actually do what it would expected to do, reset to 0 after returning the value?

##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       Thanks for the clarification.




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

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



[GitHub] [pulsar] eolivelli commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644655099



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       @lhotari I have retested it and you were right.
   
   I updated the patch.
   
   good catch !




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

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



[GitHub] [pulsar] sijie commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644914601



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
##########
@@ -453,15 +453,16 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-
-            double rate = messagesSent.sumThenReset() / elapsed;
+            long total = totalMessagesSent.sum();
+            double rate =  messagesSent.sumThenReset() / elapsed;

Review comment:
       ```suggestion
               double rate = messagesSent.sumThenReset() / elapsed;
   ```
   




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

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



[GitHub] [pulsar] eolivelli merged pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765


   


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

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



[GitHub] [pulsar] eolivelli commented on a change in pull request #10765: pulsar-perf: print total number of messages

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10765:
URL: https://github.com/apache/pulsar/pull/10765#discussion_r644544878



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -401,13 +403,15 @@ public static void main(String[] args) throws Exception {
 
             long now = System.nanoTime();
             double elapsed = (now - oldTime) / 1e9;
-            double rate = messagesReceived.sumThenReset() / elapsed;
+            long total = messagesReceived.sumThenReset();

Review comment:
       @lhotari this is really a good point.
   I tested it and it looks like it work very well, I mean the number is never reset, it is a always increasing value




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

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