You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Gleiphir2769 (via GitHub)" <gi...@apache.org> on 2023/03/20 08:52:54 UTC

[GitHub] [pulsar-client-go] Gleiphir2769 commented on a diff in pull request #991: [feat] Support consumer client memory limit

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

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