Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What If SignalR hub is hosted on multiple server?

I've one complex scenario.

I've one web application that will hold SignalR HUB.

This application will be hosted on multiple server.

For ex. Hub1 will be hosted on ServerA and ServerB.

Let say I have few clients on both ServerA and ServerB.

If some one broadcast some message on ServerA, then ServerB will be able to get that message (Even if I pass appropriate ConnectionID)?

like image 230
Mox Shah Avatar asked Mar 19 '14 10:03

Mox Shah


2 Answers

I think in SignalR 2.0 you can take a look at Introduction to Scaleout in SignalR.

I have not tested it, but the docs report that for example Microsoft.AspNet.SignalR.SqlServer will handle load balancing for you using SQL server.

Ref: http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-in-signalr

EDIT

Currently I'm using in production the REDIS backplane and it's simply great, simple to setup and inject in your code https://docs.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis

like image 181
Irvin Dominin Avatar answered Sep 23 '22 05:09

Irvin Dominin


Yes, but you need to use a backplane. There are a few supported ones, such as Redis or SQL.

I have used the SQL backplane which uses a table and a BLOB data column that will sync any users/groups/hubs/messages between all instances of SignalR. On application_start, you just add a single line of code to use the SQL backplane and it's all taken care of for you behind the scenes.

If performance is of extreme concern, go with Redis. If you want simplicity and ease of configuration, go with SQL.

http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-with-sql-server

like image 39
erickallemeyn Avatar answered Sep 25 '22 05:09

erickallemeyn