1

I am implementing some real-time, collaborative features in an ASP.NET Web API based application using WebSockets and things are working fine when the app is deployed on a single web server.

When it is deployed on a farm behind a software (or hardware) load-balancer, I would like implement the pub-sub pattern to make any changes happening on one of the web servers invoke the same logic to check and push those changes via websocket to the clients connected to any of the other web servers.

I understand that this can be done if there an additional layer using RabbitMQ, Redis or some such pub/sub or messaging component.

But is there a way to use DNS or TCP broadcast or something that is already available on the Windows Server/IIS to publish the message to all the other sibling web-servers in the cluster?

Hari Pachuveetil
  • 10,294
  • 3
  • 45
  • 68
  • Do you know the DNS or IP addresses of all of the nodes in the cluster? Or at least one? You could think about having each node announce itself on app startup and then each system would know about the other. – matt_lethargic Nov 15 '18 at 11:10
  • Thanks @matt_lethargic - no since the application gets deployed to both on-prem and private/public cloud scenarios, there is no way of knowing the internal DNS names and/or the IP addresses for the web servers in advance (without more work to capture those for every environment at deployment time, that is) – Hari Pachuveetil Nov 16 '18 at 22:36
  • 1
    Was just reading about https://www.serf.io/ could be what you want, it's based on the Gossip protocol. Maybe a starting place – matt_lethargic Nov 22 '18 at 12:19

1 Answers1

1

No.

But you can use MSMQ instead of RabbitMQ, but still that's not really going to help as it's a queue and not pub/sub so ignore that.

If it's SignalR you're using there are plenty of docs on how to scale out like Introduction to Scaleout in SignalR

Even if it's not SignalR then you can probably get some ideas from there.

matt_lethargic
  • 2,706
  • 1
  • 18
  • 33