From a4445b1cda15c70500bb5e9dc182501dd382e5c5 Mon Sep 17 00:00:00 2001 From: Preveen P <31464911+preveen-stack@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:07:52 +0530 Subject: [PATCH] doc: clarify UV_THREADPOOL_SIZE env var usage Setting of UV_THREADPOOL_SIZE from inside process using process.env.UV_THREADPOOL_SIZE is not guaranteed to work as the thread pool would have been created as part of the runtime initialisation much before user code is run. update doc/api/cli.md PR-URL: https://github.com/nodejs/node/pull/55832 Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- doc/api/cli.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index fa2fccc9200d78..0b38b15ec47e39 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -3165,8 +3165,10 @@ reason any of these APIs takes a long time, other (seemingly unrelated) APIs that run in libuv's threadpool will experience degraded performance. In order to mitigate this issue, one potential solution is to increase the size of libuv's threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value -greater than `4` (its current default value). For more information, see the -[libuv threadpool documentation][]. +greater than `4` (its current default value). However, setting this from inside +the process using `process.env.UV_THREADPOOL_SIZE=size` is not guranteed to work +as the threadpool would have been created as part of the runtime initialisation +much before user code is run. For more information, see the [libuv threadpool documentation][]. ### `UV_USE_IO_URING=value`