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