简体   繁体   中英

SignalR connections with backplate

We are trying to scale out our environment. I was using a ConnectionMapper class like the one here: http://www.asp.net/signalr/overview/guide-to-the-api/mapping-users-to-connections to keep a list of connections.

How would I make this work in a cluster (2 nodes)? would I implement a backplane? http://www.asp.net/signalr/overview/performance/scaleout-in-signalr

And then move the connection mappings to SQL DB?

This is for an MVC application.

Hmm you couldn't use something like the Connection Mapper with a backplane. The problem with in-memory mapping like that is that you wouldn't be able to communicate between the nodes without using your database table but that would also be painful (a lookup in the db for each message sent?).

You would do better by using groups (ie adding each user from the company ABC to the "ABC" group - or perhaps use a unique id such as companyId from a database table. Once you've got it using groups on one node then you can start using a backplane...

Groups docs: http://www.asp.net/signalr/overview/guide-to-the-api/working-with-groups

But then again there are issues with using a backplane - ie what do you hope to achieve using a backplane? Take a look at what SignalR describe as the limitations of using a backplane in http://www.asp.net/signalr/overview/performance/scaleout-in-signalr . Backplane scaleout is a pain as there is a good chance it may have a lower message throughput and higher latency than a single node schenario... In the example of a game - you might be better off having each node being completely independent and guiding users to the correct node (so node A hosts games 1 - 8, and node B hosts games 9 - 16)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM