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