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