[cleanup] [broker] when serverCnx disabled auto read use same implements#15181
Conversation
|
@michaeljmarshall could you take a look |
|
Sorry @315157973, accidentally re-requested your review. |
michaeljmarshall
left a comment
There was a problem hiding this comment.
@poorbarcode thanks for your contribution. I had a couple questions about your findings, but overall, the PR looks good to me.
Note that this might be a minor performance optimization for connections with many producers. However, it's probably minimal because once a connection has auto-read disabled, this code would only ever complete the current execution of this method and wouldn't call it again.
| // 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); |
There was a problem hiding this 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.
There was a problem hiding this comment.
is this just an inferred conclusion ?
yes
There was a problem hiding this comment.
is this just an inferred conclusion?
yes
|
@lhotari Could you help me, I do not know what to do. |
|
/pulsarbot run-failure-checks |
0ab7959 to
a4e3f9b
Compare
|
@gaoran10 Could you take a look |
|
/pulsarbot run-failure-checks |
|
@poorbarcode Please rebase to the master branch. |
a4e3f9b to
eb0070a
Compare
ok |
|
@gaoran10 Can this PR merge ^_^? |

Motivation
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Lines 2645 to 2652 in 732049f
L2468-L2469make serverCnx disabled auto read, but there has a beter implements atL2723-L2728:pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Lines 2723 to 2728 in 732049f
At the better implements, can reduce false statistics( when a serverCnx already disabled auto read, will not increment another once).
Documentation
doc-requiredno-need-docdocdoc-addeddoc-not-needed