feat: add median task run time statistic
[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 ## [2.4.4] - 2023-04-07
11
12 ### Added
13
14 - Add `PoolEvents` enumeration and `PoolEvent` type.
15
16 ### Fixed
17
18 - Destroy worker only on alive check.
19
20 ## [2.4.3] - 2023-04-07
21
22 ### Fixed
23
24 - Fix typedoc generation with inheritance.
25
26 ## [2.4.2] - 2023-04-06
27
28 ### Added
29
30 - Add `full` event to dynamic pool.
31 - Keep worker choice strategy in memory for conditional reuse.
32
33 ### Fixed
34
35 - Fix possible negative worker key at worker removal in worker choice strategies.
36
37 ## [2.4.1] - 2023-04-05
38
39 ### Changed
40
41 - Optimize worker choice strategy for dynamic pool.
42
43 ### Fixed
44
45 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
46
47 ## [2.4.0] - 2023-04-04
48
49 ### Added
50
51 - Add `LESS_BUSY` worker choice strategy.
52
53 ### Changed
54
55 - Optimize worker storage in pool.
56 - Optimize worker alive status check.
57 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
58 - Optimize `LESS_USED` worker choice strategy.
59 - Update benchmarks versus external threads pools.
60 - Optimize tasks usage statistics requirements for worker choice strategy.
61
62 ### Fixed
63
64 - Ensure trimmable characters are checked at pool initialization.
65 - Fix message id integer overflow.
66 - Fix pool worker removal in worker choice strategy internals.
67 - Fix package publication with pnpm.
68
69 ## [2.4.0-3] - 2023-04-04
70
71 ### Added
72
73 - Add `LESS_BUSY` worker choice strategy.
74
75 ### Changed
76
77 - Optimize worker storage in pool.
78 - Optimize worker alive status check.
79 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
80 - Optimize `LESS_USED` worker choice strategy.
81 - Update benchmarks versus external threads pools.
82
83 ### Fixed
84
85 - Ensure trimmable characters are checked at pool initialization.
86 - Fix message id integer overflow.
87 - Fix pool worker removal in worker choice strategy internals.
88 - Fix package publication with pnpm.
89
90 ## [2.4.0-2] - 2023-04-03
91
92 ### Added
93
94 - Add `LESS_BUSY` worker choice strategy.
95
96 ### Changed
97
98 - Optimize worker storage in pool.
99 - Optimize worker alive status check.
100 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
101 - Optimize `LESS_USED` worker choice strategy.
102
103 ### Fixed
104
105 - Ensure trimmable characters are checked at pool initialization.
106 - Fix message id integer overflow.
107 - Fix pool worker removal in worker choice strategy internals.
108 - Fix package publication with pnpm.
109
110 ## [2.4.0-1] - 2023-04-03
111
112 ### Added
113
114 - Add `LESS_BUSY` worker choice strategy.
115
116 ### Changed
117
118 - Optimize worker storage in pool.
119 - Optimize worker alive status check.
120 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
121 - Optimize `LESS_USED` worker choice strategy.
122
123 ### Fixed
124
125 - Ensure trimmable characters are checked at pool initialization.
126 - Fix message id integer overflow.
127 - Fix pool worker removal in worker choice strategy internals.
128
129 ## [2.4.0-0] - 2023-04-03
130
131 ### Added
132
133 - Add `LESS_BUSY` worker choice strategy.
134
135 ### Changed
136
137 - Optimize worker storage in pool.
138 - Optimize worker alive status check.
139 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
140 - Optimize `LESS_USED` worker choice strategy.
141
142 ### Fixed
143
144 - Ensure trimmable characters are checked at pool initialization.
145 - Fix message id integer overflow.
146 - Fix pool worker removal in worker choice strategy internals.
147
148 ## [2.3.10] - 2023-03-18
149
150 ### Fixed
151
152 - Fix `exports` syntax for ESM and CommonJS.
153
154 ### Changed
155
156 - Permit SemVer pre-release publication.
157
158 ## [2.3.10-2] - 2023-03-18
159
160 ### Fixed
161
162 - Fix `exports` syntax for ESM and CommonJS.
163
164 ## [2.3.10-1] - 2023-03-18
165
166 ### Changed
167
168 - Permit SemVer pre-release publication.
169
170 ## [2.3.10-0] - 2023-03-18
171
172 ### Fixed
173
174 - Fix `exports` syntax for ESM and CommonJS.
175
176 ## [2.3.9] - 2023-03-18
177
178 ### Changed
179
180 - Introduce ESM module support along with CommonJS one.
181
182 ### Fixed
183
184 - Fix brown paper bag bug referencing the same object literal.
185
186 ## [2.3.8] - 2023-03-18
187
188 ### Changed
189
190 - Switch internal benchmarking code to benny.
191 - Switch to TypeScript 5.x.x.
192 - Switch rollup bundler plugins to core ones.
193 - Switch to TSDoc syntax.
194 - Enforce conventional commits.
195
196 ### Fixed
197
198 - Fix random integer generator.
199 - Fix worker choice strategy pool type identification at initialization.
200
201 ## [2.3.7] - 2022-10-23
202
203 ### Changed
204
205 - Switch to open collective FOSS project funding platform.
206 - Switch to ts-standard linter configuration on TypeScript code.
207
208 ### Fixed
209
210 - Fixed missing async on pool execute method.
211 - Fixed typing in TypeScript example.
212 - Fixed types in unit tests.
213
214 ## [2.3.6] - 2022-10-22
215
216 ### Changed
217
218 - Cleanup pool attributes and methods.
219 - Refine error types thrown.
220
221 ### Fixed
222
223 - Fix continuous integration build on windows.
224 - Fix code coverage reporting by using c8 instead of nyc.
225
226 ## [2.3.5] - 2022-10-21
227
228 ### Changed
229
230 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
231 - Optimize tasks usage lookup implementation.
232
233 ### Fixed
234
235 - Fix missed pool event emitter type export.
236 - Fix typedoc documentation generation.
237
238 ## [2.3.4] - 2022-10-17
239
240 ### Added
241
242 - Fully automate release process with release-it.
243
244 ### Changed
245
246 - Optimize fair share task scheduling algorithm implementation.
247 - Update benchmarks versus external pools results with latest version.
248
249 ## [2.3.3] - 2022-10-15
250
251 ### Added
252
253 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
254
255 ## [2.3.2] - 2022-10-14
256
257 ### Changed
258
259 - Optimize fair share worker selection strategy implementation.
260
261 ### Fixed
262
263 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
264
265 ## [2.3.1] - 2022-10-13
266
267 ### Added
268
269 - Pool worker choice strategies:
270 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
271 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
272
273 ## [2.2.2] - 2022-10-09
274
275 ### Fixed
276
277 - Fixed `README.md` file.
278
279 ## [2.2.1] - 2022-10-08
280
281 ### Added
282
283 - Dynamic worker choice strategy change at runtime.
284
285 ## [2.2.0] - 2022-01-05
286
287 ### Breaking Changes
288
289 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
290
291 ## [2.1.0] - 2021-08-29
292
293 ### Added
294
295 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
296
297 ### Breaking Changes
298
299 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
300 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
301 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
302 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
303
304 ## [2.0.2] - 2021-05-12
305
306 ### Bug fixes
307
308 - Fix `busy` event emission on fixed pool type
309
310 ## [2.0.1] - 2021-03-16
311
312 ### Bug fixes
313
314 - Check if pool options are properly set.
315 - `busy` event is emitted on all pool types.
316
317 ## [2.0.0] - 2021-03-01
318
319 ### Bug fixes
320
321 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
322
323 ### Breaking Changes
324
325 - `FullPool` event is now renamed to `busy`.
326 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
327 _Find more details on our JSDoc._
328
329 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
330
331 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
332
333 ### Pool options types declaration merge
334
335 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
336
337 #### New `export` strategy
338
339 ```js
340 // Before
341 const DynamicThreadPool = require('poolifier/lib/dynamic')
342 // After
343 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
344 ```
345
346 But you should always prefer just using
347
348 ```js
349 const { DynamicThreadPool } = require('poolifier')
350 ```
351
352 #### New type definitions for input data and response
353
354 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
355 _This is not a limitation by poolifier but NodeJS._
356
357 #### Public property replacements
358
359 `numWorkers` property is now `numberOfWorkers`
360
361 #### Internal (protected) properties and methods renaming
362
363 These properties are not intended for end users
364
365 - `id` => `nextMessageId`
366
367 These methods are not intended for end users
368
369 - `_chooseWorker` => `chooseWorker`
370 - `_newWorker` => `createWorker`
371 - `_execute` => `internalExecute`
372 - `_chooseWorker` => `chooseWorker`
373 - `_checkAlive` => `checkAlive`
374 - `_run` => `run`
375 - `_runAsync` => `runAsync`
376
377 ## [1.1.0] - 2020-05-21
378
379 ### Added
380
381 - ThreadWorker support async functions as option
382 - Various external library patches
383
384 ## [1.0.0] - 2020-01-24
385
386 ### Added
387
388 - FixedThreadPool implementation
389 - DynamicThreadPool implementation
390 - WorkerThread implementation to improve developer experience