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


##########
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:
   I think `shrink` revoked by `memory limiter` and revoked by `consumer` are 
equivalent.
   
   > One client instance has 1 producer instance and 3 consumer.
   > If 3 consumers run out of memory, the producer's production data will 
block.
   
   In this scenario, the Java client will also block. Because `consumer` use 
the `forceReserve`.
   
   By the way, is it necessary for the producer to trigger the consumer 
`shrink`? If the memory usage exceeds the threshold, the consumer will always 
shrink it's receiver queue, right?
   
   



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