C10k (Problem 10,000 connections) in different languages / platforms
UPD The second version of the benchmark is here: eric.themoritzfamily.com/websocket-demo-results-v2.html
Warning : if you have a complaint about the benchmark and / or code, the benchmark is available on the Github , which allows you to edit bugs yourself or report bugs to the author.
More information about the problem of 10000 connections: en.wikipedia.org/wiki/Problem_10000_connections
How can Erlang, Go, Haskell (Snap), Java (Webbit), Node.js (websocket) and Python (ws4py) deal with the problem of 10,000 connections through web sockets?
During the benchmark, a new client starts every millisecond. Every second, each client sends a message with the current time to the server, and the server sends this message back.
Implementation | Connection Time (average) | Delay (Medium) | Posts | Connections | Connection timeouts |
---|---|---|---|---|---|
Erlang | 865ms | 17ms | 2849294 | 10,000 | 0 |
Haskell (Snap) | 168ms | 227ms | 1187413 | 4996 | 108 |
Java (Webbit) | 567ms | 835ms | 1028390 | 4637 | 157 |
Go | 284ms | 18503ms | 2398180 | 9775 | 225 |
Node.js (websocket) | 768ms | 42580ms | 1170847 | 5701 | 4299 |
Python (ws4py) | 1561ms | 34889ms | 1052996 | 4792 | 5208 |
Implementations in Python and Node.js fell on about half of the connections.
Despite the fact that Go was expected to break Erlang in performance, the delay was much higher and the server did not process the request on 225 connections.
Java Webbit was a dark horse, but ended up doing better than Go (157 raw connections).
The most surprising thing is that gevent (Python) and node.js stopped working after 5001 and 4792 connections, respectively, despite the fact that both were implemented specifically to solve the C10k problem.
A more detailed description, code and raw data can be found on GitHub: github.com/ericmoritz/wsdemo/blob/master/results.md
UPD. More and more people are involved in comparisons; tests for Tornado (Python) have appeared
UPD The second version of the benchmark is here: eric.themoritzfamily.com/websocket-demo-results-v2.html