chore: generate documentation
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
d4abc60a 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
522eea03 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c
JB
8## [Unreleased]
9
5bc91f3e
JB
10### Fixed
11
12- Ensure worker queued tasks at error are reassigned to other pool workers.
13
afe0d5bf
JB
14### Added
15
16- Add pool `utilization` ratio to pool information.
23ccf9d7 17- Add `version` to pool information.
e5b3047d 18- Add worker information to worker nodes.
afe0d5bf 19
f42c583f
JB
20## [2.6.6] - 2023-07-01
21
6961ca9a
JB
22### Added
23
24- Add safe helper `availableParallelism` to help sizing the pool.
25
3749facb
JB
26### Fixed
27
28- Ensure message handler is only registered in worker.
29
6fed2513
JB
30## [2.6.5] - 2023-06-27
31
c72f6987
JB
32### Known issues
33
70726c28 34- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
35
36### Fixed
37
38- Artificial version bump to 2.6.5 to workaround publication issue.
39- Ensure cluster pool destroy() gracefully shutdowns worker's server.
40- Ensure pool event is emitted before task error promise rejection.
41- Fix queued tasks count computation.
42
43### Removed
44
45- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
46
6426631b
JB
47## [2.6.4] - 2023-06-27
48
941f9a7c
JB
49### Known issues
50
70726c28 51- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 52
2c039e43
JB
53### Fixed
54
55- Ensure cluster pool destroy() gracefully shutdowns worker's server.
56- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 57- Fix queued tasks count computation.
2c039e43 58
941f9a7c
JB
59### Removed
60
61- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
62
bc1b0765
JB
63## [2.6.3] - 2023-06-19
64
a6a2dc4c
JB
65### Fixed
66
67- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 68- Update strategies internals after statistics computation.
a6a2dc4c 69
7b56f532
JB
70### Changed
71
72- Optimize O(1) queue implementation.
73
b628596c
JB
74## [2.6.2] - 2023-06-12
75
a9e89d00
JB
76### Fixed
77
78- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
79
4368a898
JB
80## [2.6.1] - 2023-06-10
81
931d43e2
JB
82### Added
83
84- Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
85
f1c06930
JB
86### Fixed
87
88- Fix average statistics computation: ensure failed tasks are not accounted.
89
16671b07
JB
90## [2.6.0] - 2023-06-09
91
a1347286
JB
92### Added
93
5af9c0f7 94- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 95- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 96
1c6fe997
JB
97### Changed
98
99- Refactor pool worker node usage internals.
477f48e7 100- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 101- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
102
103### Fixed
104
105- Fix wait time accounting.
106- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
107- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
108
aa07d6ee
JB
109## [2.5.4] - 2023-06-07
110
b6b32453
JB
111### Added
112
113- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
114
115### Changed
116
117- Compute statistics at the worker level only if needed.
90082c8c 118- Add `worker-threads` options to thread pool options.
b6b32453 119
272d4d8f
JB
120### Fixed
121
122- Make the `LEAST_BUSY` strategy only relies on task runtime.
123
ed47fb3d
JB
124## [2.5.3] - 2023-06-04
125
89a4abfd
JB
126### Changed
127
128- Refine pool information content.
b4213b7f 129- Limit pool internals public exposure.
89a4abfd 130
8a9febf5
JB
131## [2.5.2] - 2023-06-02
132
91ee39ed
JB
133### Added
134
135- Add `taskError` pool event for task execution error.
6b27d407 136- Add pool information `info` property to pool.
91ee39ed
JB
137- Emit pool information on `busy` and `full` pool events.
138
8babb151
JB
139## [2.5.1] - 2023-06-01
140
0e05c4dc
JB
141### Added
142
1f68cede 143- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 144- Add `error` pool event for uncaught worker error.
0e05c4dc 145
a8766181
JB
146## [2.5.0] - 2023-05-31
147
e4543b14
JB
148### Added
149
150- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 151- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 152- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
153
154### Changed
155
156- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
157
570efb11
JB
158## [2.4.14] - 2023-05-09
159
b0f28bad
JB
160### Fixed
161
162- Ensure no undefined task runtime can land in the tasks history.
163- Fix median computation implementation once again.
164
110b6d13
JB
165### Added
166
167- Unit tests for median and queue implementations.
168
72584880
JB
169## [2.4.13] - 2023-05-08
170
b0d6ed8f
JB
171### Fixed
172
e3058615 173- Fix worker choice strategy options validation.
b0d6ed8f
JB
174- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
175
06140c32
JB
176## [2.4.12] - 2023-05-06
177
a86b6df1
JB
178### Added
179
180- Support multiple task functions per worker.
08f3f44c 181- Add custom worker weights support to worker choice strategies options.
a86b6df1 182
29ee7e9a
JB
183### Changed
184
185- Use O(1) queue implementation for tasks queueing.
186
0682ba15
JB
187### Fixed
188
189- Fix median computation implementation.
190- Fix fair share worker choice strategy internals update.
191
936d53ec
JB
192## [2.4.11] - 2023-04-23
193
cb70b19d
JB
194### Changed
195
196- Optimize free worker finding in worker choice strategies.
197
15bb637a
JB
198## [2.4.10] - 2023-04-15
199
ef41a6e6
JB
200### Fixed
201
202- Fix typescript type definition for worker function: ensure the input data is optional.
203- Fix typescript type definition for pool execute(): ensure the input data is optional.
204
181eb2b4
JB
205## [2.4.9] - 2023-04-15
206
a20f0ba5
JB
207### Added
208
209- Add tasks queue enablement runtime setter to pool.
210- Add tasks queue options runtime setter to pool.
211- Add worker choice strategy options runtime setter to pool.
212
213### Changed
214
215- Remove the tasks queuing experimental status.
216
d4aeae5a
JB
217### Fixed
218
219- Fix worker function type definition and validation.
2fc5cae3 220- Fix worker choice strategy options handling.
d4aeae5a 221
1d9e7023
JB
222## [2.4.8] - 2023-04-12
223
f9b4bbf8
JB
224### Fixed
225
226- Fix message between main worker and worker type definition for tasks.
227- Fix code documentation.
228
12ae3210
JB
229## [2.4.7] - 2023-04-11
230
7171d33f
JB
231### Added
232
233- Add worker tasks queue options to pool options.
234
e8bd29ce
JB
235### Fixed
236
237- Fix missing documentation.
238
42c7bc10
JB
239## [2.4.6] - 2023-04-10
240
681196cc
JB
241### Fixed
242
243- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 244- Properly count worker executing tasks with tasks queueing enabled.
681196cc 245
54d360e3
JB
246## [2.4.5] - 2023-04-09
247
3fafb1b2
JB
248### Added
249
9e775f96
JB
250- Use monotonic high resolution timer for worker tasks runtime.
251- Add worker tasks median runtime to statistics.
ff733df7 252- Add worker tasks queue (experimental).
3fafb1b2 253
92fa3eb6
JB
254## [2.4.4] - 2023-04-07
255
aee46736
JB
256### Added
257
258- Add `PoolEvents` enumeration and `PoolEvent` type.
259
36b5e78f
JB
260### Fixed
261
ff0c2b3e 262- Destroy worker only on alive check.
36b5e78f 263
9fb0f324
JB
264## [2.4.3] - 2023-04-07
265
28cf3617
JB
266### Fixed
267
268- Fix typedoc generation with inheritance.
269
848f0f27
JB
270## [2.4.2] - 2023-04-06
271
164d950a
JB
272### Added
273
274- Add `full` event to dynamic pool.
32417142 275- Keep worker choice strategy in memory for conditional reuse.
164d950a 276
78ab2555
JB
277### Fixed
278
279- Fix possible negative worker key at worker removal in worker choice strategies.
280
79aafe9f
JB
281## [2.4.1] - 2023-04-05
282
9cd39dd4
JB
283### Changed
284
285- Optimize worker choice strategy for dynamic pool.
286
965415bb
JB
287### Fixed
288
289- Ensure dynamic pool does not alter worker choice strategy expected behavior.
290
d8b60b1c
JB
291## [2.4.0] - 2023-04-04
292
c6bd2650
JB
293### Added
294
295- Add `LESS_BUSY` worker choice strategy.
296
297### Changed
298
299- Optimize worker storage in pool.
300- Optimize worker alive status check.
301- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
302- Optimize `LESS_USED` worker choice strategy.
303- Update benchmarks versus external threads pools.
304- Optimize tasks usage statistics requirements for worker choice strategy.
305
306### Fixed
307
308- Ensure trimmable characters are checked at pool initialization.
309- Fix message id integer overflow.
310- Fix pool worker removal in worker choice strategy internals.
311- Fix package publication with pnpm.
312
d0a3f018
JB
313## [2.4.0-3] - 2023-04-04
314
b2ede285
JB
315### Added
316
317- Add `LESS_BUSY` worker choice strategy.
318
319### Changed
320
321- Optimize worker storage in pool.
322- Optimize worker alive status check.
323- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
324- Optimize `LESS_USED` worker choice strategy.
325- Update benchmarks versus external threads pools.
326
327### Fixed
328
329- Ensure trimmable characters are checked at pool initialization.
330- Fix message id integer overflow.
331- Fix pool worker removal in worker choice strategy internals.
332- Fix package publication with pnpm.
333
a015ea40
JB
334## [2.4.0-2] - 2023-04-03
335
698f4bbc
JB
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- Fix package publication with pnpm.
353
8fe15920
JB
354## [2.4.0-1] - 2023-04-03
355
5b301c28
JB
356### Added
357
358- Add `LESS_BUSY` worker choice strategy.
359
360### Changed
361
362- Optimize worker storage in pool.
363- Optimize worker alive status check.
364- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
365- Optimize `LESS_USED` worker choice strategy.
366
367### Fixed
368
369- Ensure trimmable characters are checked at pool initialization.
370- Fix message id integer overflow.
371- Fix pool worker removal in worker choice strategy internals.
372
2fb9ca9c
JB
373## [2.4.0-0] - 2023-04-03
374
168c526f
JB
375### Added
376
377- Add `LESS_BUSY` worker choice strategy.
378
1d71a908
JB
379### Changed
380
ffcbbad8 381- Optimize worker storage in pool.
1d71a908 382- Optimize worker alive status check.
65a60b3b 383- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 384- Optimize `LESS_USED` worker choice strategy.
1d71a908 385
ffcbbad8
JB
386### Fixed
387
388- Ensure trimmable characters are checked at pool initialization.
b4e75778 389- Fix message id integer overflow.
97a2abc3 390- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 391
08372738
JB
392## [2.3.10] - 2023-03-18
393
710826bc
JB
394### Fixed
395
396- Fix `exports` syntax for ESM and CommonJS.
397
398### Changed
399
400- Permit SemVer pre-release publication.
76e5ac6f 401
e4796ecd
JB
402## [2.3.10-2] - 2023-03-18
403
6abad580
JB
404### Fixed
405
406- Fix `exports` syntax for ESM and CommonJS.
407
a2ee98cc
JB
408## [2.3.10-1] - 2023-03-18
409
7e060cee
JB
410### Changed
411
90483887 412- Permit SemVer pre-release publication.
7e060cee 413
c81bfafb
JB
414## [2.3.10-0] - 2023-03-18
415
fe18768d
JB
416### Fixed
417
418- Fix `exports` syntax for ESM and CommonJS.
419
d7b78217
JB
420## [2.3.9] - 2023-03-18
421
ed6dd37f
JB
422### Changed
423
424- Introduce ESM module support along with CommonJS one.
425
426### Fixed
427
428- Fix brown paper bag bug referencing the same object literal.
429
68e2ad86
JB
430## [2.3.8] - 2023-03-18
431
ca6c7d70
JB
432### Changed
433
434- Switch internal benchmarking code to benny.
fbdedeb9
JB
435- Switch to TypeScript 5.x.x.
436- Switch rollup bundler plugins to core ones.
ed6dd37f 437- Switch to TSDoc syntax.
fbdedeb9 438- Enforce conventional commits.
ca6c7d70 439
d15211d4
JB
440### Fixed
441
442- Fix random integer generator.
fbdedeb9 443- Fix worker choice strategy pool type identification at initialization.
d15211d4 444
995705ea
JB
445## [2.3.7] - 2022-10-23
446
b953022b
JB
447### Changed
448
449- Switch to open collective FOSS project funding platform.
78cea37e
JB
450- Switch to ts-standard linter configuration on TypeScript code.
451
452### Fixed
453
454- Fixed missing async on pool execute method.
455- Fixed typing in TypeScript example.
456- Fixed types in unit tests.
b953022b 457
3b9f6953
JB
458## [2.3.6] - 2022-10-22
459
f80cead4
JB
460### Changed
461
462- Cleanup pool attributes and methods.
463- Refine error types thrown.
464
465### Fixed
466
467- Fix continuous integration build on windows.
468- Fix code coverage reporting by using c8 instead of nyc.
469
efc22107
JB
470## [2.3.5] - 2022-10-21
471
7a6a0a96
JB
472### Changed
473
a05c10de
JB
474- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
475- Optimize tasks usage lookup implementation.
7a6a0a96 476
b4904890
JB
477### Fixed
478
479- Fix missed pool event emitter type export.
480- Fix typedoc documentation generation.
481
a875f8d1
JB
482## [2.3.4] - 2022-10-17
483
73cda448
JB
484### Added
485
486- Fully automate release process with release-it.
487
45a5a54c
JB
488### Changed
489
73cda448 490- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 491- Update benchmarks versus external pools results with latest version.
45a5a54c 492
90ee1b18 493## [2.3.3] - 2022-10-15
1a76932b
JB
494
495### Added
496
497- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
498
90ee1b18 499## [2.3.2] - 2022-10-14
11df3590
JB
500
501### Changed
502
503- Optimize fair share worker selection strategy implementation.
504
505### Fixed
506
507- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
508
90ee1b18 509## [2.3.1] - 2022-10-13
23ff945a
JB
510
511### Added
512
513- Pool worker choice strategies:
514 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
515 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
516
90ee1b18 517## [2.2.2] - 2022-10-09
cb2b6c69
JB
518
519### Fixed
520
521- Fixed `README.md` file.
522
90ee1b18 523## [2.2.1] - 2022-10-08
bdacc2d2 524
bdaf31cd
JB
525### Added
526
527- Dynamic worker choice strategy change at runtime.
bdacc2d2 528
90ee1b18 529## [2.2.0] - 2022-01-05
7e0d447f
JB
530
531### Breaking Changes
532
533- Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
534
90ee1b18 535## [2.1.0] - 2021-08-29
35cf1c03
JB
536
537### Added
538
539- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
540
541### Breaking Changes
542
543- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
544- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
545- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 546- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 547
90ee1b18 548## [2.0.2] - 2021-05-12
14916bf9
JB
549
550### Bug fixes
551
552- Fix `busy` event emission on fixed pool type
553
90ee1b18 554## [2.0.1] - 2021-03-16
7f685093
JB
555
556### Bug fixes
557
558- Check if pool options are properly set.
559- `busy` event is emitted on all pool types.
560
90ee1b18 561## [2.0.0] - 2021-03-01
fa0f5b28 562
f3f833ab 563### Bug fixes
d63d3be3 564
ddbeaffd 565- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 566
fa0f5b28
S
567### Breaking Changes
568
7f685093 569- `FullPool` event is now renamed to `busy`.
1927ee67 570- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 571 _Find more details on our JSDoc._
ddbeaffd 572
1927ee67
APA
573- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
574
ddbeaffd 575- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 576
ec2ccfc8
JB
577### Pool options types declaration merge
578
579`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
580
fa0f5b28
S
581#### New `export` strategy
582
583```js
584// Before
777b7824 585const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 586// After
777b7824 587const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
588```
589
590But you should always prefer just using
591
592```js
777b7824 593const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
594```
595
d3c8a1a8
S
596#### New type definitions for input data and response
597
6677a3d3 598For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
d3c8a1a8
S
599_This is not a limitation by poolifier but NodeJS._
600
3a4b605f 601#### Public property replacements
5c5a1fb7 602
3a4b605f 603`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 604
280c2a77 605#### Internal (protected) properties and methods renaming
fa0f5b28 606
280c2a77
S
607These properties are not intended for end users
608
609- `id` => `nextMessageId`
610
611These methods are not intended for end users
fa0f5b28
S
612
613- `_chooseWorker` => `chooseWorker`
280c2a77 614- `_newWorker` => `createWorker`
fa0f5b28
S
615- `_execute` => `internalExecute`
616- `_chooseWorker` => `chooseWorker`
617- `_checkAlive` => `checkAlive`
618- `_run` => `run`
619- `_runAsync` => `runAsync`
620
90ee1b18 621## [1.1.0] - 2020-05-21
0312f71a
APA
622
623### Added
624
625- ThreadWorker support async functions as option
cf9aa6c3 626- Various external library patches
0312f71a 627
90ee1b18 628## [1.0.0] - 2020-01-24
522eea03 629
630### Added
631
632- FixedThreadPool implementation
633- DynamicThreadPool implementation
0312f71a 634- WorkerThread implementation to improve developer experience