最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

node.js - Nodejs worker pool fine tuning - Stack Overflow

matteradmin8PV0评论

If I understood correctly:

  1. by default nodejs provides a worker pool, whose size can be tuned with UV_THREADPOOL_SIZE (default: 4)
  2. a cpu or io intensive task can use thread from this worker pool (this is the case for node modules like DNS or Crypto) or create a dedicated worker pool
  3. total number of worker pools should not exceed the actual number of cpu capability of where the application is running

My questions:

  1. how do you track the actual number of workers being used by your application ?
  2. when using third party modules (for instance mongoose or JSONStream), one should be aware of those modules strategy (use of default worker pool or dedicated worker pool). Does that mean that for every module used one should look into the code to determine its strategy?
  3. the use of node cluster (for instance with pm2) seems that it complicates the fine tuning of the number of workers, and that it'd be better to just scale out. Your advice on this matter?

Thanks for your feedback

Post a comment

comment list (0)

  1. No comments so far