Question

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)?

Was it helpful?

Solution

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://learn.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top