You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the client (or server) and the running app receives a Websocket message that is split over many frames CPU load is massive and it takes a very long time to parse the incoming frames concatenating the buffer and contract the message.
send a large amount of data to the server (a few MB is enough)
Notice how the CPU load on the server spikes and it takes ages to handle the incoming data even through the client was able to send it all very quickly without any real CPU load.
Expected behavior
The server should be able to handle a multi frame ws message without completely locking up the cpu core at 100%.
Running a profile suggesss that 71% of the cpu time is spent moving memory around.
and 28% is spend relocating the buffer
This seems related to the WebSocketFrameSequence.append method. It might well be better to make the WebSocketFrameSequence is it possible to create a ByteBuffer like object that just points to the underlying existing buffers rather than copies and decloates them?
The text was updated successfully, but these errors were encountered:
hishnash
changed the title
Massing CPU load when receiving multi frame WebSocket message
Massive 100% CPU load when receiving multi frame WebSocket message
Jul 22, 2021
I have tested debug and profile builds ( think profile build are almost identical to release right?) I will test again when I get back from the shops.
Looking at the code it does look like it is copying data for every frame, since the default frame size is quite small this does mean a lot! Of copy operations.
Describe the bug
When running the client (or server) and the running app receives a Websocket message that is split over many frames CPU load is massive and it takes a very long time to parse the incoming frames concatenating the buffer and contract the message.
To Reproduce
Expected behavior
The server should be able to handle a multi frame ws message without completely locking up the cpu core at 100%.
Environment
MacOS (this happens with or without the #95)
Additional context
Running a profile suggesss that 71% of the cpu time is spent moving memory around.
and 28% is spend relocating the buffer
This seems related to the
WebSocketFrameSequence.append
method. It might well be better to make theWebSocketFrameSequence
is it possible to create a ByteBuffer like object that just points to the underlying existing buffers rather than copies and decloates them?The text was updated successfully, but these errors were encountered: