Can I connect to any Unit with Upstream and SignalR?

UMS 1 Reputation point
2021-11-16T08:48:14.363+00:00

Hello,

I have a websocket server which handles connection to some devices (from third parties so I don't control their implementation).

My system was working fine with .NET framework on an app service until I figured out that app services have a max outbound IPs of 8000 connections in my case.

I need to move towards a more scalable server which brings me some questions.

My constraints : I need to keep a constant websocket open with the devices and be able to reach them at any time to send them messages (one by one).

I started looking into Azure app service Signal R (or the Web Pub Sub which seems very similar). The code and the pricing seems to fit my needs. Using the upstream feature I could also send custom messages to my devices.

However I don't understand the scaling part, it says each unit can contain 1000 devices.

All my devices are going to connect to myapp.com, 5000 of them so divided in 5 units. They are going to send me messages sent to Azure functions for analysis.

But if I decide to send a message to device n° 4300 do I need to know on which Unit it is? Can I reach it if I have several units?

I couldn't find the answer on azure's docs or signalr.

Thank you for your help

Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
121 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,321 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce Barker 801 Reputation points
    2021-11-16T15:55:23.983+00:00

    The azure signal/r has a builtin scale out service bus, so it looks like one service. Your application may need to scale out also, so be sure to design state management correctly.


  2. ajkuma 22,606 Reputation points Microsoft Employee
    2021-11-18T19:34:46.733+00:00

    UMS-2098, I see that you have posted the question on SO, I'd posted

    On this 'But if I decide to send a message to device n° 4300 do I need to know on which Unit it is? Can I reach it if I have several units?"

    No, you don’t need to. “Unit” here is just some concept to help you understand the capacity of the service.
    A service having Unit5 is a service has the ability to handle 5000 concurrent clients." Please also check this doc : Difference between SignalR unit and instance and SignalR pricing

    I'd also added this info on your SO thread.


  3. Bruce (SqlWork.com) 57,241 Reputation points
    2021-11-18T22:34:46.74+00:00

    it looks like you are doing your own websocket. web sockets are a persistent connection. when a controller action opens a web socket, that action does not return until the web socket is closed.

    typically you would use a static collection tying a particular web socket connection to a an id associated with the client at the other end, if you scale out, then move the static collection to a database, and include the server key. (redis is typically used). then when you want to send a message to a client(s) you lookup in the database, and send a message to the server with the connection, and have the server send the message to the correct web socket. you can use a reshape or have additional web sockets between the servers for server to server communication.

    if using signal/r as the hub, then in the action, in addition to a websocket to the client, you would open a connection to the hub. then the action's job is to relay messages between the hub and the client. if the client disconnects be sure to exit the hub.

    0 comments No comments