We released SignalR 1.1 yesterday with a bunch of performance improvements and new features (detailed in the release notes). Among these new features, were improvements to the .NET client including the ability to set custom headers, client certificates and a custom JSON serializer. We also fixed a long standing issue people were experiencing in IE7 and IE8 with the loading bar showing up forever in the browser. However, most of this release focused on rewriting SignalR’s scaling out story from the ground up.
The previous releases of SignalR’s scale out implementation did not handle a lot of scenarios when it came to scaling it across web servers. We took a step back and redesigned the core scale out architecture and backplanes for SQL Server, Azure Service Bus and Redis.
There are now 3 new packages on NuGet that you can choose from when scaling out SignalR:
These backplanes share a common base class (ScaleoutMessageBus) that contains the core logic allowing SignalR to work across a webfarm.
Using Scale out
Registering a backplane hasn’t changed much from the previous versions but there are some new features to be aware of.
Scale out backplanes have 2 modes controlled by a single flag RetryOnError. Users can create a configuration object for their backplane and specify which mode they want to use. This flag determines if SignalR should start buffering messages when the scale out backplane encounters errors; by default this flag is false. Here is an example:
In the above scenario, if the Redis service went offline, with RetryOnError = false the call to send a message to all clients would throw synchronously. If RetryOnError was true, the OnError callback would be raised the call would be queued until Redis came back online. This queue does have a limit and when it is full it will also fail.
- The SQL backplane requires that you create the database before hand.
- The SQL scale out backplane works with or without service broker turned on.
- Performance is usually better with service broker on since this enables query notifications to work.
Once the database is set up, you can enable SQL like this:
It’s all you need to get running with SQL server.
The new service bus scale out backplane only works with the Windows Azure service. The wiki has been updated with new steps that show how to setup service bus on Windows Azure.
Windows Azure Websites is also supported.
If you are encountering problems with scale out and want to troubleshoot what’s going on, you can turn on tracing with this xml snippet in your config file: