junrao commented on code in PR #13391: URL: https://github.com/apache/kafka/pull/13391#discussion_r1147794328
########## core/src/main/scala/kafka/network/RequestChannel.scala: ########## @@ -483,14 +493,10 @@ class RequestChannel(val queueSize: Int, def sendShutdownRequest(): Unit = requestQueue.put(ShutdownRequest) - // TODO: this is the most straightforward implementation, we may want to address fairness: - // The callback function is invoked as part of processing a request, so it already "stood in line" - // when the original request got accepted, so it may be unfair to make put to the end of the line. - // A simple solution would be to put it to the head of the line, but then multiple callbacks would - // be in LIFO order, which is weird. - // We may want to use a PriorityBlockingQueue or just have 2 queues and write customer wait / notify - // synchronization. - def sendCallbackRequest(request: CallbackRequest): Unit = requestQueue.put(request) + def sendCallbackRequest(request: CallbackRequest): Unit = { + callbackQueue.put(request) Review Comment: It would go to the end of the action queue. However, not every request adds entries to the action queue. So, the action queue is typically smaller than the request queue. Also, request threads prioritize the action queue over the request queue. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org