shengminw opened a new pull request, #4601: URL: https://github.com/apache/rocketmq/pull/4601
[issue4599](https://github.com/apache/rocketmq/issues/4599) ## What is the purpose of the change In the current backpressure mechanism [pull request#4553](https://github.com/apache/rocketmq/pull/4553), the runner task is running directly relying on backpressure in NettyRemoting. ```java if (this.defaultMQProducer.isEnableBackpressureForAsyncMode()) { runnable.run(); } else { try { executor.submit(runnable); } catch (RejectedExecutionException e) { throw new MQClientException("executor rejected ", e); } } ``` To make a more accurate flow control mechanism, I re-build a backpressure mechanism based on the numbers of asyncSending messages threads and size of the message memory. ## Brief changelog 1. Use Semaphore to monitor pressure of sending message. semaphoreAsyncNum to limit maximum numbers of on-going sending async messages. semaphoreAsyncSize limit maximum message size of on-going sending async messages. 2. reserve using threadpool in backpressure mechanism. -- 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]
