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