December 2010 Archives

One Million TCP Connections...

| 6 Comments
We get the software and then we hold the company to ransom for .... ONE MILLION TCP CONNECTIONS!
It seems that C10K is old hat these days and that people are aiming a little higher. I've seen several questions on StackOverflow.com (and had an equal number of direct emails) asking about how people can achieve one million active TCP connections on a single Windows Server box. Or, in a more round about way, what is the theoretical maximum number of active TCP connections that a Windows Server box can handle.

I always respond in the same way; basically I think the question is misguided and even if a definitive answer were possible it wouldn't actually be that useful.

What the people asking these questions seem to ignore is that with a modern Windows Server operating system, a reasonable amount of ram and a decent enough set of CPUs it's likely that it's YOUR software that is the limiting factor in the equation.

The WebSocket protocol

| 0 Comments
I've spent the last few days implementing the WebSocket protocol (well, two versions of the draft standard actually) and integrating it into an existing server for one of our clients. This has proved to be an interesting exercise. The protocol itself is pretty simple but, as ever, the devil is in the detail. I now have server side code that deals with both the Hixie 76 draft and the HyBi 03 draft of the protocol. Once the initial handshake (which is pretty much just HTTP) is out of the way the two drafts deal in terms of frames of data rather than a simple byte stream. The library that I've developed accumulates these frames in an I/O buffer frames until they're complete and then dispatches them to the layer of code above by using a callback interface. Thus your server simply sits and waits for frames to arrive and then sends out frames of its own.