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