Base solution for your next web application
Open Closed

SignalR slowness on Azure #4679


User avatar
0
Ricavir created

Hi,

My app is running on Azure for several month now. I've an Azure Standard subscription (S1) : CPU usage is about 2/3% and Memory usage arround 45%. When trying to chat to an other user, the message sent takes some seconds to be displayed in the chat list (4s to 10s sometimes) Also, when pressing Enter key, the chat message remains in the input field before being displayed in the chat list. In some cases, one message sent can be displayed twice (??)

This behavior is very frustrating when trying to chat with an other user.

Do you have an idea how to improve this ?


7 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    add some console.log() in chat client, when you press enter on chat, show the duration elapsed in the client-side and send server logs to understand which part is time consuming.

    beside; when you chat on your local dev environment, is it faster or behaves different?

  • User Avatar
    0
    Ricavir created

    I've tested a demo on your server and I have same behavior. URL is <a class="postlink" href="http://elevensoft.demo.aspnetzero.com">http://elevensoft.demo.aspnetzero.com</a>

    I have captured this issue on a MP4 file (not allowed has attachment on this forum), I can send it to you by mail if you provide one. With this video you can have an idea of the delays.

    It's same behavior on my Azure server. On my dev machine I didn't notice such big delays.

  • User Avatar
    0
    strix20 created

    What version of the app are you using?

    If it's targeting old SignalR (SignalR 2 using full framework), this does not support web sockets, which means signalR is falling back to long polling.

    I've always had issues with response times on long polling.

  • User Avatar
    0
    alper created
    Support Team

    thanks @Strix20 yeap that would be the case! websockets is the fastest one. if it fallsback to polling then you see some delay

  • User Avatar
    0
    Ricavir created

    I'm using latest template version 5.1.0. Abp.Web.SignalR v3.4.0 which has a dependency to package Microsoft.AspNet.SignalR.Core 2.2.2

    If I'm not wrong, this is the latest SignalR version.

    WebSockets are activated on my azure settings.

  • User Avatar
    0
    Ricavir created

    Tested several cases :

    My app in chrome is using longPolling My app in edge is using foreverFrame Demo app in aspnetzero server and chrome is using serverSentEvents

    I noticed quite same behaviors and delays : sometimes very fast, sometimes very long...

    So I tested this URL : http://{your-server}/signalr/negotiate?

    And you will notice that : "TryWebSockets":false Which means that WebSockets are not being used or even started on server side

    Look at this link :[https://github.com/aspnet/SignalR/issues/435])

    A workaround has been found to activate SignalR WebSockets on CORE projects.

    Would it be possible to add this workarround to next release of aspnetzero template ?

  • User Avatar
    0
    alper created
    Support Team

    hi,

    As per @jkells comment we don't support running SignalR 2 in ASP.NET Core apps and there are no plans to support this scenario.

    <a class="postlink" href="https://github.com/aspnet/SignalR/issues/435#issuecomment-299907817">https://github.com/aspnet/SignalR/issue ... -299907817</a>

    Currently the WebSocket feature is being enabled with some hack tricks in Core so Asp.Net Zero cannot provide this kind of hack in provided solution.

    You can try out this solution <a class="postlink" href="https://github.com/aspnet/SignalR/issues/435#issuecomment-299907817">https://github.com/aspnet/SignalR/issue ... -299907817</a>