Reputation: 2574
I'm using netty websocket dispatch message to custom virtual thread executor.
Network layer as this:
The scenario is send echo benchmark from client
<-> server
ArrayBlockingQueue
work like this snippet in server:
def routing(queue: ArrayBlockingQueue[InputMsg]): Unit = {
var inputMsg: InputMsg = null
while (true) {
inputMsg = queue.take()
// just simple response echo.
}
}
Besides, every websocket connection will new itself ArrayBlockingQueue
. There no many concurrrecy racing on take
method.
I'm profiling there with JProfiler
are a lot CPU time cost on queue.take()
. But doesn't it should be unmounted when block? and why not show the time cost on virtual thread underlying switch rather then take
method.
Upvotes: 0
Views: 92