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