From 2fbe17836e57bd986e0de892fb92fe41dfbd5c8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 14 Jul 2023 22:06:45 +0200 Subject: [PATCH] docs: worker-threads -> worker_threads MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 6 +++--- README.md | 14 +++++++------- package.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 001002c7..71f0cdbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,7 +112,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC. +- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. ## [2.6.4] - 2023-06-27 @@ -128,7 +128,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC. +- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. ## [2.6.3] - 2023-06-19 @@ -185,7 +185,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Compute statistics at the worker level only if needed. -- Add `worker-threads` options to thread pool options. +- Add `worker_threads` options to thread pool options. ### Fixed diff --git a/README.md b/README.md index c5aff97f..72323e5c 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ ## Why Poolifier? -Poolifier is used to perform CPU intensive and I/O intensive tasks on nodejs servers, it implements worker pools using [worker-threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads) and cluster pools using [cluster](https://nodejs.org/api/cluster.html) Node.js modules. +Poolifier is used to perform CPU intensive and I/O intensive tasks on nodejs servers, it implements worker pools using [worker_threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads) and cluster pools using [cluster](https://nodejs.org/api/cluster.html) Node.js modules. With poolifier you can improve your **performance** and resolve problems related to the event loop. Moreover you can execute your tasks using an API designed to improve the **developer experience**. Please consult our [general guidelines](#general-guidance). @@ -41,7 +41,7 @@ Please consult our [general guidelines](#general-guidance). - No runtime dependencies :white_check_mark: - Proper async integration with node async hooks :white_check_mark: - Support CommonJS, ESM, and TypeScript :white_check_mark: -- Support for worker-threads and cluster node modules :white_check_mark: +- Support for worker_threads and cluster node modules :white_check_mark: - Support sync and async tasks :white_check_mark: - Tasks distribution strategies :white_check_mark: - General guidance on pool choice :white_check_mark: @@ -80,7 +80,7 @@ Please consult our [general guidelines](#general-guidance). ## Overview -Node pool contains two [worker-threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads)/[cluster worker](https://nodejs.org/api/cluster.html#cluster_class_worker) pool implementations, you don't have to deal with worker-threads/cluster worker complexity. +Node pool contains two [worker_threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads)/[cluster worker](https://nodejs.org/api/cluster.html#cluster_class_worker) pool implementations, you don't have to deal with worker_threads/cluster worker complexity. The first implementation is a static worker pool, with a defined number of workers that are started at creation time and will be reused. The second implementation is a dynamic worker pool with a number of worker started at creation time (these workers will be always active and reused) and other workers created when the load will increase (with an upper limit, these workers will be reused when active), the new created workers will be stopped after a configurable period of inactivity. You have to implement your worker by extending the ThreadWorker or ClusterWorker class. @@ -93,7 +93,7 @@ npm install poolifier --save ## Usage -You can implement a worker-threads worker in a simple way by extending the class ThreadWorker: +You can implement a worker_threads worker in a simple way by extending the class ThreadWorker: ```js 'use strict' @@ -116,7 +116,7 @@ Instantiate your pool based on your needs : 'use strict' const { DynamicThreadPool, FixedThreadPool, PoolEvents, availableParallelism } = require('poolifier') -// a fixed worker-threads pool +// a fixed worker_threads pool const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', { errorHandler: e => console.error(e), onlineHandler: () => console.info('worker is online') @@ -125,7 +125,7 @@ const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', { pool.emitter.on(PoolEvents.ready, () => console.info('Pool is ready')) pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy')) -// or a dynamic worker-threads pool +// or a dynamic worker_threads pool const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), availableParallelism(), './yourWorker.js', { errorHandler: e => console.error(e), onlineHandler: () => console.info('worker is online') @@ -302,7 +302,7 @@ and/or ### Cluster vs Threads worker pools **If your task does not run into libuv thread pool** and is CPU intensive then poolifier **thread pools** (FixedThreadPool and DynamicThreadPool) are suggested to run CPU intensive tasks, you can still run I/O intensive tasks into thread pools, but performance enhancement is expected to be minimal. -Thread pools are built on top of Node.js [worker-threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads) module. +Thread pools are built on top of Node.js [worker_threads](https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads) module. **If your task does not run into libuv thread pool** and is I/O intensive then poolifier **cluster pools** (FixedClusterPool and DynamicClusterPool) are suggested to run I/O intensive tasks, again you can still run CPU intensive tasks into cluster pools, but performance enhancement is expected to be minimal. Consider that by default Node.js already has great performance for I/O tasks (asynchronous I/O). diff --git a/package.json b/package.json index 19eb1573..48e5c49e 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "pool", "workers pool", "threads pool", - "worker-threads", + "worker_threads", "cluster", "cluster worker", "concurrency", -- 2.34.1