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 2022/03/26 03:04:44 UTC

[GitHub] [pulsar] aloyszhang commented on a change in pull request #14494: [PIP-74] Support auto scaled consumer receiver queue

aloyszhang commented on a change in pull request #14494:
URL: https://github.com/apache/pulsar/pull/14494#discussion_r835703766



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
##########
@@ -411,10 +411,28 @@ public UnAckedMessageTracker getUnAckedMessageTracker() {
         return unsubscribeFuture;
     }
 
+    @Override
+    public void initReceiverQueueSize() {
+        if (conf.isAutoScaledReceiverQueueSizeEnabled()) {
+            // turn on autoScaledReceiverQueueSize
+            int size = Math.min(INITIAL_RECEIVER_QUEUE_SIZE, maxReceiverQueueSize);
+            if (batchReceivePolicy.getMaxNumMessages() > 0) {
+                // consumerImpl may store (half-1) permits locally.
+                size = Math.max(size, 2 * batchReceivePolicy.getMaxNumMessages() - 2);

Review comment:
       If `batchReceivePolicy.getMaxNumMessages()` is close or equal to `maxReceiverQueueSize`, will `size` exceed the  limit of `ConsumerBuilderImpl.receiverQueueSize()`?




-- 
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: commits-unsubscribe@pulsar.apache.org

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