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