EliAndrewC / sideboard

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Implement asynchronous websocket plugin using ws4py #33

Closed EliAndrewC closed 8 years ago

EliAndrewC commented 10 years ago

ws4py has been working out pretty well for us, but there's one serious problem with the ws4py CherryPy libraries: they're one-thread-per-websocket. This will never be a problem with most of the websites we commonly build; it's hard to imagine most of my websites ever having more than 100 simultaneous visitors, which ws4py could certainly handle.

But if I wanted to build a site that could handle heavier load, it's hard to imagine how one-thread-per-connection could possibly hold up. Since ws4py already has a tornado handler, we know its classes are written to be able to take advantage of select/epoll async i/o. So all that we'd need to do is write a different CherryPy plugin and use that instead of the ws4py-provided one, which still calls into ws4py for all of the protocol stuff.

The steps would probably go something like this:

It seems reasonable to expect to be able to handle at least 1 thousand simultaneous websocket connections. Ideally it would be more, but I'd settle for a thousand :)