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