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