High Performance Web Socket Server

Author(s) and publish date

By:
Published:
Skip to 8 comments

The Web still has a long way to go to fulfill its potential for distributed applications. HTTP and JSON have proven their worth, but can overload servers trying to handle large number of simultaneous connections. A promising new technology is Web Sockets which allows bidirectional messaging over a single TCP connection. The connection is set up very much like HTTP, and can use the same ports for easy passage through firewalls, but once established, both ends are free to send messages at will without the overhead involved in using HTTP.

Web Sockets is supported by a variety of browsers including Firefox 4, Google Chrome 4, Opera 11 and Safari 5, even though the protocol is still evolving. The IETF BiDirectional or Server-Initiated HTTP (hybi) Working Group is defining the protocol, whilst the W3C Web Applications Working Group is specifying the Web Sockets API for use by web page scripts.

Spurred on by this, I have developed an open source implementation of a Web Sockets server with a view to exploring a variety of collaborative real-time applications. The server is written in C and based upon the epoll system call first introduced in Linux 2.6. The server runs as a single process with one thread per CPU core. This architecture was chosen to enable the server to support thousands of simultaneous connections. A potential down-side is that the server-side code for applications has to be written in C and compiled to dynamically loaded libraries managed through a configuration file. This is still a work in progress, and I have recently completed adding support for JSON. Coming up is support for TLS and Web Sockets Secure (wss) connections, and preparing the server for its initial release. If you have any suggestions for naming the new server and what features you would like to see, please let me know!

Related RSS feed

Comments (8)

Comments for this post are closed.