Professional Documents
Culture Documents
Signalr - Scale Out Azure Website Via Service Bus: Prerequisites
Signalr - Scale Out Azure Website Via Service Bus: Prerequisites
au
SSW www.ssw.com.au
Australia Phone (+ 61) 2 9953 3000
IQueue
- Peek
- GetMessage
- DeleteMessage
Overview
Figure: We need to be able to scale our SignarlR implementation to support multiple web
servers. This is achieved via a Backplane. When hosting on Windows Azure, we use the
Service Bus Backplane (not SQL Server or Redis).
In Summary
- In SignalR, every message is sent through a message bus.
- The backplanes work by replacing the default IMessageBus with a bus designed for
that backplane.
- Each server instance connects to the backplane through the bus.
- When a message is sent, it goes to the backplane, and the backplane sends it to
every server.
- When a server gets a message from the backplane, it puts the message in its local
cache. The server then delivers messages to clients from its local cache.
- For each client connection, the client’s progress in reading the message stream is
tracked using a cursor. (A cursor represents a position in the message stream.)
- If a client disconnects and then reconnects, it asks the bus for any messages that
arrived after the client’s cursor value.
- The cursor mechanism works even if a client is routed to a different server on
reconnect.
- The backplane is aware of all the servers, and it doesn’t matter which server a client
connects to.
© SSW 563630605.docx Version: 15
Building software people understand. Our core competency is helping you to deliver awesome Page 1 of 5
Microsoft solutions. We build the very best solutions with SharePoint, CRM and .NET
Details on Consulting Services
Step: Create a Service Bus Namespace
Log into the Azure Portal
Go to the Service Bus area
Create a new Service Bus Namespace
Figure: When the namespace is created, select it and click Connection Information
Figure: Hover over the end of the connection string line, and then click the Copy icon.
The connection string is now pasted into your clipboard.
Save it for use somewhere else.
To create the chat application, follow the steps in the tutorial Getting Started with SignalR
and MVC 5.
Install-Package Microsoft.AspNet.SignalR
Install-Package Microsoft.AspNet.SignalR.ServiceBus
app.MapSignalR();
// ...
}
Figure: Configure the backplane by adding the above to startup.cs
This code configures the backplane with the default values for TopicCount and
MaxQueueLength. For information on changing these values, see SignalR Performance:
Scaleout Metrics.
Figure: To see the subscriptions and message activity, open the Azure portal, select the
Service Bus namespace, and click on “Topics”.
WebSockets is only available on Basic and Standard tier Azure Web Sites, and that the
number of active Web Socket connections is restricted for Basic tier sites.
See Web Sites Pricing Details for more information. http://azure.microsoft.com/en-us/pricing/details/web-sites/
1. Open your web site in the Azure Management Portal, and select Configure.
2. In General Settings | .NET framework version, choose ‘4.5’
3. In the WebSockets setting, select On.
4. Select Save to save your changes.
Resources:
Read the following