docs: generate documentation
[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
597775b2
JB
10## [3.0.4] - 2023-10-20
11
03fb313b
JB
12### Changed
13
49d60f11 14- Switch to Bencher for benchmarking: [https://bencher.dev/perf/poolifier](https://bencher.dev/perf/poolifier).
03fb313b
JB
15- Use builtin retry mechanism in worker choice strategies instead of custom one.
16
6c285176
JB
17## [3.0.3] - 2023-10-19
18
9761e404
JB
19### Fixed
20
21- Avoid null exception at sending message to worker.
535fd8d5 22- Avoid null exception at checking worker node readiness.
9761e404 23
358dc40f
JB
24## [3.0.2] - 2023-10-17
25
97256a85
JB
26### Fixed
27
c3c2b35e 28- Fix race condition at dynamic worker node task assignment and scheduled removal. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468) and [#1496](https://github.com/poolifier/poolifier/issues/1496).
97256a85 29
7a570743
JB
30## [3.0.1] - 2023-10-16
31
dbfa7948
JB
32### Fixed
33
fc84edac 34- Workaround possible race condition at work nodes array element removal and querying. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468).
dbfa7948 35
365f13e4
JB
36### Changed
37
c3c2b35e 38- Switch the worker node eventing code to `EventTarget` API.
365f13e4 39
003b3275
JB
40## [3.0.0] - 2023-10-08
41
277c49bf
JB
42### Changed
43
44- Remove Node.js 16.x.x (EOL) support.
45
3c9e911a
JB
46## [2.7.5] - 2023-10-03
47
f80125ca
JB
48### Changed
49
50- Use `EventEmitterAsyncResource` type from `@types/node` for pool event emitter. TypeScript users will need to update to latest `@types/node` version.
51
3466e757
JB
52## [2.7.4] - 2023-09-25
53
67b26ae2
JB
54### Fixed
55
56- Fix source maps (bundler issue).
57
eeb1f961
JB
58## [2.7.3] - 2023-09-24
59
b5604034
JB
60### Changed
61
62- Convert pool event emitter to event emitter async resource.
63
f2df6dc8
JB
64## [2.7.2] - 2023-09-23
65
116ca64b
JB
66### Changed
67
68- Add source maps to npm package to ease debugging.
69
1e319a70
JB
70### Added
71
72- Continuous benchmarking versus other worker pools: [https://poolifier.github.io/benchmark](https://poolifier.github.io/benchmark).
73
aab2819b
JB
74## [2.7.1] - 2023-09-20
75
ae036c3e
JB
76### Fixed
77
78- Ensure worker message listener used one time are removed after usage.
79
15d7c489
JB
80## [2.7.0] - 2023-09-19
81
160557ff
JB
82### Fixed
83
84- Fix task stealing related tasks queue options handling at runtime.
85
c3284191
JB
86### Changed
87
88- Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
89
90### Added
91
35808931 92- Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API: [PR #1148](https://github.com/poolifier/poolifier/pull/1148).
c20084b6 93- Stricter worker constructor arguments validation.
c3284191 94
04054352
JB
95## [2.6.45] - 2023-09-17
96
093af25b
JB
97### Changed
98
99- Disable publication on GitHub packages registry on release until authentication issue is fixed.
09d9af02
JB
100
101### Added
102
ce0ab2d7 103- Add `startWorkers` to pool options to whether start the minimum number of workers at pool initialization or not.
cde5b54e 104- Add `start()` method to pool API to start the minimum number of workers.
af98b972 105- Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task stealing or not and whether enable tasks stealing under back pressure or not.
1e319a70 106- Continuous internal benchmarking: [https://poolifier.github.io/benchmark-results/dev/bench](https://poolifier.github.io/benchmark-results/dev/bench).
f1c674cd 107
bce9ffdf
JB
108## [2.6.44] - 2023-09-08
109
4cb259d3
JB
110### Fixed
111
112- Use a dedicated PAT to publish on GitHub packages registry.
113
114### Added
115
116- Publish on GitHub packages registry on release.
117
118### Changed
119
120- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
121
fbda1e26
JB
122## [2.6.43] - 2023-09-08
123
15fc82ba
JB
124### Added
125
4cb259d3 126- Publish on GitHub packages registry on release.
15fc82ba
JB
127
128### Changed
129
4cb259d3 130- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
15fc82ba 131
b47306a3
JB
132## [2.6.42] - 2023-09-06
133
ad11ca81
JB
134### Changed
135
136- Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ...
137
1b37751d
JB
138## [2.6.41] - 2023-09-03
139
f3a91bac
JB
140### Changed
141
142- Optimize worker choice strategies implementation.
143
7790a494
JB
144## [2.6.40] - 2023-09-01
145
6fe200b4
JB
146### Fixed
147
148- Do not pre-choose in WRR worker choice strategy to avoid bias.
68738842 149- Avoid array out of bound in worker choice strategies after worker node removal.
6fe200b4 150
766c7f84
JB
151## [2.6.39] - 2023-08-30
152
edf8ce4e
JB
153### Fixed
154
4cb259d3 155- Fix race condition in worker choice strategies at worker node info querying while not yet initialized.
edf8ce4e 156
904a5689
JB
157## [2.6.38] - 2023-08-30
158
b40c4b06
JB
159### Added
160
161- Bundle typescript types declaration into one file.
162
619f403b
JB
163### Changed
164
165- Improve interleaved weighted round robin worker choice strategy implementation.
166
5a24d71c
JB
167## [2.6.37] - 2023-08-28
168
bdb9d712
JB
169### Fixed
170
171- Ensure unused worker usage statistics are deleted at runtime.
172
8c0b113f
JB
173### Changed
174
175- Rename worker choice strategy options `choiceRetries` to `retries`.
574c5c8d 176- Avoid unnecessary branching in worker choice strategies.
8c0b113f 177
ba821940
JB
178## [2.6.36] - 2023-08-27
179
9d2d0da1
JB
180### Fixed
181
182- Fix pool `execute()` arguments check.
183
1f0766e7
JB
184### Changed
185
186- Make continuous tasks stealing algorithm less aggressive.
8780236f 187- Fine tune tasks stealing algorithm under back pressure.
1f0766e7 188
ffd2c1ff
JB
189## [2.6.35] - 2023-08-25
190
dc021bcc
JB
191### Fixed
192
193- Don't account worker usage statistics for tasks that have failed.
3baa0837 194- Fix pool information runtime and wait time median computation.
dc021bcc
JB
195
196### Changed
197
198- Update simple moving average implementation to use a circular buffer.
199- Update simple moving median implementation to use a circular buffer.
68cbdc84
JB
200- Account for stolen tasks in worker usage statistics and pool information.
201
202### Added
203
204- Continuous tasks stealing algorithm.
dc021bcc 205
c58bc2a1
JB
206## [2.6.34] - 2023-08-24
207
0bc68267
JB
208### Fixes
209
210- Avoid cascading tasks stealing under back pressure.
211
212### Changed
213
214- Add fastpath to queued tasks rescheduling.
215
39fb7ad0
JB
216## [2.6.33] - 2023-08-24
217
dd951876
JB
218### Fixed
219
220- Fix queued tasks rescheduling.
221
ff3f866a
JB
222### Changed
223
224- Rename tasks queue options `queueMaxSize` to `size`.
225
a6b3272b 226### Added
dd951876 227
a6b3272b 228- Task stealing scheduling algorithm if tasks queueing is enabled.
dd951876 229
c55c9b5d
JB
230## [2.6.32] - 2023-08-23
231
15b176e0
JB
232### Fixed
233
234- Ensure no task can be executed when the pool is destroyed.
235
20c6f652
JB
236### Added
237
238- Add `queueMaxSize` option to tasks queue options.
574b351d 239- Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing.
72695f86 240- Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled.
20c6f652 241
e560a9f2
JB
242## [2.6.31] - 2023-08-20
243
b1aae695
JB
244### Fixed
245
3e8611a8 246- Fix worker choice strategy retries mechanism in some edge cases.
b1aae695 247
94407def
JB
248### Changed
249
e695d66f 250- Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage.
a71b05bc 251- Remove the experimental status of the `LEAST_ELU` worker choice strategy.
94407def 252
962b9863
JB
253## [2.6.30] - 2023-08-19
254
33e6bb4c
JB
255### Fixed
256
257- Ensure pool event `backPressure` is emitted.
258- Ensure pool event `full` is emitted only once.
8735b4e5 259- Ensure worker node cannot be instantiated without proper arguments.
33e6bb4c 260
8cc4ea81
JB
261## [2.6.29] - 2023-08-18
262
6169563b
JB
263### Fixed
264
265- Fix race condition between ready and task functions worker message handling at startup.
5dd4043c 266- Fix duplicate task function worker usage statistics computation per task function.
db0e38ee 267- Update task function worker usage statistics if and only if there's at least two different task functions.
5bb5be17 268- Fix race condition at task function worker usage executing task computation leading to negative value.
6169563b 269
8990357d
JB
270### Added
271
445264e8 272- Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2).
8990357d
JB
273- Use back pressure detection in worker choice strategies.
274- Add worker choice strategies retries mechanism if no worker is eligible.
275
21157987
JB
276## [2.6.28] - 2023-08-16
277
f05ed93c
JB
278### Fixed
279
280- Ensure pool workers are properly initialized.
281
12d67776
JB
282### Added
283
284- HTTP server pool examples: express-cluster, express-hybrid.
285
d18fccb1
JB
286### Changed
287
288- Remove now useless branching in worker hot code path.
289
741cdb34
JB
290## [2.6.27] - 2023-08-15
291
50e7f498
JB
292### Fixed
293
294- Add `KillHandler` type definition to exported types.
295
ef3891a3
JB
296### Added
297
298- Add `destroy` event to pool API.
299
e9dc6efa
JB
300## [2.6.26] - 2023-08-15
301
2b099bf7
JB
302### Added
303
304- Add kill handler to worker options allowing to execute custom code when worker is killed.
ef3891a3 305- Add `listTaskFunctions()` method to pool API.
1f4553c6 306- SMTP client pool example: nodemailer.
2b099bf7 307
5b726f72
JB
308## [2.6.25] - 2023-08-13
309
72855e92
JB
310### Added
311
3b311539 312- HTTP server pool examples: fastify-cluster, fastify-hybrid.
02999424 313- WebSocket server pool examples: ws-cluster, ws-hybrid.
72855e92 314
7aadd6e5
JB
315## [2.6.24] - 2023-08-12
316
7d91a8cd
JB
317### Added
318
319- Add array of transferable objects to the `execute()` method arguments.
02999424 320- WebSocket server pool examples: ws-worker_threads.
7d91a8cd 321
6b4263b4
JB
322## [2.6.23] - 2023-08-11
323
3d76750a 324### Fixed
8e0af894 325
3d76750a 326- Fix pool busyness semantic when tasks queueing is enabled: the pool is busy when the number of executing tasks on each worker has reached the maximum tasks concurrency per worker.
9606b474 327
3d76750a
JB
328### Added
329
330- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
02999424 331- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
3d76750a
JB
332
333## [2.6.22] - 2023-08-10
9606b474 334
3d76750a 335### Fixed
9606b474
JB
336
337- Add missing `types` field to package.json `exports`.
338
3d76750a
JB
339### Changed
340
341- Structure markdown documentation (PR #811).
342
d9647bdd
JB
343## [2.6.21] - 2023-08-03
344
2111ec12
JB
345### Changed
346
347- Improve code documentation.
348- Code refactoring and cleanup for better maintainability and readability.
349
5c30b9d9
JB
350## [2.6.20] - 2023-07-21
351
10ecf8fd
JB
352### Fixed
353
354- Fix queued tasks redistribution on error task execution starvation.
a1763c54 355- Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
10ecf8fd 356
aa9eede8
JB
357### Changed
358
7c89e6a4 359- Drastically reduce lookups by worker in the worker nodes.
aa9eede8 360
62485908
JB
361## [2.6.19] - 2023-07-20
362
2e2ef9c3
JB
363### Added
364
365- Dedicated internal communication channel for worker_threads pools.
366
8f4c9491
JB
367## [2.6.18] - 2023-07-19
368
8660b972
JB
369### Changed
370
371- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
372
206a3519
JB
373## [2.6.17] - 2023-07-16
374
b4899fae
JB
375### Added
376
1a3e01ba 377- Add `listTaskFunctions()` method to worker API.
b4899fae 378
58a06a6c
JB
379## [2.6.16] - 2023-07-12
380
2a69b8c5
JB
381### Fixed
382
80520ca4 383- Fix pool startup detection.
2a69b8c5
JB
384- Fix worker task functions handling.
385
b5900b02
JB
386## [2.6.15] - 2023-07-11
387
19dbc45b
JB
388### Added
389
390- Take into account worker node readiness in worker choice strategies.
391
4a0db581
JB
392## [2.6.14] - 2023-07-10
393
87e44747
JB
394### Fixed
395
396- Fix task function statistics tracking.
397
0265272f
JB
398## [2.6.13] - 2023-07-10
399
968a2e8c
JB
400### Added
401
402- Add per task function statistics tracking.
782299f8 403- Add public methods to manipulate the worker task functions at runtime.
968a2e8c 404
44c8c00f
JB
405## [2.6.12] - 2023-07-09
406
aa4bf4b2
JB
407### Fixed
408
409- Workaround import issue with `node:os` module in node 16.x.x.
410
b7cfced1
JB
411## [2.6.11] - 2023-07-09
412
d5024c00
JB
413### Fixed
414
415- Fix pool readiness semantic.
416
f313a208
JB
417## [2.6.10] - 2023-07-08
418
2431bdb4
JB
419### Fixed
420
421- Ensure workers are not recreated on error at pool startup.
422
423### Added
424
425- Add `ready` and `strategy` fields to pool information.
426- 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 427- Add dynamic pool sizing checks.
2431bdb4 428
369d0a51
JB
429## [2.6.9] - 2023-07-07
430
2845f2a5
JB
431### Fixed
432
433- Recreate the right worker type on uncaught exception.
434
435### Added
436
437- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 438- Add `runTime` and `waitTime` to pool information.
75d3401a 439- Check worker inactive time only on dynamic worker.
2845f2a5 440
fc97d613
JB
441## [2.6.8] - 2023-07-03
442
92b1feaa
JB
443### Fixed
444
445- Brown paper bag release to fix version handling in pool information.
446
52d54060
JB
447## [2.6.7] - 2023-07-03
448
5bc91f3e
JB
449### Fixed
450
451- Ensure worker queued tasks at error are reassigned to other pool workers.
452
afe0d5bf
JB
453### Added
454
455- Add pool `utilization` ratio to pool information.
23ccf9d7 456- Add `version` to pool information.
e5b3047d 457- Add worker information to worker nodes.
afe0d5bf 458
f42c583f
JB
459## [2.6.6] - 2023-07-01
460
6961ca9a
JB
461### Added
462
d5e3c4ff 463- Add safe helper `availableParallelism()` to help sizing the pool.
6961ca9a 464
3749facb
JB
465### Fixed
466
467- Ensure message handler is only registered in worker.
468
6fed2513
JB
469## [2.6.5] - 2023-06-27
470
c72f6987
JB
471### Known issues
472
70726c28 473- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
474
475### Fixed
476
477- Artificial version bump to 2.6.5 to workaround publication issue.
d5e3c4ff 478- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
c72f6987
JB
479- Ensure pool event is emitted before task error promise rejection.
480- Fix queued tasks count computation.
481
482### Removed
483
2fbe1783 484- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
c72f6987 485
6426631b
JB
486## [2.6.4] - 2023-06-27
487
941f9a7c
JB
488### Known issues
489
70726c28 490- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 491
2c039e43
JB
492### Fixed
493
d5e3c4ff 494- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
2c039e43 495- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 496- Fix queued tasks count computation.
2c039e43 497
941f9a7c
JB
498### Removed
499
2fbe1783 500- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
941f9a7c 501
bc1b0765
JB
502## [2.6.3] - 2023-06-19
503
a6a2dc4c
JB
504### Fixed
505
506- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 507- Update strategies internals after statistics computation.
a6a2dc4c 508
7b56f532
JB
509### Changed
510
511- Optimize O(1) queue implementation.
512
b628596c
JB
513## [2.6.2] - 2023-06-12
514
a9e89d00
JB
515### Fixed
516
517- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
518
4368a898
JB
519## [2.6.1] - 2023-06-10
520
931d43e2
JB
521### Added
522
13ab5b87 523- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
931d43e2 524
f1c06930
JB
525### Fixed
526
527- Fix average statistics computation: ensure failed tasks are not accounted.
528
16671b07
JB
529## [2.6.0] - 2023-06-09
530
a1347286
JB
531### Added
532
5af9c0f7 533- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 534- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 535
1c6fe997
JB
536### Changed
537
538- Refactor pool worker node usage internals.
477f48e7 539- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 540- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
541
542### Fixed
543
544- Fix wait time accounting.
545- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
546- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
547
aa07d6ee
JB
548## [2.5.4] - 2023-06-07
549
b6b32453
JB
550### Added
551
552- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
553
554### Changed
555
556- Compute statistics at the worker level only if needed.
2fbe1783 557- Add `worker_threads` options to thread pool options.
b6b32453 558
272d4d8f
JB
559### Fixed
560
561- Make the `LEAST_BUSY` strategy only relies on task runtime.
562
ed47fb3d
JB
563## [2.5.3] - 2023-06-04
564
89a4abfd
JB
565### Changed
566
567- Refine pool information content.
b4213b7f 568- Limit pool internals public exposure.
89a4abfd 569
8a9febf5
JB
570## [2.5.2] - 2023-06-02
571
91ee39ed
JB
572### Added
573
574- Add `taskError` pool event for task execution error.
6b27d407 575- Add pool information `info` property to pool.
91ee39ed
JB
576- Emit pool information on `busy` and `full` pool events.
577
8babb151
JB
578## [2.5.1] - 2023-06-01
579
0e05c4dc
JB
580### Added
581
1f68cede 582- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 583- Add `error` pool event for uncaught worker error.
0e05c4dc 584
a8766181
JB
585## [2.5.0] - 2023-05-31
586
e4543b14
JB
587### Added
588
589- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 590- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 591- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
592
593### Changed
594
595- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
596
570efb11
JB
597## [2.4.14] - 2023-05-09
598
b0f28bad
JB
599### Fixed
600
601- Ensure no undefined task runtime can land in the tasks history.
602- Fix median computation implementation once again.
603
110b6d13
JB
604### Added
605
606- Unit tests for median and queue implementations.
607
72584880
JB
608## [2.4.13] - 2023-05-08
609
b0d6ed8f
JB
610### Fixed
611
e3058615 612- Fix worker choice strategy options validation.
b0d6ed8f
JB
613- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
614
06140c32
JB
615## [2.4.12] - 2023-05-06
616
a86b6df1
JB
617### Added
618
619- Support multiple task functions per worker.
08f3f44c 620- Add custom worker weights support to worker choice strategies options.
a86b6df1 621
29ee7e9a
JB
622### Changed
623
624- Use O(1) queue implementation for tasks queueing.
625
0682ba15
JB
626### Fixed
627
628- Fix median computation implementation.
629- Fix fair share worker choice strategy internals update.
630
936d53ec
JB
631## [2.4.11] - 2023-04-23
632
cb70b19d
JB
633### Changed
634
635- Optimize free worker finding in worker choice strategies.
636
15bb637a
JB
637## [2.4.10] - 2023-04-15
638
ef41a6e6
JB
639### Fixed
640
82ea6492 641- Fix typescript type definition for task function: ensure the input data is optional.
ef41a6e6
JB
642- Fix typescript type definition for pool execute(): ensure the input data is optional.
643
181eb2b4
JB
644## [2.4.9] - 2023-04-15
645
a20f0ba5
JB
646### Added
647
648- Add tasks queue enablement runtime setter to pool.
649- Add tasks queue options runtime setter to pool.
650- Add worker choice strategy options runtime setter to pool.
651
652### Changed
653
654- Remove the tasks queuing experimental status.
655
d4aeae5a
JB
656### Fixed
657
82ea6492 658- Fix task function type definition and validation.
2fc5cae3 659- Fix worker choice strategy options handling.
d4aeae5a 660
1d9e7023
JB
661## [2.4.8] - 2023-04-12
662
f9b4bbf8
JB
663### Fixed
664
665- Fix message between main worker and worker type definition for tasks.
666- Fix code documentation.
667
12ae3210
JB
668## [2.4.7] - 2023-04-11
669
7171d33f
JB
670### Added
671
672- Add worker tasks queue options to pool options.
673
e8bd29ce
JB
674### Fixed
675
676- Fix missing documentation.
677
42c7bc10
JB
678## [2.4.6] - 2023-04-10
679
681196cc
JB
680### Fixed
681
682- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 683- Properly count worker executing tasks with tasks queueing enabled.
681196cc 684
54d360e3
JB
685## [2.4.5] - 2023-04-09
686
3fafb1b2
JB
687### Added
688
9e775f96
JB
689- Use monotonic high resolution timer for worker tasks runtime.
690- Add worker tasks median runtime to statistics.
ff733df7 691- Add worker tasks queue (experimental).
3fafb1b2 692
92fa3eb6
JB
693## [2.4.4] - 2023-04-07
694
aee46736
JB
695### Added
696
697- Add `PoolEvents` enumeration and `PoolEvent` type.
698
36b5e78f
JB
699### Fixed
700
ff0c2b3e 701- Destroy worker only on alive check.
36b5e78f 702
9fb0f324
JB
703## [2.4.3] - 2023-04-07
704
28cf3617
JB
705### Fixed
706
707- Fix typedoc generation with inheritance.
708
848f0f27
JB
709## [2.4.2] - 2023-04-06
710
164d950a
JB
711### Added
712
713- Add `full` event to dynamic pool.
32417142 714- Keep worker choice strategy in memory for conditional reuse.
164d950a 715
78ab2555
JB
716### Fixed
717
718- Fix possible negative worker key at worker removal in worker choice strategies.
719
79aafe9f
JB
720## [2.4.1] - 2023-04-05
721
9cd39dd4
JB
722### Changed
723
724- Optimize worker choice strategy for dynamic pool.
725
965415bb
JB
726### Fixed
727
728- Ensure dynamic pool does not alter worker choice strategy expected behavior.
729
d8b60b1c
JB
730## [2.4.0] - 2023-04-04
731
c6bd2650
JB
732### Added
733
734- Add `LESS_BUSY` worker choice strategy.
735
736### Changed
737
738- Optimize worker storage in pool.
739- Optimize worker alive status check.
740- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
741- Optimize `LESS_USED` worker choice strategy.
2a87030e 742- Update benchmark versus external threads pools.
c6bd2650
JB
743- Optimize tasks usage statistics requirements for worker choice strategy.
744
745### Fixed
746
747- Ensure trimmable characters are checked at pool initialization.
748- Fix message id integer overflow.
749- Fix pool worker removal in worker choice strategy internals.
750- Fix package publication with pnpm.
751
d0a3f018
JB
752## [2.4.0-3] - 2023-04-04
753
b2ede285
JB
754### Added
755
756- Add `LESS_BUSY` worker choice strategy.
757
758### Changed
759
760- Optimize worker storage in pool.
761- Optimize worker alive status check.
762- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
763- Optimize `LESS_USED` worker choice strategy.
2a87030e 764- Update benchmark versus external threads pools.
b2ede285
JB
765
766### Fixed
767
768- Ensure trimmable characters are checked at pool initialization.
769- Fix message id integer overflow.
770- Fix pool worker removal in worker choice strategy internals.
771- Fix package publication with pnpm.
772
a015ea40
JB
773## [2.4.0-2] - 2023-04-03
774
698f4bbc
JB
775### Added
776
777- Add `LESS_BUSY` worker choice strategy.
778
779### Changed
780
781- Optimize worker storage in pool.
782- Optimize worker alive status check.
783- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
784- Optimize `LESS_USED` worker choice strategy.
785
786### Fixed
787
788- Ensure trimmable characters are checked at pool initialization.
789- Fix message id integer overflow.
790- Fix pool worker removal in worker choice strategy internals.
791- Fix package publication with pnpm.
792
8fe15920
JB
793## [2.4.0-1] - 2023-04-03
794
5b301c28
JB
795### Added
796
797- Add `LESS_BUSY` worker choice strategy.
798
799### Changed
800
801- Optimize worker storage in pool.
802- Optimize worker alive status check.
803- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
804- Optimize `LESS_USED` worker choice strategy.
805
806### Fixed
807
808- Ensure trimmable characters are checked at pool initialization.
809- Fix message id integer overflow.
810- Fix pool worker removal in worker choice strategy internals.
811
2fb9ca9c
JB
812## [2.4.0-0] - 2023-04-03
813
168c526f
JB
814### Added
815
816- Add `LESS_BUSY` worker choice strategy.
817
1d71a908
JB
818### Changed
819
ffcbbad8 820- Optimize worker storage in pool.
1d71a908 821- Optimize worker alive status check.
65a60b3b 822- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 823- Optimize `LESS_USED` worker choice strategy.
1d71a908 824
ffcbbad8
JB
825### Fixed
826
827- Ensure trimmable characters are checked at pool initialization.
b4e75778 828- Fix message id integer overflow.
97a2abc3 829- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 830
08372738
JB
831## [2.3.10] - 2023-03-18
832
710826bc
JB
833### Fixed
834
9606b474 835- Fix package.json `exports` syntax for ESM and CommonJS.
710826bc
JB
836
837### Changed
838
839- Permit SemVer pre-release publication.
76e5ac6f 840
e4796ecd
JB
841## [2.3.10-2] - 2023-03-18
842
6abad580
JB
843### Fixed
844
9606b474 845- Fix package.json `exports` syntax for ESM and CommonJS.
6abad580 846
a2ee98cc
JB
847## [2.3.10-1] - 2023-03-18
848
7e060cee
JB
849### Changed
850
90483887 851- Permit SemVer pre-release publication.
7e060cee 852
c81bfafb
JB
853## [2.3.10-0] - 2023-03-18
854
fe18768d
JB
855### Fixed
856
9606b474 857- Fix package.json `exports` syntax for ESM and CommonJS.
fe18768d 858
d7b78217
JB
859## [2.3.9] - 2023-03-18
860
ed6dd37f
JB
861### Changed
862
863- Introduce ESM module support along with CommonJS one.
864
865### Fixed
866
867- Fix brown paper bag bug referencing the same object literal.
868
68e2ad86
JB
869## [2.3.8] - 2023-03-18
870
ca6c7d70
JB
871### Changed
872
873- Switch internal benchmarking code to benny.
fbdedeb9
JB
874- Switch to TypeScript 5.x.x.
875- Switch rollup bundler plugins to core ones.
ed6dd37f 876- Switch to TSDoc syntax.
fbdedeb9 877- Enforce conventional commits.
ca6c7d70 878
d15211d4
JB
879### Fixed
880
881- Fix random integer generator.
fbdedeb9 882- Fix worker choice strategy pool type identification at initialization.
d15211d4 883
995705ea
JB
884## [2.3.7] - 2022-10-23
885
b953022b
JB
886### Changed
887
888- Switch to open collective FOSS project funding platform.
78cea37e
JB
889- Switch to ts-standard linter configuration on TypeScript code.
890
891### Fixed
892
893- Fixed missing async on pool execute method.
894- Fixed typing in TypeScript example.
895- Fixed types in unit tests.
b953022b 896
3b9f6953
JB
897## [2.3.6] - 2022-10-22
898
f80cead4
JB
899### Changed
900
901- Cleanup pool attributes and methods.
902- Refine error types thrown.
903
904### Fixed
905
906- Fix continuous integration build on windows.
907- Fix code coverage reporting by using c8 instead of nyc.
908
efc22107
JB
909## [2.3.5] - 2022-10-21
910
7a6a0a96
JB
911### Changed
912
a05c10de
JB
913- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
914- Optimize tasks usage lookup implementation.
7a6a0a96 915
b4904890
JB
916### Fixed
917
918- Fix missed pool event emitter type export.
919- Fix typedoc documentation generation.
920
a875f8d1
JB
921## [2.3.4] - 2022-10-17
922
73cda448
JB
923### Added
924
925- Fully automate release process with release-it.
926
45a5a54c
JB
927### Changed
928
73cda448 929- Optimize fair share task scheduling algorithm implementation.
2a87030e 930- Update benchmark versus external pools results with latest version.
45a5a54c 931
90ee1b18 932## [2.3.3] - 2022-10-15
1a76932b
JB
933
934### Added
935
936- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
937
90ee1b18 938## [2.3.2] - 2022-10-14
11df3590
JB
939
940### Changed
941
942- Optimize fair share worker selection strategy implementation.
943
944### Fixed
945
946- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
947
90ee1b18 948## [2.3.1] - 2022-10-13
23ff945a
JB
949
950### Added
951
952- Pool worker choice strategies:
953 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
954 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
955
90ee1b18 956## [2.2.2] - 2022-10-09
cb2b6c69
JB
957
958### Fixed
959
960- Fixed `README.md` file.
961
90ee1b18 962## [2.2.1] - 2022-10-08
bdacc2d2 963
bdaf31cd
JB
964### Added
965
966- Dynamic worker choice strategy change at runtime.
bdacc2d2 967
90ee1b18 968## [2.2.0] - 2022-01-05
7e0d447f
JB
969
970### Breaking Changes
971
9606b474 972- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
7e0d447f 973
90ee1b18 974## [2.1.0] - 2021-08-29
35cf1c03
JB
975
976### Added
977
978- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
979
980### Breaking Changes
981
982- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
983- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
984- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 985- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 986
90ee1b18 987## [2.0.2] - 2021-05-12
14916bf9
JB
988
989### Bug fixes
990
991- Fix `busy` event emission on fixed pool type
992
90ee1b18 993## [2.0.1] - 2021-03-16
7f685093
JB
994
995### Bug fixes
996
997- Check if pool options are properly set.
998- `busy` event is emitted on all pool types.
999
90ee1b18 1000## [2.0.0] - 2021-03-01
fa0f5b28 1001
f3f833ab 1002### Bug fixes
d63d3be3 1003
ddbeaffd 1004- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 1005
fa0f5b28
S
1006### Breaking Changes
1007
7f685093 1008- `FullPool` event is now renamed to `busy`.
1927ee67 1009- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 1010 _Find more details on our JSDoc._
ddbeaffd 1011
1927ee67
APA
1012- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
1013
ddbeaffd 1014- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 1015
ec2ccfc8
JB
1016### Pool options types declaration merge
1017
1018`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
1019
fa0f5b28
S
1020#### New `export` strategy
1021
1022```js
1023// Before
0eee77cb 1024const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 1025// After
0eee77cb 1026const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
1027```
1028
1029But you should always prefer just using
1030
1031```js
0eee77cb 1032const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
1033```
1034
d3c8a1a8
S
1035#### New type definitions for input data and response
1036
6677a3d3 1037For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
9606b474 1038_This is not a limitation by poolifier but Node.js._
d3c8a1a8 1039
3a4b605f 1040#### Public property replacements
5c5a1fb7 1041
3a4b605f 1042`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 1043
280c2a77 1044#### Internal (protected) properties and methods renaming
fa0f5b28 1045
280c2a77
S
1046These properties are not intended for end users
1047
1048- `id` => `nextMessageId`
1049
1050These methods are not intended for end users
fa0f5b28
S
1051
1052- `_chooseWorker` => `chooseWorker`
280c2a77 1053- `_newWorker` => `createWorker`
fa0f5b28
S
1054- `_execute` => `internalExecute`
1055- `_chooseWorker` => `chooseWorker`
1056- `_checkAlive` => `checkAlive`
1057- `_run` => `run`
1058- `_runAsync` => `runAsync`
1059
90ee1b18 1060## [1.1.0] - 2020-05-21
0312f71a
APA
1061
1062### Added
1063
1064- ThreadWorker support async functions as option
cf9aa6c3 1065- Various external library patches
0312f71a 1066
90ee1b18 1067## [1.0.0] - 2020-01-24
522eea03 1068
1069### Added
1070
1071- FixedThreadPool implementation
1072- DynamicThreadPool implementation
0312f71a 1073- WorkerThread implementation to improve developer experience