Add fair sharing worker choice strategy
[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.0.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8 ## [2.3.0] - 2022-dd-mm
9
10 ### Added
11
12 - Pool worker choice strategies:
13 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
14 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
15
16 ## [2.2.2] - 2022-09-10
17
18 ### Fixed
19
20 - Fixed `README.md` file.
21
22 ## [2.2.1] - 2022-08-10
23
24 ### Added
25
26 - Dynamic worker choice strategy change at runtime.
27
28 ## [2.2.0] - 2022-05-01
29
30 ### Breaking Changes
31
32 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
33
34 ## [2.1.0] - 2021-29-08
35
36 ### Added
37
38 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
39
40 ### Breaking Changes
41
42 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
43 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
44 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
45 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
46
47 ## [2.0.2] - 2021-12-05
48
49 ### Bug fixes
50
51 - Fix `busy` event emission on fixed pool type
52
53 ## [2.0.1] - 2021-16-03
54
55 ### Bug fixes
56
57 - Check if pool options are properly set.
58 - `busy` event is emitted on all pool types.
59
60 ## [2.0.0] - 2021-01-03
61
62 ### Bug fixes
63
64 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
65
66 ### Breaking Changes
67
68 - `FullPool` event is now renamed to `busy`.
69 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
70 _Find more details on our JSDoc._
71
72 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
73
74 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
75
76 ### Pool options types declaration merge
77
78 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
79
80 #### New `export` strategy
81
82 ```js
83 // Before
84 const DynamicThreadPool = require('poolifier/lib/dynamic')
85 // After
86 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
87 ```
88
89 But you should always prefer just using
90
91 ```js
92 const { DynamicThreadPool } = require('poolifier')
93 ```
94
95 #### New type definitions for input data and response
96
97 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
98 _This is not a limitation by poolifier but NodeJS._
99
100 #### Public property replacements
101
102 `numWorkers` property is now `numberOfWorkers`
103
104 #### Internal (protected) properties and methods renaming
105
106 These properties are not intended for end users
107
108 - `id` => `nextMessageId`
109
110 These methods are not intended for end users
111
112 - `_chooseWorker` => `chooseWorker`
113 - `_newWorker` => `createWorker`
114 - `_execute` => `internalExecute`
115 - `_chooseWorker` => `chooseWorker`
116 - `_checkAlive` => `checkAlive`
117 - `_run` => `run`
118 - `_runAsync` => `runAsync`
119
120 ## [1.1.0] - 2020-21-05
121
122 ### Added
123
124 - ThreadWorker support async functions as option
125 - Various external library patches
126
127 ## [1.0.0] - 2020-24-01
128
129 ### Added
130
131 - FixedThreadPool implementation
132 - DynamicThreadPool implementation
133 - WorkerThread implementation to improve developer experience