Why node.js is fast when it's single threaded?

前端 未结 3 1084
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 03:51

Despite being single threaded, how is node.js is faster? I haven\'t run any tests to find statistics, but while digging in the node.js forums, I find everyone says it\'s fa

3条回答
  •  萌比男神i
    2020-12-30 04:42

    Node.js is not single threaded : see https://nodejs.org/about/ :

    any connections can be handled concurrently

    In fact, it does not use system threads, but instead uses the V8 engine along with the libuv library for multi-threading through asynchronous callbacks.

    Also, you can use additional child process through child_process.fork

    Finally, this does not in any way condition speed of the response or overall speed of the engine. Multi-threading is here for scalability.

提交回复
热议问题