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