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