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