dongeforever commented on code in PR #4601:
URL: https://github.com/apache/rocketmq/pull/4601#discussion_r923036244
##########
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:
##########
@@ -133,6 +134,21 @@ public class DefaultMQProducer extends ClientConfig
implements MQProducer {
*/
private TraceDispatcher traceDispatcher = null;
+ /**
+ * Indicate whether to block message when asynchronous sending traffic is
too heavy.
+ */
+ private boolean enableBackpressureForAsyncMode = false;
+
+ /**
+ * on BackpressureForAsyncMode, limit maximum number of on-going sending
async messages
+ */
+ private Semaphore semaphoreAsyncNum = new Semaphore(60000, true);
+
Review Comment:
expose the integer value instead of Semaphore directly.
It is better to initialize the semaphore in the constructor of
DefaultMQProducerImpl
##########
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:
##########
@@ -133,6 +134,21 @@ public class DefaultMQProducer extends ClientConfig
implements MQProducer {
*/
private TraceDispatcher traceDispatcher = null;
+ /**
+ * Indicate whether to block message when asynchronous sending traffic is
too heavy.
+ */
+ private boolean enableBackpressureForAsyncMode = false;
+
+ /**
+ * on BackpressureForAsyncMode, limit maximum number of on-going sending
async messages
+ */
+ private Semaphore semaphoreAsyncNum = new Semaphore(60000, true);
+
+ /**
+ * on BackpressureForAsyncMode, limit maximum message size of on-going
sending async messages
+ */
+ private Semaphore semaphoreAsyncSize = new Semaphore(512 * 1024 * 1024,
true);
+
Review Comment:
default to 100M is enough.
##########
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:
##########
@@ -133,6 +134,21 @@ public class DefaultMQProducer extends ClientConfig
implements MQProducer {
*/
private TraceDispatcher traceDispatcher = null;
+ /**
+ * Indicate whether to block message when asynchronous sending traffic is
too heavy.
+ */
+ private boolean enableBackpressureForAsyncMode = false;
+
+ /**
+ * on BackpressureForAsyncMode, limit maximum number of on-going sending
async messages
+ */
+ private Semaphore semaphoreAsyncNum = new Semaphore(60000, true);
+
Review Comment:
default to 10000 is enough.
--
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]