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.

    ImplementationConnection Time (average)Delay (Medium)PostsConnectionsConnection timeouts
    Erlang865ms17ms284929410,0000
    Haskell (Snap)168ms227ms11874134996108
    Java (Webbit)567ms835ms10283904637157
    Go284ms18503ms23981809775225
    Node.js (websocket)768ms42580ms117084757014299
    Python (ws4py)1561ms34889ms105299647925208


    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


    Also popular now: