Gleiphir2769 commented on code in PR #991:
URL: https://github.com/apache/pulsar-client-go/pull/991#discussion_r1141897797


##########
pulsar/consumer_partition.go:
##########
@@ -1752,6 +1762,37 @@ func (pc *partitionConsumer) markScaleIfNeed() {
        }
 }
 
+func (pc *partitionConsumer) reserveMemory(size int64) {
+       pc.client.memLimit.ForceReserveMemory(size)
+       if pc.client.memLimit.CurrentUsagePercent() >= 
receiverQueueShrinkMemThreshold {

Review Comment:
   > In short, in this case, Memory is wasted on inactive consumers(consumer-1, 
consumer-2)
   
   OK, I see. But even in Java client, `reduceReceiverQueue()` can not free 
memory immediately. It just controls next flow to prefetch fewer messages. IMO, 
the memory limit on the consumer side is lazy. The memory will only be freed 
when pending messages are consumed.
   
   So I think this question can be summed up like this.
   - Even `memory limiter` can trigger all the consumers to reduce it's queue 
size. The actual memory release still depends on the consumer's consumption.
   - If the consumer is not active, even reducing the queue size will not 
reduce the memory.



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