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