Answer the question
In order to leave comments, you need to log in
Performance WebSockets?
Good afternoon.
My main working tool is python. The task was to implement communication between the client (js) and the server through sockets. I'm afraid that a tornado (Pythonian asynchronous framework) will eat too many resources (yes, I know about the evil of premature optimization, but I would like not to miscalculate with tools in this matter).
I looked in the direction of go and node.js, but I could not google anything in terms of performance in adequate estimates. Something like "server with 512 mb, two cores will hold 1000 hello world concurrent connections".
Tell me, please, in which direction to look? What language, what server?
UPD Added a use case
Estimated use case: two people connect with sockets to the server, a common "game" is created for them. There is communication between them, not very intense. The approximate lifetime of one "game" is one minute, each player will receive 10 messages per connection. What tool will allow scaling this case with less developer effort?
Answer the question
In order to leave comments, you need to log in
Erlang. Leky language. Green threads are smeared across processors out of the box. There is a cowboy with websocket support
you do a normal native socket with gcc and there are no problems.
one
two
Go is faster than python and node.js, it's no secret. But development on it will be a little more difficult. You will receive specific numbers only at the stage of stress testing. You can at least do the same hello world and see how many simultaneous connections your computer can withstand.
there is a difference between "keep 1000 connections" and "serve 1000 connections".
From an architectural point of view, the difference between tornado and node.js is not big - both there and there event loop, and this and that work in one thread and can only use one core. Therefore, they usually run a daemon per kernel and resolve everything through a reverse proxy (nginx, haproxy). go has goroutines that use the entire CPU.
On a simple ping-pong server, the difference will not be so noticeable between these technologies. Everything depends on the task and the architecture of the application. In general, I can assume that in the same ping-pong, go will have a clear advantage in terms of memory consumption and nothing more.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question