Microsoft Offers Module to Scale Out Real-time Node.js Applications
A new open-source contribution from Microsoft uses the Windows Azure Service Bus to provide scale out support for real-time Node.js applications. This module, called socket.io-servicebus, connects multiple servers running the popular Socket.IO module. This contribution is yet another example of Microsoft embracing Node.js and integrating it with Microsoft products and services.
Socket.IO, created by the prolific Guillermo Rauch, lets developers use WebSockets for real-time Node.js applications that work in any major browser. This prominent module is downloaded over 150,000 times per month by developers who want to push messages from the server to any/all connected clients. A single Node.js server with Socket.IO can maintain thousands of concurrent connections but challenges arise when attempting to build applications that span multiple servers. Socket.IO recently added support for “stores” which provide man-in-the-middle storage that can be shared across servers. The socket.io-servicebus module from Microsoft uses the Windows Azure Service Bus as a store that all integrated Node.js servers can use to distribute messages to connected clients.
Microsoft has developed a special affection for Node.js during the past years. They have a dedicated development center for Node.js on their Windows Azure portal and include many tutorials and references for developers deploying Node.js applications to the Microsoft cloud. They have also created a handful of open source modules for Node.js developers. The open source Azure SDK for Node module gives developers easy access to a subset of services including Windows Azure Storage (tables/queues/blobs), Windows Azure Service Bus, and Windows Azure SQL Database. In addition, the Microsoft Driver for Node.js for SQL Server module offers a basic interface into Microsoft SQL Server for Node.js applications running on Microsoft Windows. The creative Edge.js module, built by Microsoft’s Tomasz Janczuk, integrates .NET code into Node.js code giving developers access to the robust .NET framework when needed. Microsoft even added Node.js development and deployment capabilities to their free WebMatrix development environment.
To learn more about this new module, InfoQ reached out to Glenn Block who is a Senior Program Manager on the Windows Azure team and a public evangelist for Microsoft’s open source efforts.
InfoQ: What problem with Socket.IO is this solving?
Block: The module is designed to enable you to scale out applications using socket.io across multiple node instances living on different physical machines / VMs. It can be used for scaling out a single application that is located on multiple instances in a single datacenter, or even for syncing realtime data with instances distributed across data centers including some running on premise.
The applications themselves do not have to be hosted within Windows Azure, providing further utility.
InfoQ: Why the Windows Azure Service Bus? What makes it the right Windows Azure service to offer this capability?
Block: Windows Azure Service Bus is a highly scalable and redundant pub/sub messaging platform that is hosted in Windows Azure and which is geolocated. This makes it ideal for handling these sorts of scale out scenarios.
InfoQ: How exactly does it work?
Block: Socket.io provides a 'store' abstraction which determines where messages are stored. With our new module, we provide an SbStore that will utilize service bus topics to synchronize multiple socket.io instances that are listening on that topic. Whenever messages are received from a socket.io client, the message will be sent to the store and travel via Service Bus to each of the instances. Each socket.io instance then communicates directly to each of it's connected clients.
It's important to mention that this is our first release and it will be the first time the rubber hit sthe road. It is likely that we will be tuning the performance of the module based on customer usage.
InfoQ: Do you think that this scale-out support enables new scenarios where Socket.IO can play where it couldn't before?
Block: For applications hosted within Windows Azure yes because the service itself is in Azure. There are other alternative stores like the RedisStore that allow using Redis, an in-memory database which combined with services like Redis to Go can offer a similar experience.
InfoQ: Microsoft seems to have a crush on Node.js as many creative modules and tutorials have been created and shared. Do you think that Node addresses a unique need not currently met by other Microsoft products? Or is this a case of Microsoft embracing a popular platform and showing relevant integration with it?
Block: That's a great question. I don't see that as an either or. Node is an exciting platform that is gaining in popularity, and it has a very rich module ecosystem that some developers prefer. Our supporting node.js in Windows Azure is really about offering alternatives for developers and bringing more developers to our platform in particular those that either are not developing with .NET or are building hybrid solutions.
Keith Adams Dec 06, 2013