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