Last post Sep 28, 2013 03:52 PM by davidfowl
Aug 23, 2013 05:29 PM|jcarpenter2|LINK
I'm developing a Windows Azure application where many worker roles generate data that needs to be sent to clients through SignalR. The clients connect to the SignalR hub via a few web roles.
Currently I am using the service bus backplane to connect the user-facing web roles with the message-generating worker roles. The problem is that the worker roles are subscribing to the topic that the SignalR backplane creates, even though they do not make
any connections with clients.
I end up getting much lower throughput out of the SignalR backplane topic, and need to scale out to multiple topics much sooner than if my worker roles did not create subscriptions.
Has this issue come up before? Any solutions, work-arounds, or ideas?
One possible solution would be for us to stop using the Service Bus backplane. We would create our own topic, and subscribe to it only from the roles that have connections with clients.
The problem with that solution is that Azure web roles get torn down when they don't receive web requests for a while. If we poll our topic for messages in a long-running thread on our web roles, and one of our web roles gets torn down, our clients will
suddenly stop getting data. We have had that problem in the past.
Of course, the SignalR service bus backplane must already be using its own long-running operation to poll the subscription for new messages to send. How do you guys deal with the possibility of a web role getting torn down with clients still connected?
(I've been spelunking through the SignalR code for a little bit, but haven't found anything)
Another possible solution would be to add an option called "DoNotHandleMessages" or something to the ServiceBusScaleoutConfiguration class. Setting it to true would cause the ServiceBusMessageBus not to subscribe to the topic or handle messages. It would
still create TopicClients and send messages.
As a last resort I might take a crack at making this change myself. But that's pretty unlikely.
Aug 25, 2013 06:13 PM|davidfowl|LINK
So you're looking for a way to send messages from working roles but have them not subscribe to any topics? Why not just hack the service bus message bus to do what you want and use that on the worker roles (https://github.com/SignalR/SignalR/blob/master/src/Microsoft.AspNet.SignalR.ServiceBus/ServiceBusMessageBus.cs).
There's no built in way to do what you want. That would validate if doing the feature solves your problem. If it doesn't we can look at alternatives.
Aug 27, 2013 05:11 PM|jcarpenter2|LINK
You're right, I could totally just hack the ServiceBusMessageBus to get it to do what I want.
I just wanted to verify that I wasn't missing anything.
Sep 28, 2013 03:45 PM|paul3ad|LINK
We're in a similar situation here, and were second-guessing our Worker Role sending messages to the Service Bus (which our Web Roles distribute).
Did you try this @jcarpenter2? If so can you explain what you did? Just ensure that _connection.Subscribe is not called from the Worker Role?
@davidfowl - This seems like a common pattern (Worker Role -> adds to SB, Web Roles -> picks up from SB and delivers). Are there plans to update the master branch to include this? Or are there any reasons to avoid this?
(New to Azure, newer to SignalR, newest to Service Bus :-)
Sep 28, 2013 03:52 PM|davidfowl|LINK
I think the pattern is common enough that we'll add something to a future release. What release? no idea, I'll file a suggestion on github for it.