3 ms·
What's missing from your thought experiment is concurrency. Imagine there's 100k people connected to the server. If you make the system in Erlang, you can handl
by ramchip 9y ago
What's missing from your thought experiment is concurrency. Imagine there's 100k people connected to the server. If you make the system in Erlang, you can handle each connection in a separate process, which individually monitors its own bitrate and fetches or sends data with synchronous calls. This makes the code very straightforward.
The VM ensures each process won't block the scheduler for more than 1ms or so, so that processes that have short but time critical operations to do (e.g. push a video frame down a socket) get a chance to run quickly, no matter what other processes are doing and whether it's I/O or CPU bound.
Kamaelia, gevent, Node.js, etc. do not provide that guarantee. OS threads do, and there are good frameworks based on them (e.g. Celluloid), but they don't scale to more than a few thousands.
- sriram_malhar 9y agoThat's a fair point.