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