-
Bug
-
Resolution: Done
-
Major
-
1.3.4.Final
-
None
When multiple threads are writing to the same output channel, I'm seeing a lot of lock contention in AbstractFramedChannel.queueFrame.
I'm wondering if it would be possible to reduce this contention within undertow. I know I can open multiple channels, but I'd like to avoid that if this problem can be solved in the underlying channel.
This is particularly impactful because I'm trying to send the frame asynchronously to limit blocking.
Here is the stacktrace on the frequently blocked threads:
server-17 [BLOCKED] io.undertow.server.protocol.framed.AbstractFramedChannel.queueFrame(AbstractFramedStreamSinkChannel) io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.queueFinalFrame() io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.shutdownWrites() io.undertow.websockets.core.WebSockets.flushChannelAsync(WebSocketChannel, WebSocketCallback, StreamSinkFrameChannel, Object, long) io.undertow.websockets.core.WebSockets.sendInternal(ByteBuffer, WebSocketFrameType, WebSocketChannel, WebSocketCallback, long) io.undertow.websockets.core.WebSockets.sendBinary(ByteBuffer, WebSocketChannel, WebSocketCallback, long) io.undertow.websockets.jsr.WebSocketSessionRemoteEndpoint$AsyncWebSocketSessionRemoteEndpoint.sendObjectImpl(Object, WebSocketCallback) io.undertow.websockets.jsr.WebSocketSessionRemoteEndpoint$AsyncWebSocketSessionRemoteEndpoint.sendObject(Object, SendHandler) ...snip...
And here is a screenshot of a thread states (via yourkit profiler) showing frequent blocking. All of the red sections are blocked at the above stacktrace.