Evaluate websocket/Node response time for 100 clients triggered simultaneously every second.
$ npm install
$ node wsperf.js
# with socket.io debug
$ DEBUG=socket.io* node wsperf.jsWhy so slow ? I was kind of expecting the connections to be handled in parallel, but it seems they're in fact processed sequentially by node. Could that be properly parallelized somehow ?
What: Node server asking 100 clients to update once per second via websocket on a localhost loop.
Context: Server maintaining state for remote clients, clients issuing operations to alter state (some kind of remote game loop).
Mechanics:
- Server broadcasts
update - Every client (100 clients) queries state on server via emit
api - Server handles api requests and answers clients with api response (dummy data)
- Client processes state, generates a state update operation, and emits
updateto the server (dummy operation) - Server aggregates operation to state (dummy operation)
Maybe you can give
wsa try? I wrote a slim down version of your test: https://gist.github.com/midnightcodr/c6f83e52a642da1189de4d58881fe01c