chore: v3.1.12-0
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
d4abc60a 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
522eea03 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c 8## [Unreleased]
9aa78bcb 9
164c80dd
JB
10## [3.1.12-0] - 2023-12-27
11
f4ef37a8
JB
12### Fixed
13
14- Fix tasks redistribution triggers at pool destroying.
15
0766991a
JB
16## [3.1.11] - 2023-12-24
17
5eb72b9e
JB
18### Fixed
19
20- Avoid worker node cross tasks stealing.
21- Ensure only half the pool worker nodes can steal tasks.
22
4618ccfd
JB
23## [3.1.10] - 2023-12-23
24
09616edb
JB
25### Changed
26
27- Avoid useless branching on pool type.
28
bba20209
JB
29## [3.1.9] - 2023-12-22
30
2889bd70
JB
31### Changed
32
33- Readd ThreadPoolOptions and ClusterPoolOptions TS type aliases to PoolOptions.
34
b1bbc365
JB
35## [3.1.8] - 2023-12-21
36
ad3836ed
JB
37### Fixed
38
39- Fix default worker weight computation.
40- Fix possible null exception at pool destroying.
41
72523ab9
JB
42## [3.1.7] - 2023-12-20
43
55d7d600
JB
44### Fixed
45
46- Ensure worker choice strategies implementation wait for worker node readiness: [#1748](https://github.com/poolifier/poolifier/issues/1748).
47
165f3d56
JB
48## [3.1.6] - 2023-12-18
49
85b2561d
JB
50### Fixed
51
52- Fix pool destroying with tasks queuing enabled.
53
6c8cec9e
JB
54## [3.1.5] - 2023-12-18
55
32b141fd
JB
56### Added
57
58- Add queued tasks end timeout support to worker node termination.
59
f11ec29c
JB
60## [3.1.4] - 2023-12-18
61
4e0afe97
JB
62### Fixed
63
64- Make more robust the fix for possible null exception at handling task execution response.
65
f592ef16
JB
66## [3.1.3] - 2023-12-17
67
9b358e72
JB
68### Fixed
69
70- Fix possible null exception at handling task execution response.
71
c61772e5
JB
72## [3.1.2] - 2023-12-17
73
87347ea8
JB
74### Fixed
75
32b141fd 76- Wait for queued tasks to end at worker node termination.
87347ea8 77
6e664bec
JB
78## [3.1.1] - 2023-12-16
79
51280f9b
JB
80### Fixed
81
82- Fix pool options TS type definition.
83
5362c66b
JB
84## [3.1.0] - 2023-12-16
85
c3719753
JB
86### Changed
87
88- TypeScript breaking change: merge ThreadPoolOptions and ClusterPoolOptions types into PoolOptions type.
89
42321a2b
JB
90## [3.0.14] - 2023-12-13
91
fa548cda
JB
92### Fixed
93
94- Fix possible null exception with worker_threads pools.
95
d727d871
JB
96## [3.0.13] - 2023-12-12
97
fb5a7307
JB
98### Fixed
99
100- Ensure worker choice strategy wait for worker nodes readiness.
101
102### Changed
103
104- Remove infinite retries support in worker choice strategy to avoid configuration leading to possible infinite recursion or loop.
105
90a43710
JB
106## [3.0.12] - 2023-12-12
107
9aa78bcb
JB
108### Changed
109
110- Add infinite retries support in worker choice strategy.
45a5a54c 111
d8163b08
JB
112## [3.0.11] - 2023-12-11
113
f18fd12b
JB
114### Fixed
115
457dd3dc 116- Ensure pool asynchronous resource properly track tasks execution.
f18fd12b 117
bd453998
JB
118## [3.0.10] - 2023-12-08
119
cb71d660
JB
120### Changed
121
457dd3dc 122- Add a fastpath when tasks stealing or redistribution is impossible.
cb71d660 123
d7164344
JB
124## [3.0.9] - 2023-11-26
125
78f60f82
JB
126### Fixed
127
128- Remove all pool events listener at pool destroying.
129- Remove all worker node events listener at worker node destroying.
9f99eb9b 130- Fix worker node event emitter listeners handling memory leak at pool options runtime change.
78f60f82 131
0c08a681
JB
132## [3.0.8] - 2023-11-25
133
463226a4
JB
134### Fixed
135
457dd3dc 136- Ensure continuous tasks stealing on idle start at worker node idling.
463226a4 137
14dad1fd
JB
138## [3.0.7] - 2023-11-24
139
65542a35
JB
140### Changed
141
142- Make continuous tasks stealing start at worker node idling.
143
82c5db63
JB
144## [3.0.6] - 2023-11-24
145
711623b8
JB
146### Fixed
147
b51d8596 148- Ensure pool statuses are checked at initialization, `start()` or `destroy()`.
55082af9 149- Ensure pool `ready` event can be emitted after several `start()/destroy()` cycles.
711623b8 150
5aa31a74
JB
151## [3.0.5] - 2023-10-27
152
d91689fd
JB
153### Fixed
154
55082af9 155- Ensure pool `ready` event can be emitted only once.
d91689fd 156
597775b2
JB
157## [3.0.4] - 2023-10-20
158
03fb313b
JB
159### Changed
160
49d60f11 161- Switch to Bencher for benchmarking: [https://bencher.dev/perf/poolifier](https://bencher.dev/perf/poolifier).
03fb313b
JB
162- Use builtin retry mechanism in worker choice strategies instead of custom one.
163
6c285176
JB
164## [3.0.3] - 2023-10-19
165
9761e404
JB
166### Fixed
167
168- Avoid null exception at sending message to worker.
535fd8d5 169- Avoid null exception at checking worker node readiness.
9761e404 170
358dc40f
JB
171## [3.0.2] - 2023-10-17
172
97256a85
JB
173### Fixed
174
c3c2b35e 175- Fix race condition at dynamic worker node task assignment and scheduled removal. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468) and [#1496](https://github.com/poolifier/poolifier/issues/1496).
97256a85 176
7a570743
JB
177## [3.0.1] - 2023-10-16
178
dbfa7948
JB
179### Fixed
180
fc84edac 181- Workaround possible race condition at work nodes array element removal and querying. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468).
dbfa7948 182
365f13e4
JB
183### Changed
184
c3c2b35e 185- Switch the worker node eventing code to `EventTarget` API.
365f13e4 186
003b3275
JB
187## [3.0.0] - 2023-10-08
188
277c49bf
JB
189### Changed
190
191- Remove Node.js 16.x.x (EOL) support.
192
3c9e911a
JB
193## [2.7.5] - 2023-10-03
194
f80125ca
JB
195### Changed
196
197- Use `EventEmitterAsyncResource` type from `@types/node` for pool event emitter. TypeScript users will need to update to latest `@types/node` version.
198
3466e757
JB
199## [2.7.4] - 2023-09-25
200
67b26ae2
JB
201### Fixed
202
203- Fix source maps (bundler issue).
204
eeb1f961
JB
205## [2.7.3] - 2023-09-24
206
b5604034
JB
207### Changed
208
209- Convert pool event emitter to event emitter async resource.
210
f2df6dc8
JB
211## [2.7.2] - 2023-09-23
212
116ca64b
JB
213### Changed
214
215- Add source maps to npm package to ease debugging.
216
1e319a70
JB
217### Added
218
219- Continuous benchmarking versus other worker pools: [https://poolifier.github.io/benchmark](https://poolifier.github.io/benchmark).
220
aab2819b
JB
221## [2.7.1] - 2023-09-20
222
ae036c3e
JB
223### Fixed
224
225- Ensure worker message listener used one time are removed after usage.
226
15d7c489
JB
227## [2.7.0] - 2023-09-19
228
160557ff
JB
229### Fixed
230
231- Fix task stealing related tasks queue options handling at runtime.
232
c3284191
JB
233### Changed
234
235- Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
236
237### Added
238
35808931 239- Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API: [PR #1148](https://github.com/poolifier/poolifier/pull/1148).
c20084b6 240- Stricter worker constructor arguments validation.
c3284191 241
04054352
JB
242## [2.6.45] - 2023-09-17
243
093af25b
JB
244### Changed
245
246- Disable publication on GitHub packages registry on release until authentication issue is fixed.
09d9af02
JB
247
248### Added
249
ce0ab2d7 250- Add `startWorkers` to pool options to whether start the minimum number of workers at pool initialization or not.
cde5b54e 251- Add `start()` method to pool API to start the minimum number of workers.
af98b972 252- Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task stealing or not and whether enable tasks stealing under back pressure or not.
1e319a70 253- Continuous internal benchmarking: [https://poolifier.github.io/benchmark-results/dev/bench](https://poolifier.github.io/benchmark-results/dev/bench).
f1c674cd 254
bce9ffdf
JB
255## [2.6.44] - 2023-09-08
256
4cb259d3
JB
257### Fixed
258
259- Use a dedicated PAT to publish on GitHub packages registry.
260
261### Added
262
263- Publish on GitHub packages registry on release.
264
265### Changed
266
267- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
268
fbda1e26
JB
269## [2.6.43] - 2023-09-08
270
15fc82ba
JB
271### Added
272
4cb259d3 273- Publish on GitHub packages registry on release.
15fc82ba
JB
274
275### Changed
276
4cb259d3 277- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
15fc82ba 278
b47306a3
JB
279## [2.6.42] - 2023-09-06
280
ad11ca81
JB
281### Changed
282
283- Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ...
284
1b37751d
JB
285## [2.6.41] - 2023-09-03
286
f3a91bac
JB
287### Changed
288
289- Optimize worker choice strategies implementation.
290
7790a494
JB
291## [2.6.40] - 2023-09-01
292
6fe200b4
JB
293### Fixed
294
295- Do not pre-choose in WRR worker choice strategy to avoid bias.
68738842 296- Avoid array out of bound in worker choice strategies after worker node removal.
6fe200b4 297
766c7f84
JB
298## [2.6.39] - 2023-08-30
299
edf8ce4e
JB
300### Fixed
301
4cb259d3 302- Fix race condition in worker choice strategies at worker node info querying while not yet initialized.
edf8ce4e 303
904a5689
JB
304## [2.6.38] - 2023-08-30
305
b40c4b06
JB
306### Added
307
308- Bundle typescript types declaration into one file.
309
619f403b
JB
310### Changed
311
312- Improve interleaved weighted round robin worker choice strategy implementation.
313
5a24d71c
JB
314## [2.6.37] - 2023-08-28
315
bdb9d712
JB
316### Fixed
317
318- Ensure unused worker usage statistics are deleted at runtime.
319
8c0b113f
JB
320### Changed
321
322- Rename worker choice strategy options `choiceRetries` to `retries`.
574c5c8d 323- Avoid unnecessary branching in worker choice strategies.
8c0b113f 324
ba821940
JB
325## [2.6.36] - 2023-08-27
326
9d2d0da1
JB
327### Fixed
328
329- Fix pool `execute()` arguments check.
330
1f0766e7
JB
331### Changed
332
333- Make continuous tasks stealing algorithm less aggressive.
8780236f 334- Fine tune tasks stealing algorithm under back pressure.
1f0766e7 335
ffd2c1ff
JB
336## [2.6.35] - 2023-08-25
337
dc021bcc
JB
338### Fixed
339
340- Don't account worker usage statistics for tasks that have failed.
3baa0837 341- Fix pool information runtime and wait time median computation.
dc021bcc
JB
342
343### Changed
344
345- Update simple moving average implementation to use a circular buffer.
346- Update simple moving median implementation to use a circular buffer.
68cbdc84
JB
347- Account for stolen tasks in worker usage statistics and pool information.
348
349### Added
350
351- Continuous tasks stealing algorithm.
dc021bcc 352
c58bc2a1
JB
353## [2.6.34] - 2023-08-24
354
0bc68267
JB
355### Fixes
356
357- Avoid cascading tasks stealing under back pressure.
358
359### Changed
360
361- Add fastpath to queued tasks rescheduling.
362
39fb7ad0
JB
363## [2.6.33] - 2023-08-24
364
dd951876
JB
365### Fixed
366
367- Fix queued tasks rescheduling.
368
ff3f866a
JB
369### Changed
370
371- Rename tasks queue options `queueMaxSize` to `size`.
372
a6b3272b 373### Added
dd951876 374
a6b3272b 375- Task stealing scheduling algorithm if tasks queueing is enabled.
dd951876 376
c55c9b5d
JB
377## [2.6.32] - 2023-08-23
378
15b176e0
JB
379### Fixed
380
381- Ensure no task can be executed when the pool is destroyed.
382
20c6f652
JB
383### Added
384
385- Add `queueMaxSize` option to tasks queue options.
574b351d 386- Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing.
72695f86 387- Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled.
20c6f652 388
e560a9f2
JB
389## [2.6.31] - 2023-08-20
390
b1aae695
JB
391### Fixed
392
3e8611a8 393- Fix worker choice strategy retries mechanism in some edge cases.
b1aae695 394
94407def
JB
395### Changed
396
e695d66f 397- Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage.
a71b05bc 398- Remove the experimental status of the `LEAST_ELU` worker choice strategy.
94407def 399
962b9863
JB
400## [2.6.30] - 2023-08-19
401
33e6bb4c
JB
402### Fixed
403
404- Ensure pool event `backPressure` is emitted.
405- Ensure pool event `full` is emitted only once.
8735b4e5 406- Ensure worker node cannot be instantiated without proper arguments.
33e6bb4c 407
8cc4ea81
JB
408## [2.6.29] - 2023-08-18
409
6169563b
JB
410### Fixed
411
55082af9 412- Fix race condition between readiness and task functions worker message handling at startup.
5dd4043c 413- Fix duplicate task function worker usage statistics computation per task function.
db0e38ee 414- Update task function worker usage statistics if and only if there's at least two different task functions.
5bb5be17 415- Fix race condition at task function worker usage executing task computation leading to negative value.
6169563b 416
8990357d
JB
417### Added
418
445264e8 419- Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2).
8990357d
JB
420- Use back pressure detection in worker choice strategies.
421- Add worker choice strategies retries mechanism if no worker is eligible.
422
21157987
JB
423## [2.6.28] - 2023-08-16
424
f05ed93c
JB
425### Fixed
426
427- Ensure pool workers are properly initialized.
428
12d67776
JB
429### Added
430
431- HTTP server pool examples: express-cluster, express-hybrid.
432
d18fccb1
JB
433### Changed
434
435- Remove now useless branching in worker hot code path.
436
741cdb34
JB
437## [2.6.27] - 2023-08-15
438
50e7f498
JB
439### Fixed
440
441- Add `KillHandler` type definition to exported types.
442
ef3891a3
JB
443### Added
444
445- Add `destroy` event to pool API.
446
e9dc6efa
JB
447## [2.6.26] - 2023-08-15
448
2b099bf7
JB
449### Added
450
451- Add kill handler to worker options allowing to execute custom code when worker is killed.
ef3891a3 452- Add `listTaskFunctions()` method to pool API.
1f4553c6 453- SMTP client pool example: nodemailer.
2b099bf7 454
5b726f72
JB
455## [2.6.25] - 2023-08-13
456
72855e92
JB
457### Added
458
3b311539 459- HTTP server pool examples: fastify-cluster, fastify-hybrid.
02999424 460- WebSocket server pool examples: ws-cluster, ws-hybrid.
72855e92 461
7aadd6e5
JB
462## [2.6.24] - 2023-08-12
463
7d91a8cd
JB
464### Added
465
466- Add array of transferable objects to the `execute()` method arguments.
02999424 467- WebSocket server pool examples: ws-worker_threads.
7d91a8cd 468
6b4263b4
JB
469## [2.6.23] - 2023-08-11
470
3d76750a 471### Fixed
8e0af894 472
3d76750a 473- Fix pool busyness semantic when tasks queueing is enabled: the pool is busy when the number of executing tasks on each worker has reached the maximum tasks concurrency per worker.
9606b474 474
3d76750a
JB
475### Added
476
477- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
02999424 478- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
3d76750a
JB
479
480## [2.6.22] - 2023-08-10
9606b474 481
3d76750a 482### Fixed
9606b474
JB
483
484- Add missing `types` field to package.json `exports`.
485
3d76750a
JB
486### Changed
487
488- Structure markdown documentation (PR #811).
489
d9647bdd
JB
490## [2.6.21] - 2023-08-03
491
2111ec12
JB
492### Changed
493
494- Improve code documentation.
495- Code refactoring and cleanup for better maintainability and readability.
496
5c30b9d9
JB
497## [2.6.20] - 2023-07-21
498
10ecf8fd
JB
499### Fixed
500
501- Fix queued tasks redistribution on error task execution starvation.
a1763c54 502- Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
10ecf8fd 503
aa9eede8
JB
504### Changed
505
7c89e6a4 506- Drastically reduce lookups by worker in the worker nodes.
aa9eede8 507
62485908
JB
508## [2.6.19] - 2023-07-20
509
2e2ef9c3
JB
510### Added
511
512- Dedicated internal communication channel for worker_threads pools.
513
8f4c9491
JB
514## [2.6.18] - 2023-07-19
515
8660b972
JB
516### Changed
517
518- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
519
206a3519
JB
520## [2.6.17] - 2023-07-16
521
b4899fae
JB
522### Added
523
1a3e01ba 524- Add `listTaskFunctions()` method to worker API.
b4899fae 525
58a06a6c
JB
526## [2.6.16] - 2023-07-12
527
2a69b8c5
JB
528### Fixed
529
80520ca4 530- Fix pool startup detection.
2a69b8c5
JB
531- Fix worker task functions handling.
532
b5900b02
JB
533## [2.6.15] - 2023-07-11
534
19dbc45b
JB
535### Added
536
537- Take into account worker node readiness in worker choice strategies.
538
4a0db581
JB
539## [2.6.14] - 2023-07-10
540
87e44747
JB
541### Fixed
542
543- Fix task function statistics tracking.
544
0265272f
JB
545## [2.6.13] - 2023-07-10
546
968a2e8c
JB
547### Added
548
549- Add per task function statistics tracking.
782299f8 550- Add public methods to manipulate the worker task functions at runtime.
968a2e8c 551
44c8c00f
JB
552## [2.6.12] - 2023-07-09
553
aa4bf4b2
JB
554### Fixed
555
556- Workaround import issue with `node:os` module in node 16.x.x.
557
b7cfced1
JB
558## [2.6.11] - 2023-07-09
559
d5024c00
JB
560### Fixed
561
562- Fix pool readiness semantic.
563
f313a208
JB
564## [2.6.10] - 2023-07-08
565
2431bdb4
JB
566### Fixed
567
568- Ensure workers are not recreated on error at pool startup.
569
570### Added
571
572- Add `ready` and `strategy` fields to pool information.
573- Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
caadbd41 574- Add dynamic pool sizing checks.
2431bdb4 575
369d0a51
JB
576## [2.6.9] - 2023-07-07
577
2845f2a5
JB
578### Fixed
579
580- Recreate the right worker type on uncaught exception.
581
582### Added
583
584- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 585- Add `runTime` and `waitTime` to pool information.
75d3401a 586- Check worker inactive time only on dynamic worker.
2845f2a5 587
fc97d613
JB
588## [2.6.8] - 2023-07-03
589
92b1feaa
JB
590### Fixed
591
592- Brown paper bag release to fix version handling in pool information.
593
52d54060
JB
594## [2.6.7] - 2023-07-03
595
5bc91f3e
JB
596### Fixed
597
598- Ensure worker queued tasks at error are reassigned to other pool workers.
599
afe0d5bf
JB
600### Added
601
602- Add pool `utilization` ratio to pool information.
23ccf9d7 603- Add `version` to pool information.
e5b3047d 604- Add worker information to worker nodes.
afe0d5bf 605
f42c583f
JB
606## [2.6.6] - 2023-07-01
607
6961ca9a
JB
608### Added
609
d5e3c4ff 610- Add safe helper `availableParallelism()` to help sizing the pool.
6961ca9a 611
3749facb
JB
612### Fixed
613
614- Ensure message handler is only registered in worker.
615
6fed2513
JB
616## [2.6.5] - 2023-06-27
617
c72f6987
JB
618### Known issues
619
70726c28 620- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
621
622### Fixed
623
624- Artificial version bump to 2.6.5 to workaround publication issue.
d5e3c4ff 625- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
c72f6987
JB
626- Ensure pool event is emitted before task error promise rejection.
627- Fix queued tasks count computation.
628
629### Removed
630
2fbe1783 631- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
c72f6987 632
6426631b
JB
633## [2.6.4] - 2023-06-27
634
941f9a7c
JB
635### Known issues
636
70726c28 637- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 638
2c039e43
JB
639### Fixed
640
d5e3c4ff 641- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
2c039e43 642- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 643- Fix queued tasks count computation.
2c039e43 644
941f9a7c
JB
645### Removed
646
2fbe1783 647- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
941f9a7c 648
bc1b0765
JB
649## [2.6.3] - 2023-06-19
650
a6a2dc4c
JB
651### Fixed
652
653- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 654- Update strategies internals after statistics computation.
a6a2dc4c 655
7b56f532
JB
656### Changed
657
658- Optimize O(1) queue implementation.
659
b628596c
JB
660## [2.6.2] - 2023-06-12
661
a9e89d00
JB
662### Fixed
663
664- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
665
4368a898
JB
666## [2.6.1] - 2023-06-10
667
931d43e2
JB
668### Added
669
13ab5b87 670- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
931d43e2 671
f1c06930
JB
672### Fixed
673
674- Fix average statistics computation: ensure failed tasks are not accounted.
675
16671b07
JB
676## [2.6.0] - 2023-06-09
677
a1347286
JB
678### Added
679
5af9c0f7 680- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 681- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 682
1c6fe997
JB
683### Changed
684
685- Refactor pool worker node usage internals.
477f48e7 686- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 687- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
688
689### Fixed
690
691- Fix wait time accounting.
692- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
693- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
694
aa07d6ee
JB
695## [2.5.4] - 2023-06-07
696
b6b32453
JB
697### Added
698
699- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
700
701### Changed
702
703- Compute statistics at the worker level only if needed.
2fbe1783 704- Add `worker_threads` options to thread pool options.
b6b32453 705
272d4d8f
JB
706### Fixed
707
708- Make the `LEAST_BUSY` strategy only relies on task runtime.
709
ed47fb3d
JB
710## [2.5.3] - 2023-06-04
711
89a4abfd
JB
712### Changed
713
714- Refine pool information content.
b4213b7f 715- Limit pool internals public exposure.
89a4abfd 716
8a9febf5
JB
717## [2.5.2] - 2023-06-02
718
91ee39ed
JB
719### Added
720
721- Add `taskError` pool event for task execution error.
6b27d407 722- Add pool information `info` property to pool.
91ee39ed
JB
723- Emit pool information on `busy` and `full` pool events.
724
8babb151
JB
725## [2.5.1] - 2023-06-01
726
0e05c4dc
JB
727### Added
728
1f68cede 729- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 730- Add `error` pool event for uncaught worker error.
0e05c4dc 731
a8766181
JB
732## [2.5.0] - 2023-05-31
733
e4543b14
JB
734### Added
735
736- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 737- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 738- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
739
740### Changed
741
742- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
743
570efb11
JB
744## [2.4.14] - 2023-05-09
745
b0f28bad
JB
746### Fixed
747
748- Ensure no undefined task runtime can land in the tasks history.
749- Fix median computation implementation once again.
750
110b6d13
JB
751### Added
752
753- Unit tests for median and queue implementations.
754
72584880
JB
755## [2.4.13] - 2023-05-08
756
b0d6ed8f
JB
757### Fixed
758
e3058615 759- Fix worker choice strategy options validation.
b0d6ed8f
JB
760- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
761
06140c32
JB
762## [2.4.12] - 2023-05-06
763
a86b6df1
JB
764### Added
765
766- Support multiple task functions per worker.
08f3f44c 767- Add custom worker weights support to worker choice strategies options.
a86b6df1 768
29ee7e9a
JB
769### Changed
770
771- Use O(1) queue implementation for tasks queueing.
772
0682ba15
JB
773### Fixed
774
775- Fix median computation implementation.
776- Fix fair share worker choice strategy internals update.
777
936d53ec
JB
778## [2.4.11] - 2023-04-23
779
cb70b19d
JB
780### Changed
781
782- Optimize free worker finding in worker choice strategies.
783
15bb637a
JB
784## [2.4.10] - 2023-04-15
785
ef41a6e6
JB
786### Fixed
787
82ea6492 788- Fix typescript type definition for task function: ensure the input data is optional.
ef41a6e6
JB
789- Fix typescript type definition for pool execute(): ensure the input data is optional.
790
181eb2b4
JB
791## [2.4.9] - 2023-04-15
792
a20f0ba5
JB
793### Added
794
795- Add tasks queue enablement runtime setter to pool.
796- Add tasks queue options runtime setter to pool.
797- Add worker choice strategy options runtime setter to pool.
798
799### Changed
800
801- Remove the tasks queuing experimental status.
802
d4aeae5a
JB
803### Fixed
804
82ea6492 805- Fix task function type definition and validation.
2fc5cae3 806- Fix worker choice strategy options handling.
d4aeae5a 807
1d9e7023
JB
808## [2.4.8] - 2023-04-12
809
f9b4bbf8
JB
810### Fixed
811
812- Fix message between main worker and worker type definition for tasks.
813- Fix code documentation.
814
12ae3210
JB
815## [2.4.7] - 2023-04-11
816
7171d33f
JB
817### Added
818
819- Add worker tasks queue options to pool options.
820
e8bd29ce
JB
821### Fixed
822
823- Fix missing documentation.
824
42c7bc10
JB
825## [2.4.6] - 2023-04-10
826
681196cc
JB
827### Fixed
828
829- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 830- Properly count worker executing tasks with tasks queueing enabled.
681196cc 831
54d360e3
JB
832## [2.4.5] - 2023-04-09
833
3fafb1b2
JB
834### Added
835
9e775f96
JB
836- Use monotonic high resolution timer for worker tasks runtime.
837- Add worker tasks median runtime to statistics.
ff733df7 838- Add worker tasks queue (experimental).
3fafb1b2 839
92fa3eb6
JB
840## [2.4.4] - 2023-04-07
841
aee46736
JB
842### Added
843
844- Add `PoolEvents` enumeration and `PoolEvent` type.
845
36b5e78f
JB
846### Fixed
847
ff0c2b3e 848- Destroy worker only on alive check.
36b5e78f 849
9fb0f324
JB
850## [2.4.3] - 2023-04-07
851
28cf3617
JB
852### Fixed
853
854- Fix typedoc generation with inheritance.
855
848f0f27
JB
856## [2.4.2] - 2023-04-06
857
164d950a
JB
858### Added
859
860- Add `full` event to dynamic pool.
32417142 861- Keep worker choice strategy in memory for conditional reuse.
164d950a 862
78ab2555
JB
863### Fixed
864
865- Fix possible negative worker key at worker removal in worker choice strategies.
866
79aafe9f
JB
867## [2.4.1] - 2023-04-05
868
9cd39dd4
JB
869### Changed
870
871- Optimize worker choice strategy for dynamic pool.
872
965415bb
JB
873### Fixed
874
875- Ensure dynamic pool does not alter worker choice strategy expected behavior.
876
d8b60b1c
JB
877## [2.4.0] - 2023-04-04
878
c6bd2650
JB
879### Added
880
881- Add `LESS_BUSY` worker choice strategy.
882
883### Changed
884
885- Optimize worker storage in pool.
886- Optimize worker alive status check.
887- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
888- Optimize `LESS_USED` worker choice strategy.
2a87030e 889- Update benchmark versus external threads pools.
c6bd2650
JB
890- Optimize tasks usage statistics requirements for worker choice strategy.
891
892### Fixed
893
894- Ensure trimmable characters are checked at pool initialization.
895- Fix message id integer overflow.
896- Fix pool worker removal in worker choice strategy internals.
897- Fix package publication with pnpm.
898
d0a3f018
JB
899## [2.4.0-3] - 2023-04-04
900
b2ede285
JB
901### Added
902
903- Add `LESS_BUSY` worker choice strategy.
904
905### Changed
906
907- Optimize worker storage in pool.
908- Optimize worker alive status check.
909- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
910- Optimize `LESS_USED` worker choice strategy.
2a87030e 911- Update benchmark versus external threads pools.
b2ede285
JB
912
913### Fixed
914
915- Ensure trimmable characters are checked at pool initialization.
916- Fix message id integer overflow.
917- Fix pool worker removal in worker choice strategy internals.
918- Fix package publication with pnpm.
919
a015ea40
JB
920## [2.4.0-2] - 2023-04-03
921
698f4bbc
JB
922### Added
923
924- Add `LESS_BUSY` worker choice strategy.
925
926### Changed
927
928- Optimize worker storage in pool.
929- Optimize worker alive status check.
930- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
931- Optimize `LESS_USED` worker choice strategy.
932
933### Fixed
934
935- Ensure trimmable characters are checked at pool initialization.
936- Fix message id integer overflow.
937- Fix pool worker removal in worker choice strategy internals.
938- Fix package publication with pnpm.
939
8fe15920
JB
940## [2.4.0-1] - 2023-04-03
941
5b301c28
JB
942### Added
943
944- Add `LESS_BUSY` worker choice strategy.
945
946### Changed
947
948- Optimize worker storage in pool.
949- Optimize worker alive status check.
950- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
951- Optimize `LESS_USED` worker choice strategy.
952
953### Fixed
954
955- Ensure trimmable characters are checked at pool initialization.
956- Fix message id integer overflow.
957- Fix pool worker removal in worker choice strategy internals.
958
2fb9ca9c
JB
959## [2.4.0-0] - 2023-04-03
960
168c526f
JB
961### Added
962
963- Add `LESS_BUSY` worker choice strategy.
964
1d71a908
JB
965### Changed
966
ffcbbad8 967- Optimize worker storage in pool.
1d71a908 968- Optimize worker alive status check.
65a60b3b 969- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 970- Optimize `LESS_USED` worker choice strategy.
1d71a908 971
ffcbbad8
JB
972### Fixed
973
974- Ensure trimmable characters are checked at pool initialization.
b4e75778 975- Fix message id integer overflow.
97a2abc3 976- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 977
08372738
JB
978## [2.3.10] - 2023-03-18
979
710826bc
JB
980### Fixed
981
9606b474 982- Fix package.json `exports` syntax for ESM and CommonJS.
710826bc
JB
983
984### Changed
985
986- Permit SemVer pre-release publication.
76e5ac6f 987
e4796ecd
JB
988## [2.3.10-2] - 2023-03-18
989
6abad580
JB
990### Fixed
991
9606b474 992- Fix package.json `exports` syntax for ESM and CommonJS.
6abad580 993
a2ee98cc
JB
994## [2.3.10-1] - 2023-03-18
995
7e060cee
JB
996### Changed
997
90483887 998- Permit SemVer pre-release publication.
7e060cee 999
c81bfafb
JB
1000## [2.3.10-0] - 2023-03-18
1001
fe18768d
JB
1002### Fixed
1003
9606b474 1004- Fix package.json `exports` syntax for ESM and CommonJS.
fe18768d 1005
d7b78217
JB
1006## [2.3.9] - 2023-03-18
1007
ed6dd37f
JB
1008### Changed
1009
1010- Introduce ESM module support along with CommonJS one.
1011
1012### Fixed
1013
1014- Fix brown paper bag bug referencing the same object literal.
1015
68e2ad86
JB
1016## [2.3.8] - 2023-03-18
1017
ca6c7d70
JB
1018### Changed
1019
1020- Switch internal benchmarking code to benny.
fbdedeb9
JB
1021- Switch to TypeScript 5.x.x.
1022- Switch rollup bundler plugins to core ones.
ed6dd37f 1023- Switch to TSDoc syntax.
fbdedeb9 1024- Enforce conventional commits.
ca6c7d70 1025
d15211d4
JB
1026### Fixed
1027
1028- Fix random integer generator.
fbdedeb9 1029- Fix worker choice strategy pool type identification at initialization.
d15211d4 1030
995705ea
JB
1031## [2.3.7] - 2022-10-23
1032
b953022b
JB
1033### Changed
1034
1035- Switch to open collective FOSS project funding platform.
78cea37e
JB
1036- Switch to ts-standard linter configuration on TypeScript code.
1037
1038### Fixed
1039
1040- Fixed missing async on pool execute method.
1041- Fixed typing in TypeScript example.
1042- Fixed types in unit tests.
b953022b 1043
3b9f6953
JB
1044## [2.3.6] - 2022-10-22
1045
f80cead4
JB
1046### Changed
1047
1048- Cleanup pool attributes and methods.
1049- Refine error types thrown.
1050
1051### Fixed
1052
1053- Fix continuous integration build on windows.
1054- Fix code coverage reporting by using c8 instead of nyc.
1055
efc22107
JB
1056## [2.3.5] - 2022-10-21
1057
7a6a0a96
JB
1058### Changed
1059
a05c10de
JB
1060- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
1061- Optimize tasks usage lookup implementation.
7a6a0a96 1062
b4904890
JB
1063### Fixed
1064
1065- Fix missed pool event emitter type export.
1066- Fix typedoc documentation generation.
1067
a875f8d1
JB
1068## [2.3.4] - 2022-10-17
1069
73cda448
JB
1070### Added
1071
1072- Fully automate release process with release-it.
1073
45a5a54c
JB
1074### Changed
1075
73cda448 1076- Optimize fair share task scheduling algorithm implementation.
2a87030e 1077- Update benchmark versus external pools results with latest version.
45a5a54c 1078
90ee1b18 1079## [2.3.3] - 2022-10-15
1a76932b
JB
1080
1081### Added
1082
1083- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
1084
90ee1b18 1085## [2.3.2] - 2022-10-14
11df3590
JB
1086
1087### Changed
1088
1089- Optimize fair share worker selection strategy implementation.
1090
1091### Fixed
1092
1093- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
1094
90ee1b18 1095## [2.3.1] - 2022-10-13
23ff945a
JB
1096
1097### Added
1098
1099- Pool worker choice strategies:
1100 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
1101 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
1102
90ee1b18 1103## [2.2.2] - 2022-10-09
cb2b6c69
JB
1104
1105### Fixed
1106
1107- Fixed `README.md` file.
1108
90ee1b18 1109## [2.2.1] - 2022-10-08
bdacc2d2 1110
bdaf31cd
JB
1111### Added
1112
1113- Dynamic worker choice strategy change at runtime.
bdacc2d2 1114
90ee1b18 1115## [2.2.0] - 2022-01-05
7e0d447f
JB
1116
1117### Breaking Changes
1118
9606b474 1119- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
7e0d447f 1120
90ee1b18 1121## [2.1.0] - 2021-08-29
35cf1c03
JB
1122
1123### Added
1124
1125- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
1126
1127### Breaking Changes
1128
1129- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
1130- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
1131- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 1132- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 1133
90ee1b18 1134## [2.0.2] - 2021-05-12
14916bf9
JB
1135
1136### Bug fixes
1137
1138- Fix `busy` event emission on fixed pool type
1139
90ee1b18 1140## [2.0.1] - 2021-03-16
7f685093
JB
1141
1142### Bug fixes
1143
1144- Check if pool options are properly set.
1145- `busy` event is emitted on all pool types.
1146
90ee1b18 1147## [2.0.0] - 2021-03-01
fa0f5b28 1148
f3f833ab 1149### Bug fixes
d63d3be3 1150
ddbeaffd 1151- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 1152
fa0f5b28
S
1153### Breaking Changes
1154
7f685093 1155- `FullPool` event is now renamed to `busy`.
1927ee67 1156- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 1157 _Find more details on our JSDoc._
ddbeaffd 1158
1927ee67
APA
1159- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
1160
ddbeaffd 1161- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 1162
ec2ccfc8
JB
1163### Pool options types declaration merge
1164
1165`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
1166
fa0f5b28
S
1167#### New `export` strategy
1168
1169```js
1170// Before
0eee77cb 1171const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 1172// After
0eee77cb 1173const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
1174```
1175
1176But you should always prefer just using
1177
1178```js
0eee77cb 1179const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
1180```
1181
d3c8a1a8
S
1182#### New type definitions for input data and response
1183
6677a3d3 1184For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
9606b474 1185_This is not a limitation by poolifier but Node.js._
d3c8a1a8 1186
3a4b605f 1187#### Public property replacements
5c5a1fb7 1188
3a4b605f 1189`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 1190
280c2a77 1191#### Internal (protected) properties and methods renaming
fa0f5b28 1192
280c2a77
S
1193These properties are not intended for end users
1194
1195- `id` => `nextMessageId`
1196
1197These methods are not intended for end users
fa0f5b28
S
1198
1199- `_chooseWorker` => `chooseWorker`
280c2a77 1200- `_newWorker` => `createWorker`
fa0f5b28
S
1201- `_execute` => `internalExecute`
1202- `_chooseWorker` => `chooseWorker`
1203- `_checkAlive` => `checkAlive`
1204- `_run` => `run`
1205- `_runAsync` => `runAsync`
1206
90ee1b18 1207## [1.1.0] - 2020-05-21
0312f71a
APA
1208
1209### Added
1210
1211- ThreadWorker support async functions as option
cf9aa6c3 1212- Various external library patches
0312f71a 1213
90ee1b18 1214## [1.0.0] - 2020-01-24
522eea03 1215
1216### Added
1217
1218- FixedThreadPool implementation
1219- DynamicThreadPool implementation
0312f71a 1220- WorkerThread implementation to improve developer experience