X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=README.md;h=6db467fdbef07444b65082a53740b37f8a5d06b8;hb=275401fc730c1d65e12a6ee22308a22af35da734;hp=626cb8a92ac3578f9bd25c96c473da382c9e4425;hpb=f097c79be4797960cfb51027b83034166fb72d9a;p=poolifier.git
diff --git a/README.md b/README.md
index 626cb8a9..6db467fd 100644
--- a/README.md
+++ b/README.md
@@ -2,30 +2,26 @@
-
Node.js Worker_Threads and Cluster Worker Pool
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+# Node.js Worker_Threads and Cluster Worker Pool
+
+
+
+
+
+[![GitHub commit activity (master)](https://img.shields.io/github/commit-activity/m/poolifier/poolifier/master?color=brightgreen&logo=github)](https://github.com/poolifier/poolifier/graphs/commit-activity)
+[![Weekly Downloads](https://badgen.net/npm/dw/poolifier?icon=npm)](https://www.npmjs.com/package/poolifier)
+[![CI Workflow](https://github.com/poolifier/poolifier/actions/workflows/ci.yml/badge.svg)](https://github.com/poolifier/poolifier/actions/workflows/ci.yml)
+[![Code Coverage](https://sonarcloud.io/api/project_badges/measure?project=pioardi_poolifier&metric=coverage)](https://sonarcloud.io/dashboard?id=pioardi_poolifier)
+[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pioardi_poolifier&metric=alert_status)](https://sonarcloud.io/dashboard?id=pioardi_poolifier)
+[![Javascript Standard Style Guide]()](https://standardjs.com)
+[![Discord](https://badgen.net/discord/online-members/vXxZhyb3b6?icon=discord&label=discord&color=green)](https://discord.gg/vXxZhyb3b6)
+[![Open Collective](https://opencollective.com/poolifier/tiers/badge.svg)](https://opencollective.com/poolifier)
+[![PRs Welcome](https://badgen.net/static/PRs/welcome/green)](http://makeapullrequest.com)
+[![No Dependencies]()]()
+
+
## Why Poolifier?
@@ -40,14 +36,15 @@ Please consult our [general guidelines](#general-guidelines).
- Performance [benchmarks](./benchmarks/README.md) :white_check_mark:
- No runtime dependencies :white_check_mark:
- Proper integration with Node.js [async_hooks](https://nodejs.org/api/async_hooks.html) :white_check_mark:
-- Support for CommonJS, ESM, and TypeScript :white_check_mark:
+- Support for CommonJS, ESM and TypeScript :white_check_mark:
- Support for [worker_threads](https://nodejs.org/api/worker_threads.html) and [cluster](https://nodejs.org/api/cluster.html) Node.js modules :white_check_mark:
- Support for multiple task functions :white_check_mark:
+- Support for task functions [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations at runtime :white_check_mark:
- Support for sync and async task functions :white_check_mark:
- Tasks distribution strategies :white_check_mark:
- Lockless tasks queueing :white_check_mark:
- Queued tasks rescheduling:
- - Task stealing :white_check_mark:
+ - Task stealing on empty queue :white_check_mark:
- Tasks stealing under back pressure :white_check_mark:
- Tasks redistribution on worker error :white_check_mark:
- General guidelines on pool choice :white_check_mark:
@@ -79,7 +76,7 @@ Please consult our [general guidelines](#general-guidelines).
Poolifier contains two [worker_threads](https://nodejs.org/api/worker_threads.html#class-worker)/[cluster](https://nodejs.org/api/cluster.html#cluster_class_worker) worker pool implementations, you don't have to deal with [worker_threads](https://nodejs.org/api/worker_threads.html)/[cluster](https://nodejs.org/api/cluster.html) complexity.
The first implementation is a fixed 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.
+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 newly created workers will be stopped after a configurable period of inactivity.
You have to implement your worker by extending the _ThreadWorker_ or _ClusterWorker_ class.
## Installation
@@ -119,8 +116,8 @@ const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', {
onlineHandler: () => console.info('worker is online')
})
-pool.emitter.on(PoolEvents.ready, () => console.info('Pool is ready'))
-pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy'))
+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
const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), availableParallelism(), './yourWorker.js', {
@@ -128,9 +125,9 @@ const pool = new DynamicThreadPool(Math.floor(availableParallelism() / 2), avail
onlineHandler: () => console.info('worker is online')
})
-pool.emitter.on(PoolEvents.full, () => console.info('Pool is full'))
-pool.emitter.on(PoolEvents.ready, () => console.info('Pool is ready'))
-pool.emitter.on(PoolEvents.busy, () => console.info('Pool is busy'))
+pool.emitter?.on(PoolEvents.full, () => console.info('Pool is full'))
+pool.emitter?.on(PoolEvents.ready, () => console.info('Pool is ready'))
+pool.emitter?.on(PoolEvents.busy, () => console.info('Pool is busy'))
// the execute method signature is the same for both implementations,
// so you can easily switch from one to another
@@ -168,7 +165,7 @@ Remember that workers can only send and receive structured-cloneable data.
## Node.js versions
-Node.js versions >= 16.14.x are supported.
+Node.js versions >= 18.x.x are supported.
## [API](./docs/api.md)
@@ -180,7 +177,7 @@ Node.js versions >= 16.14.x are supported.
Choose your task [here](https://github.com/orgs/poolifier/projects/1), propose an idea, a fix, an improvement.
-See [CONTRIBUTING](CONTRIBUTING.md) guidelines.
+See [CONTRIBUTING](./CONTRIBUTING.md) guidelines.
## Team