Merge branch 'master' into combined-prs-branch
[poolifier.git] / CHANGELOG.md
1 # Changelog
2
3 All notable changes to this project will be documented in this file.
4
5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8 ## [Unreleased]
9
10 ### Fixed
11
12 - Fix tasks redistribution triggers at pool destroying.
13
14 ## [3.1.11] - 2023-12-24
15
16 ### Fixed
17
18 - Avoid worker node cross tasks stealing.
19 - Ensure only half the pool worker nodes can steal tasks.
20
21 ## [3.1.10] - 2023-12-23
22
23 ### Changed
24
25 - Avoid useless branching on pool type.
26
27 ## [3.1.9] - 2023-12-22
28
29 ### Changed
30
31 - Readd ThreadPoolOptions and ClusterPoolOptions TS type aliases to PoolOptions.
32
33 ## [3.1.8] - 2023-12-21
34
35 ### Fixed
36
37 - Fix default worker weight computation.
38 - Fix possible null exception at pool destroying.
39
40 ## [3.1.7] - 2023-12-20
41
42 ### Fixed
43
44 - Ensure worker choice strategies implementation wait for worker node readiness: [#1748](https://github.com/poolifier/poolifier/issues/1748).
45
46 ## [3.1.6] - 2023-12-18
47
48 ### Fixed
49
50 - Fix pool destroying with tasks queuing enabled.
51
52 ## [3.1.5] - 2023-12-18
53
54 ### Added
55
56 - Add queued tasks end timeout support to worker node termination.
57
58 ## [3.1.4] - 2023-12-18
59
60 ### Fixed
61
62 - Make more robust the fix for possible null exception at handling task execution response.
63
64 ## [3.1.3] - 2023-12-17
65
66 ### Fixed
67
68 - Fix possible null exception at handling task execution response.
69
70 ## [3.1.2] - 2023-12-17
71
72 ### Fixed
73
74 - Wait for queued tasks to end at worker node termination.
75
76 ## [3.1.1] - 2023-12-16
77
78 ### Fixed
79
80 - Fix pool options TS type definition.
81
82 ## [3.1.0] - 2023-12-16
83
84 ### Changed
85
86 - TypeScript breaking change: merge ThreadPoolOptions and ClusterPoolOptions types into PoolOptions type.
87
88 ## [3.0.14] - 2023-12-13
89
90 ### Fixed
91
92 - Fix possible null exception with worker_threads pools.
93
94 ## [3.0.13] - 2023-12-12
95
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
104 ## [3.0.12] - 2023-12-12
105
106 ### Changed
107
108 - Add infinite retries support in worker choice strategy.
109
110 ## [3.0.11] - 2023-12-11
111
112 ### Fixed
113
114 - Ensure pool asynchronous resource properly track tasks execution.
115
116 ## [3.0.10] - 2023-12-08
117
118 ### Changed
119
120 - Add a fastpath when tasks stealing or redistribution is impossible.
121
122 ## [3.0.9] - 2023-11-26
123
124 ### Fixed
125
126 - Remove all pool events listener at pool destroying.
127 - Remove all worker node events listener at worker node destroying.
128 - Fix worker node event emitter listeners handling memory leak at pool options runtime change.
129
130 ## [3.0.8] - 2023-11-25
131
132 ### Fixed
133
134 - Ensure continuous tasks stealing on idle start at worker node idling.
135
136 ## [3.0.7] - 2023-11-24
137
138 ### Changed
139
140 - Make continuous tasks stealing start at worker node idling.
141
142 ## [3.0.6] - 2023-11-24
143
144 ### Fixed
145
146 - Ensure pool statuses are checked at initialization, `start()` or `destroy()`.
147 - Ensure pool `ready` event can be emitted after several `start()/destroy()` cycles.
148
149 ## [3.0.5] - 2023-10-27
150
151 ### Fixed
152
153 - Ensure pool `ready` event can be emitted only once.
154
155 ## [3.0.4] - 2023-10-20
156
157 ### Changed
158
159 - Switch to Bencher for benchmarking: [https://bencher.dev/perf/poolifier](https://bencher.dev/perf/poolifier).
160 - Use builtin retry mechanism in worker choice strategies instead of custom one.
161
162 ## [3.0.3] - 2023-10-19
163
164 ### Fixed
165
166 - Avoid null exception at sending message to worker.
167 - Avoid null exception at checking worker node readiness.
168
169 ## [3.0.2] - 2023-10-17
170
171 ### Fixed
172
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).
174
175 ## [3.0.1] - 2023-10-16
176
177 ### Fixed
178
179 - Workaround possible race condition at work nodes array element removal and querying. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468).
180
181 ### Changed
182
183 - Switch the worker node eventing code to `EventTarget` API.
184
185 ## [3.0.0] - 2023-10-08
186
187 ### Changed
188
189 - Remove Node.js 16.x.x (EOL) support.
190
191 ## [2.7.5] - 2023-10-03
192
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
197 ## [2.7.4] - 2023-09-25
198
199 ### Fixed
200
201 - Fix source maps (bundler issue).
202
203 ## [2.7.3] - 2023-09-24
204
205 ### Changed
206
207 - Convert pool event emitter to event emitter async resource.
208
209 ## [2.7.2] - 2023-09-23
210
211 ### Changed
212
213 - Add source maps to npm package to ease debugging.
214
215 ### Added
216
217 - Continuous benchmarking versus other worker pools: [https://poolifier.github.io/benchmark](https://poolifier.github.io/benchmark).
218
219 ## [2.7.1] - 2023-09-20
220
221 ### Fixed
222
223 - Ensure worker message listener used one time are removed after usage.
224
225 ## [2.7.0] - 2023-09-19
226
227 ### Fixed
228
229 - Fix task stealing related tasks queue options handling at runtime.
230
231 ### Changed
232
233 - Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
234
235 ### Added
236
237 - Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API: [PR #1148](https://github.com/poolifier/poolifier/pull/1148).
238 - Stricter worker constructor arguments validation.
239
240 ## [2.6.45] - 2023-09-17
241
242 ### Changed
243
244 - Disable publication on GitHub packages registry on release until authentication issue is fixed.
245
246 ### Added
247
248 - Add `startWorkers` to pool options to whether start the minimum number of workers at pool initialization or not.
249 - Add `start()` method to pool API to start the minimum number of workers.
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.
251 - Continuous internal benchmarking: [https://poolifier.github.io/benchmark-results/dev/bench](https://poolifier.github.io/benchmark-results/dev/bench).
252
253 ## [2.6.44] - 2023-09-08
254
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
267 ## [2.6.43] - 2023-09-08
268
269 ### Added
270
271 - Publish on GitHub packages registry on release.
272
273 ### Changed
274
275 - Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
276
277 ## [2.6.42] - 2023-09-06
278
279 ### Changed
280
281 - Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ...
282
283 ## [2.6.41] - 2023-09-03
284
285 ### Changed
286
287 - Optimize worker choice strategies implementation.
288
289 ## [2.6.40] - 2023-09-01
290
291 ### Fixed
292
293 - Do not pre-choose in WRR worker choice strategy to avoid bias.
294 - Avoid array out of bound in worker choice strategies after worker node removal.
295
296 ## [2.6.39] - 2023-08-30
297
298 ### Fixed
299
300 - Fix race condition in worker choice strategies at worker node info querying while not yet initialized.
301
302 ## [2.6.38] - 2023-08-30
303
304 ### Added
305
306 - Bundle typescript types declaration into one file.
307
308 ### Changed
309
310 - Improve interleaved weighted round robin worker choice strategy implementation.
311
312 ## [2.6.37] - 2023-08-28
313
314 ### Fixed
315
316 - Ensure unused worker usage statistics are deleted at runtime.
317
318 ### Changed
319
320 - Rename worker choice strategy options `choiceRetries` to `retries`.
321 - Avoid unnecessary branching in worker choice strategies.
322
323 ## [2.6.36] - 2023-08-27
324
325 ### Fixed
326
327 - Fix pool `execute()` arguments check.
328
329 ### Changed
330
331 - Make continuous tasks stealing algorithm less aggressive.
332 - Fine tune tasks stealing algorithm under back pressure.
333
334 ## [2.6.35] - 2023-08-25
335
336 ### Fixed
337
338 - Don't account worker usage statistics for tasks that have failed.
339 - Fix pool information runtime and wait time median computation.
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.
345 - Account for stolen tasks in worker usage statistics and pool information.
346
347 ### Added
348
349 - Continuous tasks stealing algorithm.
350
351 ## [2.6.34] - 2023-08-24
352
353 ### Fixes
354
355 - Avoid cascading tasks stealing under back pressure.
356
357 ### Changed
358
359 - Add fastpath to queued tasks rescheduling.
360
361 ## [2.6.33] - 2023-08-24
362
363 ### Fixed
364
365 - Fix queued tasks rescheduling.
366
367 ### Changed
368
369 - Rename tasks queue options `queueMaxSize` to `size`.
370
371 ### Added
372
373 - Task stealing scheduling algorithm if tasks queueing is enabled.
374
375 ## [2.6.32] - 2023-08-23
376
377 ### Fixed
378
379 - Ensure no task can be executed when the pool is destroyed.
380
381 ### Added
382
383 - Add `queueMaxSize` option to tasks queue options.
384 - Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing.
385 - Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled.
386
387 ## [2.6.31] - 2023-08-20
388
389 ### Fixed
390
391 - Fix worker choice strategy retries mechanism in some edge cases.
392
393 ### Changed
394
395 - Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage.
396 - Remove the experimental status of the `LEAST_ELU` worker choice strategy.
397
398 ## [2.6.30] - 2023-08-19
399
400 ### Fixed
401
402 - Ensure pool event `backPressure` is emitted.
403 - Ensure pool event `full` is emitted only once.
404 - Ensure worker node cannot be instantiated without proper arguments.
405
406 ## [2.6.29] - 2023-08-18
407
408 ### Fixed
409
410 - Fix race condition between readiness and task functions worker message handling at startup.
411 - Fix duplicate task function worker usage statistics computation per task function.
412 - Update task function worker usage statistics if and only if there's at least two different task functions.
413 - Fix race condition at task function worker usage executing task computation leading to negative value.
414
415 ### Added
416
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).
418 - Use back pressure detection in worker choice strategies.
419 - Add worker choice strategies retries mechanism if no worker is eligible.
420
421 ## [2.6.28] - 2023-08-16
422
423 ### Fixed
424
425 - Ensure pool workers are properly initialized.
426
427 ### Added
428
429 - HTTP server pool examples: express-cluster, express-hybrid.
430
431 ### Changed
432
433 - Remove now useless branching in worker hot code path.
434
435 ## [2.6.27] - 2023-08-15
436
437 ### Fixed
438
439 - Add `KillHandler` type definition to exported types.
440
441 ### Added
442
443 - Add `destroy` event to pool API.
444
445 ## [2.6.26] - 2023-08-15
446
447 ### Added
448
449 - Add kill handler to worker options allowing to execute custom code when worker is killed.
450 - Add `listTaskFunctions()` method to pool API.
451 - SMTP client pool example: nodemailer.
452
453 ## [2.6.25] - 2023-08-13
454
455 ### Added
456
457 - HTTP server pool examples: fastify-cluster, fastify-hybrid.
458 - WebSocket server pool examples: ws-cluster, ws-hybrid.
459
460 ## [2.6.24] - 2023-08-12
461
462 ### Added
463
464 - Add array of transferable objects to the `execute()` method arguments.
465 - WebSocket server pool examples: ws-worker_threads.
466
467 ## [2.6.23] - 2023-08-11
468
469 ### Fixed
470
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.
472
473 ### Added
474
475 - HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
476 - HTTP server pool examples: express-worker_threads, fastify-worker_threads.
477
478 ## [2.6.22] - 2023-08-10
479
480 ### Fixed
481
482 - Add missing `types` field to package.json `exports`.
483
484 ### Changed
485
486 - Structure markdown documentation (PR #811).
487
488 ## [2.6.21] - 2023-08-03
489
490 ### Changed
491
492 - Improve code documentation.
493 - Code refactoring and cleanup for better maintainability and readability.
494
495 ## [2.6.20] - 2023-07-21
496
497 ### Fixed
498
499 - Fix queued tasks redistribution on error task execution starvation.
500 - Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
501
502 ### Changed
503
504 - Drastically reduce lookups by worker in the worker nodes.
505
506 ## [2.6.19] - 2023-07-20
507
508 ### Added
509
510 - Dedicated internal communication channel for worker_threads pools.
511
512 ## [2.6.18] - 2023-07-19
513
514 ### Changed
515
516 - Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
517
518 ## [2.6.17] - 2023-07-16
519
520 ### Added
521
522 - Add `listTaskFunctions()` method to worker API.
523
524 ## [2.6.16] - 2023-07-12
525
526 ### Fixed
527
528 - Fix pool startup detection.
529 - Fix worker task functions handling.
530
531 ## [2.6.15] - 2023-07-11
532
533 ### Added
534
535 - Take into account worker node readiness in worker choice strategies.
536
537 ## [2.6.14] - 2023-07-10
538
539 ### Fixed
540
541 - Fix task function statistics tracking.
542
543 ## [2.6.13] - 2023-07-10
544
545 ### Added
546
547 - Add per task function statistics tracking.
548 - Add public methods to manipulate the worker task functions at runtime.
549
550 ## [2.6.12] - 2023-07-09
551
552 ### Fixed
553
554 - Workaround import issue with `node:os` module in node 16.x.x.
555
556 ## [2.6.11] - 2023-07-09
557
558 ### Fixed
559
560 - Fix pool readiness semantic.
561
562 ## [2.6.10] - 2023-07-08
563
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.
572 - Add dynamic pool sizing checks.
573
574 ## [2.6.9] - 2023-07-07
575
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.
583 - Add `runTime` and `waitTime` to pool information.
584 - Check worker inactive time only on dynamic worker.
585
586 ## [2.6.8] - 2023-07-03
587
588 ### Fixed
589
590 - Brown paper bag release to fix version handling in pool information.
591
592 ## [2.6.7] - 2023-07-03
593
594 ### Fixed
595
596 - Ensure worker queued tasks at error are reassigned to other pool workers.
597
598 ### Added
599
600 - Add pool `utilization` ratio to pool information.
601 - Add `version` to pool information.
602 - Add worker information to worker nodes.
603
604 ## [2.6.6] - 2023-07-01
605
606 ### Added
607
608 - Add safe helper `availableParallelism()` to help sizing the pool.
609
610 ### Fixed
611
612 - Ensure message handler is only registered in worker.
613
614 ## [2.6.5] - 2023-06-27
615
616 ### Known issues
617
618 - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
619
620 ### Fixed
621
622 - Artificial version bump to 2.6.5 to workaround publication issue.
623 - Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
624 - Ensure pool event is emitted before task error promise rejection.
625 - Fix queued tasks count computation.
626
627 ### Removed
628
629 - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
630
631 ## [2.6.4] - 2023-06-27
632
633 ### Known issues
634
635 - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
636
637 ### Fixed
638
639 - Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
640 - Ensure pool event is emitted before task error promise rejection.
641 - Fix queued tasks count computation.
642
643 ### Removed
644
645 - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
646
647 ## [2.6.3] - 2023-06-19
648
649 ### Fixed
650
651 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
652 - Update strategies internals after statistics computation.
653
654 ### Changed
655
656 - Optimize O(1) queue implementation.
657
658 ## [2.6.2] - 2023-06-12
659
660 ### Fixed
661
662 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
663
664 ## [2.6.1] - 2023-06-10
665
666 ### Added
667
668 - Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
669
670 ### Fixed
671
672 - Fix average statistics computation: ensure failed tasks are not accounted.
673
674 ## [2.6.0] - 2023-06-09
675
676 ### Added
677
678 - Add `LEAST_ELU` worker choice strategy (experimental).
679 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
680
681 ### Changed
682
683 - Refactor pool worker node usage internals.
684 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
685 - Breaking change: pool information `info` property object fields have been renamed.
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
693 ## [2.5.4] - 2023-06-07
694
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.
702 - Add `worker_threads` options to thread pool options.
703
704 ### Fixed
705
706 - Make the `LEAST_BUSY` strategy only relies on task runtime.
707
708 ## [2.5.3] - 2023-06-04
709
710 ### Changed
711
712 - Refine pool information content.
713 - Limit pool internals public exposure.
714
715 ## [2.5.2] - 2023-06-02
716
717 ### Added
718
719 - Add `taskError` pool event for task execution error.
720 - Add pool information `info` property to pool.
721 - Emit pool information on `busy` and `full` pool events.
722
723 ## [2.5.1] - 2023-06-01
724
725 ### Added
726
727 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
728 - Add `error` pool event for uncaught worker error.
729
730 ## [2.5.0] - 2023-05-31
731
732 ### Added
733
734 - Switch pool event emitter to `EventEmitterAsyncResource`.
735 - Add tasks wait time accounting in per worker tasks usage.
736 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
737
738 ### Changed
739
740 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
741
742 ## [2.4.14] - 2023-05-09
743
744 ### Fixed
745
746 - Ensure no undefined task runtime can land in the tasks history.
747 - Fix median computation implementation once again.
748
749 ### Added
750
751 - Unit tests for median and queue implementations.
752
753 ## [2.4.13] - 2023-05-08
754
755 ### Fixed
756
757 - Fix worker choice strategy options validation.
758 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
759
760 ## [2.4.12] - 2023-05-06
761
762 ### Added
763
764 - Support multiple task functions per worker.
765 - Add custom worker weights support to worker choice strategies options.
766
767 ### Changed
768
769 - Use O(1) queue implementation for tasks queueing.
770
771 ### Fixed
772
773 - Fix median computation implementation.
774 - Fix fair share worker choice strategy internals update.
775
776 ## [2.4.11] - 2023-04-23
777
778 ### Changed
779
780 - Optimize free worker finding in worker choice strategies.
781
782 ## [2.4.10] - 2023-04-15
783
784 ### Fixed
785
786 - Fix typescript type definition for task function: ensure the input data is optional.
787 - Fix typescript type definition for pool execute(): ensure the input data is optional.
788
789 ## [2.4.9] - 2023-04-15
790
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
801 ### Fixed
802
803 - Fix task function type definition and validation.
804 - Fix worker choice strategy options handling.
805
806 ## [2.4.8] - 2023-04-12
807
808 ### Fixed
809
810 - Fix message between main worker and worker type definition for tasks.
811 - Fix code documentation.
812
813 ## [2.4.7] - 2023-04-11
814
815 ### Added
816
817 - Add worker tasks queue options to pool options.
818
819 ### Fixed
820
821 - Fix missing documentation.
822
823 ## [2.4.6] - 2023-04-10
824
825 ### Fixed
826
827 - Ensure one task at a time is executed per worker with tasks queueing enabled.
828 - Properly count worker executing tasks with tasks queueing enabled.
829
830 ## [2.4.5] - 2023-04-09
831
832 ### Added
833
834 - Use monotonic high resolution timer for worker tasks runtime.
835 - Add worker tasks median runtime to statistics.
836 - Add worker tasks queue (experimental).
837
838 ## [2.4.4] - 2023-04-07
839
840 ### Added
841
842 - Add `PoolEvents` enumeration and `PoolEvent` type.
843
844 ### Fixed
845
846 - Destroy worker only on alive check.
847
848 ## [2.4.3] - 2023-04-07
849
850 ### Fixed
851
852 - Fix typedoc generation with inheritance.
853
854 ## [2.4.2] - 2023-04-06
855
856 ### Added
857
858 - Add `full` event to dynamic pool.
859 - Keep worker choice strategy in memory for conditional reuse.
860
861 ### Fixed
862
863 - Fix possible negative worker key at worker removal in worker choice strategies.
864
865 ## [2.4.1] - 2023-04-05
866
867 ### Changed
868
869 - Optimize worker choice strategy for dynamic pool.
870
871 ### Fixed
872
873 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
874
875 ## [2.4.0] - 2023-04-04
876
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.
887 - Update benchmark versus external threads pools.
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
897 ## [2.4.0-3] - 2023-04-04
898
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.
909 - Update benchmark versus external threads pools.
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
918 ## [2.4.0-2] - 2023-04-03
919
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
938 ## [2.4.0-1] - 2023-04-03
939
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
957 ## [2.4.0-0] - 2023-04-03
958
959 ### Added
960
961 - Add `LESS_BUSY` worker choice strategy.
962
963 ### Changed
964
965 - Optimize worker storage in pool.
966 - Optimize worker alive status check.
967 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
968 - Optimize `LESS_USED` worker choice strategy.
969
970 ### Fixed
971
972 - Ensure trimmable characters are checked at pool initialization.
973 - Fix message id integer overflow.
974 - Fix pool worker removal in worker choice strategy internals.
975
976 ## [2.3.10] - 2023-03-18
977
978 ### Fixed
979
980 - Fix package.json `exports` syntax for ESM and CommonJS.
981
982 ### Changed
983
984 - Permit SemVer pre-release publication.
985
986 ## [2.3.10-2] - 2023-03-18
987
988 ### Fixed
989
990 - Fix package.json `exports` syntax for ESM and CommonJS.
991
992 ## [2.3.10-1] - 2023-03-18
993
994 ### Changed
995
996 - Permit SemVer pre-release publication.
997
998 ## [2.3.10-0] - 2023-03-18
999
1000 ### Fixed
1001
1002 - Fix package.json `exports` syntax for ESM and CommonJS.
1003
1004 ## [2.3.9] - 2023-03-18
1005
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
1014 ## [2.3.8] - 2023-03-18
1015
1016 ### Changed
1017
1018 - Switch internal benchmarking code to benny.
1019 - Switch to TypeScript 5.x.x.
1020 - Switch rollup bundler plugins to core ones.
1021 - Switch to TSDoc syntax.
1022 - Enforce conventional commits.
1023
1024 ### Fixed
1025
1026 - Fix random integer generator.
1027 - Fix worker choice strategy pool type identification at initialization.
1028
1029 ## [2.3.7] - 2022-10-23
1030
1031 ### Changed
1032
1033 - Switch to open collective FOSS project funding platform.
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.
1041
1042 ## [2.3.6] - 2022-10-22
1043
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
1054 ## [2.3.5] - 2022-10-21
1055
1056 ### Changed
1057
1058 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
1059 - Optimize tasks usage lookup implementation.
1060
1061 ### Fixed
1062
1063 - Fix missed pool event emitter type export.
1064 - Fix typedoc documentation generation.
1065
1066 ## [2.3.4] - 2022-10-17
1067
1068 ### Added
1069
1070 - Fully automate release process with release-it.
1071
1072 ### Changed
1073
1074 - Optimize fair share task scheduling algorithm implementation.
1075 - Update benchmark versus external pools results with latest version.
1076
1077 ## [2.3.3] - 2022-10-15
1078
1079 ### Added
1080
1081 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
1082
1083 ## [2.3.2] - 2022-10-14
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
1093 ## [2.3.1] - 2022-10-13
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
1101 ## [2.2.2] - 2022-10-09
1102
1103 ### Fixed
1104
1105 - Fixed `README.md` file.
1106
1107 ## [2.2.1] - 2022-10-08
1108
1109 ### Added
1110
1111 - Dynamic worker choice strategy change at runtime.
1112
1113 ## [2.2.0] - 2022-01-05
1114
1115 ### Breaking Changes
1116
1117 - Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
1118
1119 ## [2.1.0] - 2021-08-29
1120
1121 ### Added
1122
1123 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
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`.
1130 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
1131
1132 ## [2.0.2] - 2021-05-12
1133
1134 ### Bug fixes
1135
1136 - Fix `busy` event emission on fixed pool type
1137
1138 ## [2.0.1] - 2021-03-16
1139
1140 ### Bug fixes
1141
1142 - Check if pool options are properly set.
1143 - `busy` event is emitted on all pool types.
1144
1145 ## [2.0.0] - 2021-03-01
1146
1147 ### Bug fixes
1148
1149 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
1150
1151 ### Breaking Changes
1152
1153 - `FullPool` event is now renamed to `busy`.
1154 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1155 _Find more details on our JSDoc._
1156
1157 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
1158
1159 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
1160
1161 ### Pool options types declaration merge
1162
1163 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
1164
1165 #### New `export` strategy
1166
1167 ```js
1168 // Before
1169 const DynamicThreadPool = require('poolifier/lib/dynamic')
1170 // After
1171 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
1172 ```
1173
1174 But you should always prefer just using
1175
1176 ```js
1177 const { DynamicThreadPool } = require('poolifier')
1178 ```
1179
1180 #### New type definitions for input data and response
1181
1182 For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
1183 _This is not a limitation by poolifier but Node.js._
1184
1185 #### Public property replacements
1186
1187 `numWorkers` property is now `numberOfWorkers`
1188
1189 #### Internal (protected) properties and methods renaming
1190
1191 These properties are not intended for end users
1192
1193 - `id` => `nextMessageId`
1194
1195 These methods are not intended for end users
1196
1197 - `_chooseWorker` => `chooseWorker`
1198 - `_newWorker` => `createWorker`
1199 - `_execute` => `internalExecute`
1200 - `_chooseWorker` => `chooseWorker`
1201 - `_checkAlive` => `checkAlive`
1202 - `_run` => `run`
1203 - `_runAsync` => `runAsync`
1204
1205 ## [1.1.0] - 2020-05-21
1206
1207 ### Added
1208
1209 - ThreadWorker support async functions as option
1210 - Various external library patches
1211
1212 ## [1.0.0] - 2020-01-24
1213
1214 ### Added
1215
1216 - FixedThreadPool implementation
1217 - DynamicThreadPool implementation
1218 - WorkerThread implementation to improve developer experience