nowinkeyy commented on code in PR #5887:
URL: https://github.com/apache/rocketmq/pull/5887#discussion_r1098223451
##########
store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:
##########
@@ -2743,6 +2852,269 @@ public String getServiceName() {
}
+ class MainBatchDispatchRequestService extends ServiceThread {
+
+ private final ExecutorService batchDispatchRequestExecutor;
+
+ public MainBatchDispatchRequestService() {
+ batchDispatchRequestExecutor = new ThreadPoolExecutor(
+
DefaultMessageStore.this.getBrokerConfig().getBatchDispatchRequestThreadPoolNums(),
+
DefaultMessageStore.this.getBrokerConfig().getBatchDispatchRequestThreadPoolNums(),
+ 1000 * 60,
+ TimeUnit.MICROSECONDS,
+ new LinkedBlockingQueue<>(4096),
+ new
ThreadFactoryImpl("BatchDispatchRequestServiceThread_"),
+ new RejectedExecutionHandler() {
+ @Override
+ public void rejectedExecution(Runnable r,
ThreadPoolExecutor executor) {
+ try {
+ LOGGER.warn("Task {} is blocking put into the
workQueue", r);
Review Comment:
> I don't think using CallerRunsPolicy works well. Because when run() is
executed, the calling thread blocks waiting for a long time. Even after the
workQueue is idle, the calling thread continues to block for some time. In the
current way, the calling thread simply blocks and waits until the workQueue is
idle.
The run () execution process blocks because only requests within a window
(default size 16) can be put into the dispatchRequestOrderlyQueue, and requests
beyond the window range block waiting for placement.
If you use the CallerRunsPolicy strategy, when the work queue is full, the
calling thread must be executing run () requests that exceed the window scope,
causing the calling thread to wait too long to finish executing run ().
--
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]