Owin.Websocket exceeding message size causes high processor load

I use the Owin.WebSocket library to receive an image stream in an ASPP ASPP application. I created a websocket using Owin.Websocket.WebSocketConnectionto receive messages from my Frontend.

 public class MyWebScoket : WebSocketConnection
 {
    protected MyWebScoket(int maxMessageSize = 65536) : base(maxMessageSize)
    {
       //logic
    }

    public override void OnClose(WebSocketCloseStatus? closeStatus, string closeStatusDescription)
    {
        //logic
    }

    public override Task OnMessageReceived(ArraySegment<byte> message, WebSocketMessageType type)
    {
        //logic
    }

    public override void OnOpen()
    {
        //logic
    }

    public override void OnReceiveError(Exception error)
    {
        //logic
    }
}

When the message size is below the set message size, the use of the API processor is normal, and everything works as it should, however, when the message size exceeds the limit, the use of the API processor increases significantly, as a result of which my machine stops responding even with a click of the mouse.

This seems strange, because the speed of sending a message is always the same.

What is the reason for this behavior?

, , , , OnReceiveError.

/ .

+4
1

, , . , , - owin , , , - 2-4%, , 10%, 5-8% 13-14% .

, , - owin , - .

- i7 -7700k 4 cors 8 , 100%, 2-3% 10-14% .

, , , , , - ,

, () , , , owin , RAM- , , .

+2

Source: https://habr.com/ru/post/1692861/


All Articles