You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/02/24 05:46:36 UTC

[GitHub] [bookkeeper] michaeljmarshall opened a new pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCBQueueSize; JournalCBQueueSize should be bounded

michaeljmarshall opened a new pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623


   Descriptions of the changes in this PR:
   
   Fixes https://github.com/apache/bookkeeper/issues/2622.
   
   This PR only affects metrics. Specifically, it improves the usage of `JournalQueueSize` and `JournalCBQueueSize` (including `bookie_journal_JOURNAL_QUEUE_SIZE` and `bookie_journal_JOURNAL_CB_QUEUE_SIZE`).
   
   ### Motivation
   
   As mentioned in the issue, `bookie_journal_JOURNAL_CB_QUEUE_SIZE` grows unbounded. This PR looks to fix that, and in doing so, fixes `bookie_journal_JOURNAL_QUEUE_SIZE` as well.
   
   ### Changes
   
   The `bookie_journal_JOURNAL_CB_QUEUE_SIZE ` grows unbounded because it is never decremented. Ideally, it would measure the number of call backs outstanding for the Journal. I've updated the `Counter` object that is passed into the `QueueEntry` class so that the `Counter` is the one for the CB queue size. In changing that code, I also needed to update the way the `JournalQueueSize` was handled. I updated the code so that it gets incremented when adding elements to the queue and decremented when elements are removed. The journal queue size should represent the size of the actual `queue` variable in the `Journal` class.
   
   ### Note
   If my understanding of any of these metrics is off base, please question me. I'm new to this class, and while I read through it, I might have missed something. Thanks!


----------------------------------------------------------------
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] [bookkeeper] michaeljmarshall commented on a change in pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCbQueueSize; JournalCbQueueSize should be bounded

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on a change in pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623#discussion_r581647867



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -390,7 +390,6 @@ public int process(boolean shouldForceWrite) throws IOException {
                     if (qe != null) {
                         cbThreadPool.execute(qe);
                     }
-                    journalStats.getJournalCbQueueSize().inc();

Review comment:
       It's possible that we actually do want to increment the `JournalCbQueueSize` here, if we're looking to measure the number of call backs being run (or waiting to run on the `cbThreadPool`). The running of this `QueueEntry` will trigger the following:
   
   ```java
           public void run() {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Acknowledge Ledger: {}, Entry: {}", ledgerId, entryId);
               }
               journalCbQueueSize.dec();
               journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime), TimeUnit.NANOSECONDS);
               cb.writeComplete(0, ledgerId, entryId, null, ctx);
               recycle();
           }
   ```
   
   The PR currently assumes that we're measuring the number of call backs in the queue until the call back is executed and decrements the metric.




----------------------------------------------------------------
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] [bookkeeper] michaeljmarshall commented on pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCbQueueSize; JournalCbQueueSize should be bounded

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623#issuecomment-790925952


   @sijie and @eolivelli PTAL, thanks!


----------------------------------------------------------------
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] [bookkeeper] michaeljmarshall commented on a change in pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCbQueueSize; JournalCbQueueSize should be bounded

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on a change in pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623#discussion_r581647867



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -390,7 +390,6 @@ public int process(boolean shouldForceWrite) throws IOException {
                     if (qe != null) {
                         cbThreadPool.execute(qe);
                     }
-                    journalStats.getJournalCbQueueSize().inc();

Review comment:
       It's possible that we actually do want to increment the `JournalCbQueueSize` here, if we're looking to measure the number of call backs being run (or waiting to run on the `cbThreadPool`). The running of this `QueueEntry` will trigger the following:
   
   ```java
           public void run() {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Acknowledge Ledger: {}, Entry: {}", ledgerId, entryId);
               }
               journalCbQueueSize.dec();
               journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime), TimeUnit.NANOSECONDS);
               cb.writeComplete(0, ledgerId, entryId, null, ctx);
               recycle();
           }
   ```
   
   The PR currently assumes that we're measuring the number of call backs in the queue until the call back is executed and decrements the metric. As it currently is, the metric gets incremented whether or not we run the call back, which led to my initial decision for this PR.




----------------------------------------------------------------
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] [bookkeeper] michaeljmarshall commented on a change in pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCbQueueSize; JournalCbQueueSize should be bounded

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on a change in pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623#discussion_r581647867



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -390,7 +390,6 @@ public int process(boolean shouldForceWrite) throws IOException {
                     if (qe != null) {
                         cbThreadPool.execute(qe);
                     }
-                    journalStats.getJournalCbQueueSize().inc();

Review comment:
       It's possible that we actually do want to increment the `JournalCbQueueSize` here (or possibly within the above conditional block), if we're looking to measure the number of call backs being run (or waiting to run on the `cbThreadPool`). The running of this `QueueEntry` will trigger the following:
   
   ```java
           public void run() {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Acknowledge Ledger: {}, Entry: {}", ledgerId, entryId);
               }
               journalCbQueueSize.dec();
               journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime), TimeUnit.NANOSECONDS);
               cb.writeComplete(0, ledgerId, entryId, null, ctx);
               recycle();
           }
   ```
   
   The PR currently assumes that we're measuring the number of call backs in the queue until the call back is executed and decrements the metric. As it currently is, the metric gets incremented whether or not we run the call back, which led to my initial decision for this PR.




----------------------------------------------------------------
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] [bookkeeper] merlimat merged pull request #2623: Issue 2622: Fix usage of JournalQueueSize and JournalCbQueueSize; JournalCbQueueSize should be bounded

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #2623:
URL: https://github.com/apache/bookkeeper/pull/2623


   


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