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