Has anyone tried using the UV_THREADPOOL_SIZE environment variable?

前端 未结 2 721
南方客
南方客 2020-12-29 12:03

One of the changes made by Ben Noordhius in Node v0.10.0 was to \"honor UV_THREADPOOL_SIZE environment variable\" in Unix. The \"threadpool.c\" source file seems to do just

2条回答
  •  心在旅途
    2020-12-29 12:29

    It seems that you must set it the var with node command or from inside the node program. Execute it like:

    UV_THREADPOOL_SIZE=64 node
    

    or modify from program :

    process.env.UV_THREADPOOL_SIZE=64
    //then execute some function that requires threadpool
    require('fs').readFile('testing',function(){});
    

    Testing threads:

    ps -Lef | grep  "\" | wc -l
    67
    

提交回复
热议问题