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