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