Skip to content

Commit 1bc444a

Browse files
committed
Describe core module use of the Node Worker Pool
1 parent 7363536 commit 1bc444a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

locale/en/docs/guides/dont-block-the-event-loop.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@ Now, there will be variation in the cost of the Tasks required to handle your cl
348348
Some Tasks can be completed quickly (e.g. reading short or cached files in the I/O-WP, or computing the average of a small array in the C-WP), and others will take longer (e.g reading larger or uncached files in the I/O-WP, or doing more expensive computation in the C-WP).
349349
Your goal should be to *minimize the variation in Task times*, and you should use *Task partitioning* to accomplish this.
350350

351+
### What is the Node Worker Pool used for?
352+
In the Node core modules, the Node Worker Pool is used for the asynchronous versions of the following classes of APIs:
353+
1. File system I/O
354+
2. DNS queries
355+
3. Encryption
356+
4. Compression
357+
358+
In addition, npm modules may make use of the Node Worker Pool as described in the section on Offloading.
359+
351360
### Minimizing the variation in Task times
352361
If a Worker's current Task is much more expensive than other Tasks, then it will be unavailable to work on other pending Tasks.
353362
In other words, *each relatively long Task effectively decreases the size of the Worker Pool by one until it is completed*.

0 commit comments

Comments
 (0)