chore: generate documentation
[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 ### Added
11
12 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
13
14 ### Changed
15
16 - Compute statistics at the worker level only if needed.
17 - Add `worker-threads` options to thread pool options.
18
19 ### Fixed
20
21 - Make the `LEAST_BUSY` strategy only relies on task runtime.
22
23 ## [2.5.3] - 2023-06-04
24
25 ### Changed
26
27 - Refine pool information content.
28 - Limit pool internals public exposure.
29
30 ## [2.5.2] - 2023-06-02
31
32 ### Added
33
34 - Add `taskError` pool event for task execution error.
35 - Add pool information `info` property to pool.
36 - Emit pool information on `busy` and `full` pool events.
37
38 ## [2.5.1] - 2023-06-01
39
40 ### Added
41
42 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
43 - Add `error` pool event for uncaught worker error.
44
45 ## [2.5.0] - 2023-05-31
46
47 ### Added
48
49 - Switch pool event emitter to `EventEmitterAsyncResource`.
50 - Add tasks wait time accounting in per worker tasks usage.
51 - Add interleaved weighted round robin worker choice strategy (experimental).
52
53 ### Changed
54
55 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
56
57 ## [2.4.14] - 2023-05-09
58
59 ### Fixed
60
61 - Ensure no undefined task runtime can land in the tasks history.
62 - Fix median computation implementation once again.
63
64 ### Added
65
66 - Unit tests for median and queue implementations.
67
68 ## [2.4.13] - 2023-05-08
69
70 ### Fixed
71
72 - Fix worker choice strategy options validation.
73 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
74
75 ## [2.4.12] - 2023-05-06
76
77 ### Added
78
79 - Support multiple task functions per worker.
80 - Add custom worker weights support to worker choice strategies options.
81
82 ### Changed
83
84 - Use O(1) queue implementation for tasks queueing.
85
86 ### Fixed
87
88 - Fix median computation implementation.
89 - Fix fair share worker choice strategy internals update.
90
91 ## [2.4.11] - 2023-04-23
92
93 ### Changed
94
95 - Optimize free worker finding in worker choice strategies.
96
97 ## [2.4.10] - 2023-04-15
98
99 ### Fixed
100
101 - Fix typescript type definition for worker function: ensure the input data is optional.
102 - Fix typescript type definition for pool execute(): ensure the input data is optional.
103
104 ## [2.4.9] - 2023-04-15
105
106 ### Added
107
108 - Add tasks queue enablement runtime setter to pool.
109 - Add tasks queue options runtime setter to pool.
110 - Add worker choice strategy options runtime setter to pool.
111
112 ### Changed
113
114 - Remove the tasks queuing experimental status.
115
116 ### Fixed
117
118 - Fix worker function type definition and validation.
119 - Fix worker choice strategy options handling.
120
121 ## [2.4.8] - 2023-04-12
122
123 ### Fixed
124
125 - Fix message between main worker and worker type definition for tasks.
126 - Fix code documentation.
127
128 ## [2.4.7] - 2023-04-11
129
130 ### Added
131
132 - Add worker tasks queue options to pool options.
133
134 ### Fixed
135
136 - Fix missing documentation.
137
138 ## [2.4.6] - 2023-04-10
139
140 ### Fixed
141
142 - Ensure one task at a time is executed per worker with tasks queueing enabled.
143 - Properly count worker running tasks with tasks queueing enabled.
144
145 ## [2.4.5] - 2023-04-09
146
147 ### Added
148
149 - Use monotonic high resolution timer for worker tasks runtime.
150 - Add worker tasks median runtime to statistics.
151 - Add worker tasks queue (experimental).
152
153 ## [2.4.4] - 2023-04-07
154
155 ### Added
156
157 - Add `PoolEvents` enumeration and `PoolEvent` type.
158
159 ### Fixed
160
161 - Destroy worker only on alive check.
162
163 ## [2.4.3] - 2023-04-07
164
165 ### Fixed
166
167 - Fix typedoc generation with inheritance.
168
169 ## [2.4.2] - 2023-04-06
170
171 ### Added
172
173 - Add `full` event to dynamic pool.
174 - Keep worker choice strategy in memory for conditional reuse.
175
176 ### Fixed
177
178 - Fix possible negative worker key at worker removal in worker choice strategies.
179
180 ## [2.4.1] - 2023-04-05
181
182 ### Changed
183
184 - Optimize worker choice strategy for dynamic pool.
185
186 ### Fixed
187
188 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
189
190 ## [2.4.0] - 2023-04-04
191
192 ### Added
193
194 - Add `LESS_BUSY` worker choice strategy.
195
196 ### Changed
197
198 - Optimize worker storage in pool.
199 - Optimize worker alive status check.
200 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
201 - Optimize `LESS_USED` worker choice strategy.
202 - Update benchmarks versus external threads pools.
203 - Optimize tasks usage statistics requirements for worker choice strategy.
204
205 ### Fixed
206
207 - Ensure trimmable characters are checked at pool initialization.
208 - Fix message id integer overflow.
209 - Fix pool worker removal in worker choice strategy internals.
210 - Fix package publication with pnpm.
211
212 ## [2.4.0-3] - 2023-04-04
213
214 ### Added
215
216 - Add `LESS_BUSY` worker choice strategy.
217
218 ### Changed
219
220 - Optimize worker storage in pool.
221 - Optimize worker alive status check.
222 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
223 - Optimize `LESS_USED` worker choice strategy.
224 - Update benchmarks versus external threads pools.
225
226 ### Fixed
227
228 - Ensure trimmable characters are checked at pool initialization.
229 - Fix message id integer overflow.
230 - Fix pool worker removal in worker choice strategy internals.
231 - Fix package publication with pnpm.
232
233 ## [2.4.0-2] - 2023-04-03
234
235 ### Added
236
237 - Add `LESS_BUSY` worker choice strategy.
238
239 ### Changed
240
241 - Optimize worker storage in pool.
242 - Optimize worker alive status check.
243 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
244 - Optimize `LESS_USED` worker choice strategy.
245
246 ### Fixed
247
248 - Ensure trimmable characters are checked at pool initialization.
249 - Fix message id integer overflow.
250 - Fix pool worker removal in worker choice strategy internals.
251 - Fix package publication with pnpm.
252
253 ## [2.4.0-1] - 2023-04-03
254
255 ### Added
256
257 - Add `LESS_BUSY` worker choice strategy.
258
259 ### Changed
260
261 - Optimize worker storage in pool.
262 - Optimize worker alive status check.
263 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
264 - Optimize `LESS_USED` worker choice strategy.
265
266 ### Fixed
267
268 - Ensure trimmable characters are checked at pool initialization.
269 - Fix message id integer overflow.
270 - Fix pool worker removal in worker choice strategy internals.
271
272 ## [2.4.0-0] - 2023-04-03
273
274 ### Added
275
276 - Add `LESS_BUSY` worker choice strategy.
277
278 ### Changed
279
280 - Optimize worker storage in pool.
281 - Optimize worker alive status check.
282 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
283 - Optimize `LESS_USED` worker choice strategy.
284
285 ### Fixed
286
287 - Ensure trimmable characters are checked at pool initialization.
288 - Fix message id integer overflow.
289 - Fix pool worker removal in worker choice strategy internals.
290
291 ## [2.3.10] - 2023-03-18
292
293 ### Fixed
294
295 - Fix `exports` syntax for ESM and CommonJS.
296
297 ### Changed
298
299 - Permit SemVer pre-release publication.
300
301 ## [2.3.10-2] - 2023-03-18
302
303 ### Fixed
304
305 - Fix `exports` syntax for ESM and CommonJS.
306
307 ## [2.3.10-1] - 2023-03-18
308
309 ### Changed
310
311 - Permit SemVer pre-release publication.
312
313 ## [2.3.10-0] - 2023-03-18
314
315 ### Fixed
316
317 - Fix `exports` syntax for ESM and CommonJS.
318
319 ## [2.3.9] - 2023-03-18
320
321 ### Changed
322
323 - Introduce ESM module support along with CommonJS one.
324
325 ### Fixed
326
327 - Fix brown paper bag bug referencing the same object literal.
328
329 ## [2.3.8] - 2023-03-18
330
331 ### Changed
332
333 - Switch internal benchmarking code to benny.
334 - Switch to TypeScript 5.x.x.
335 - Switch rollup bundler plugins to core ones.
336 - Switch to TSDoc syntax.
337 - Enforce conventional commits.
338
339 ### Fixed
340
341 - Fix random integer generator.
342 - Fix worker choice strategy pool type identification at initialization.
343
344 ## [2.3.7] - 2022-10-23
345
346 ### Changed
347
348 - Switch to open collective FOSS project funding platform.
349 - Switch to ts-standard linter configuration on TypeScript code.
350
351 ### Fixed
352
353 - Fixed missing async on pool execute method.
354 - Fixed typing in TypeScript example.
355 - Fixed types in unit tests.
356
357 ## [2.3.6] - 2022-10-22
358
359 ### Changed
360
361 - Cleanup pool attributes and methods.
362 - Refine error types thrown.
363
364 ### Fixed
365
366 - Fix continuous integration build on windows.
367 - Fix code coverage reporting by using c8 instead of nyc.
368
369 ## [2.3.5] - 2022-10-21
370
371 ### Changed
372
373 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
374 - Optimize tasks usage lookup implementation.
375
376 ### Fixed
377
378 - Fix missed pool event emitter type export.
379 - Fix typedoc documentation generation.
380
381 ## [2.3.4] - 2022-10-17
382
383 ### Added
384
385 - Fully automate release process with release-it.
386
387 ### Changed
388
389 - Optimize fair share task scheduling algorithm implementation.
390 - Update benchmarks versus external pools results with latest version.
391
392 ## [2.3.3] - 2022-10-15
393
394 ### Added
395
396 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
397
398 ## [2.3.2] - 2022-10-14
399
400 ### Changed
401
402 - Optimize fair share worker selection strategy implementation.
403
404 ### Fixed
405
406 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
407
408 ## [2.3.1] - 2022-10-13
409
410 ### Added
411
412 - Pool worker choice strategies:
413 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
414 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
415
416 ## [2.2.2] - 2022-10-09
417
418 ### Fixed
419
420 - Fixed `README.md` file.
421
422 ## [2.2.1] - 2022-10-08
423
424 ### Added
425
426 - Dynamic worker choice strategy change at runtime.
427
428 ## [2.2.0] - 2022-01-05
429
430 ### Breaking Changes
431
432 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
433
434 ## [2.1.0] - 2021-08-29
435
436 ### Added
437
438 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
439
440 ### Breaking Changes
441
442 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
443 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
444 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
445 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
446
447 ## [2.0.2] - 2021-05-12
448
449 ### Bug fixes
450
451 - Fix `busy` event emission on fixed pool type
452
453 ## [2.0.1] - 2021-03-16
454
455 ### Bug fixes
456
457 - Check if pool options are properly set.
458 - `busy` event is emitted on all pool types.
459
460 ## [2.0.0] - 2021-03-01
461
462 ### Bug fixes
463
464 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
465
466 ### Breaking Changes
467
468 - `FullPool` event is now renamed to `busy`.
469 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
470 _Find more details on our JSDoc._
471
472 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
473
474 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
475
476 ### Pool options types declaration merge
477
478 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
479
480 #### New `export` strategy
481
482 ```js
483 // Before
484 const DynamicThreadPool = require('poolifier/lib/dynamic')
485 // After
486 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
487 ```
488
489 But you should always prefer just using
490
491 ```js
492 const { DynamicThreadPool } = require('poolifier')
493 ```
494
495 #### New type definitions for input data and response
496
497 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
498 _This is not a limitation by poolifier but NodeJS._
499
500 #### Public property replacements
501
502 `numWorkers` property is now `numberOfWorkers`
503
504 #### Internal (protected) properties and methods renaming
505
506 These properties are not intended for end users
507
508 - `id` => `nextMessageId`
509
510 These methods are not intended for end users
511
512 - `_chooseWorker` => `chooseWorker`
513 - `_newWorker` => `createWorker`
514 - `_execute` => `internalExecute`
515 - `_chooseWorker` => `chooseWorker`
516 - `_checkAlive` => `checkAlive`
517 - `_run` => `run`
518 - `_runAsync` => `runAsync`
519
520 ## [1.1.0] - 2020-05-21
521
522 ### Added
523
524 - ThreadWorker support async functions as option
525 - Various external library patches
526
527 ## [1.0.0] - 2020-01-24
528
529 ### Added
530
531 - FixedThreadPool implementation
532 - DynamicThreadPool implementation
533 - WorkerThread implementation to improve developer experience