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