michaeljmarshall commented on code in PR #15181:
URL: https://github.com/apache/pulsar/pull/15181#discussion_r853349053


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -2645,8 +2645,7 @@ public void startSendOperation(Producer producer, int 
msgSize, int numMessages)
         if (++pendingSendRequest == maxPendingSendRequests || 
isPublishRateExceeded) {
             // When the quota of pending send requests is reached, stop 
reading from socket to cause backpressure on
             // client connection, possibly shared between multiple producers
-            ctx.channel().config().setAutoRead(false);
-            recordRateLimitMetrics(producers);

Review Comment:
   > At the better implements, can reduce false statistics( when a serverCnx 
already disabled auto read, will not increment another once).
   
   Is there evidence that this metric was getting incremented unnecessarily or 
is this just an inferred conclusion? Is the issue you're trying to prevent that 
the producer could have auto-read set to false concurrently? Calling the 
`isAutoRead` method as a guard does not prevent the race condition, though it 
might decrease its probability, because we read from the volatile variable and 
then update it. The consequence of the race is pretty low since the rate limit 
metrics are just prometheus metrics.



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