build: refine prettier configuration
[poolifier.git] / CHANGELOG.md
... / ...
CommitLineData
1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8## [Unreleased]
9
10### Added
11
12- Add kill handler to worker options allowing to execute custom code when worker is killed.
13- Add listTaskFunctions() method to pool API.
14- SMTP server pool example: nodemailer.
15
16## [2.6.25] - 2023-08-13
17
18### Added
19
20- HTTP server pool examples: fastify-cluster, fastify-hybrid.
21- WebSocket server pool examples: ws-cluster, ws-hybrid.
22
23## [2.6.24] - 2023-08-12
24
25### Added
26
27- Add array of transferable objects to the `execute()` method arguments.
28- WebSocket server pool examples: ws-worker_threads.
29
30## [2.6.23] - 2023-08-11
31
32### Fixed
33
34- 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.
35
36### Added
37
38- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
39- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
40
41## [2.6.22] - 2023-08-10
42
43### Fixed
44
45- Add missing `types` field to package.json `exports`.
46
47### Changed
48
49- Structure markdown documentation (PR #811).
50
51## [2.6.21] - 2023-08-03
52
53### Changed
54
55- Improve code documentation.
56- Code refactoring and cleanup for better maintainability and readability.
57
58## [2.6.20] - 2023-07-21
59
60### Fixed
61
62- Fix queued tasks redistribution on error task execution starvation.
63- Ensure task queueing per worker condition is untangled from the pool busyness semantic.
64
65### Changed
66
67- Drastically reduce lookups by worker in the worker nodes.
68
69## [2.6.19] - 2023-07-20
70
71### Added
72
73- Dedicated internal communication channel for worker_threads pools.
74
75## [2.6.18] - 2023-07-19
76
77### Changed
78
79- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
80
81## [2.6.17] - 2023-07-16
82
83### Added
84
85- Add `listTaskFunctions()` method to worker API.
86
87## [2.6.16] - 2023-07-12
88
89### Fixed
90
91- Fix pool startup detection.
92- Fix worker task functions handling.
93
94## [2.6.15] - 2023-07-11
95
96### Added
97
98- Take into account worker node readiness in worker choice strategies.
99
100## [2.6.14] - 2023-07-10
101
102### Fixed
103
104- Fix task function statistics tracking.
105
106## [2.6.13] - 2023-07-10
107
108### Added
109
110- Add per task function statistics tracking.
111- Add public methods to manipulate the worker task functions at runtime.
112
113## [2.6.12] - 2023-07-09
114
115### Fixed
116
117- Workaround import issue with `node:os` module in node 16.x.x.
118
119## [2.6.11] - 2023-07-09
120
121### Fixed
122
123- Fix pool readiness semantic.
124
125## [2.6.10] - 2023-07-08
126
127### Fixed
128
129- Ensure workers are not recreated on error at pool startup.
130
131### Added
132
133- Add `ready` and `strategy` fields to pool information.
134- Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
135- Add dynamic pool sizing checks.
136
137## [2.6.9] - 2023-07-07
138
139### Fixed
140
141- Recreate the right worker type on uncaught exception.
142
143### Added
144
145- Add minimum and maximum to internal measurement statistics.
146- Add `runTime` and `waitTime` to pool information.
147- Check worker inactive time only on dynamic worker.
148
149## [2.6.8] - 2023-07-03
150
151### Fixed
152
153- Brown paper bag release to fix version handling in pool information.
154
155## [2.6.7] - 2023-07-03
156
157### Fixed
158
159- Ensure worker queued tasks at error are reassigned to other pool workers.
160
161### Added
162
163- Add pool `utilization` ratio to pool information.
164- Add `version` to pool information.
165- Add worker information to worker nodes.
166
167## [2.6.6] - 2023-07-01
168
169### Added
170
171- Add safe helper `availableParallelism` to help sizing the pool.
172
173### Fixed
174
175- Ensure message handler is only registered in worker.
176
177## [2.6.5] - 2023-06-27
178
179### Known issues
180
181- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
182
183### Fixed
184
185- Artificial version bump to 2.6.5 to workaround publication issue.
186- Ensure cluster pool destroy() gracefully shutdowns worker's server.
187- Ensure pool event is emitted before task error promise rejection.
188- Fix queued tasks count computation.
189
190### Removed
191
192- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
193
194## [2.6.4] - 2023-06-27
195
196### Known issues
197
198- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
199
200### Fixed
201
202- Ensure cluster pool destroy() gracefully shutdowns worker's server.
203- Ensure pool event is emitted before task error promise rejection.
204- Fix queued tasks count computation.
205
206### Removed
207
208- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
209
210## [2.6.3] - 2023-06-19
211
212### Fixed
213
214- Ensure no tasks are queued when trying to soft kill a dynamic worker.
215- Update strategies internals after statistics computation.
216
217### Changed
218
219- Optimize O(1) queue implementation.
220
221## [2.6.2] - 2023-06-12
222
223### Fixed
224
225- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
226
227## [2.6.1] - 2023-06-10
228
229### Added
230
231- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
232
233### Fixed
234
235- Fix average statistics computation: ensure failed tasks are not accounted.
236
237## [2.6.0] - 2023-06-09
238
239### Added
240
241- Add `LEAST_ELU` worker choice strategy (experimental).
242- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
243
244### Changed
245
246- Refactor pool worker node usage internals.
247- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
248- Breaking change: pool information `info` property object fields have been renamed.
249
250### Fixed
251
252- Fix wait time accounting.
253- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
254- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
255
256## [2.5.4] - 2023-06-07
257
258### Added
259
260- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
261
262### Changed
263
264- Compute statistics at the worker level only if needed.
265- Add `worker_threads` options to thread pool options.
266
267### Fixed
268
269- Make the `LEAST_BUSY` strategy only relies on task runtime.
270
271## [2.5.3] - 2023-06-04
272
273### Changed
274
275- Refine pool information content.
276- Limit pool internals public exposure.
277
278## [2.5.2] - 2023-06-02
279
280### Added
281
282- Add `taskError` pool event for task execution error.
283- Add pool information `info` property to pool.
284- Emit pool information on `busy` and `full` pool events.
285
286## [2.5.1] - 2023-06-01
287
288### Added
289
290- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
291- Add `error` pool event for uncaught worker error.
292
293## [2.5.0] - 2023-05-31
294
295### Added
296
297- Switch pool event emitter to `EventEmitterAsyncResource`.
298- Add tasks wait time accounting in per worker tasks usage.
299- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
300
301### Changed
302
303- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
304
305## [2.4.14] - 2023-05-09
306
307### Fixed
308
309- Ensure no undefined task runtime can land in the tasks history.
310- Fix median computation implementation once again.
311
312### Added
313
314- Unit tests for median and queue implementations.
315
316## [2.4.13] - 2023-05-08
317
318### Fixed
319
320- Fix worker choice strategy options validation.
321- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
322
323## [2.4.12] - 2023-05-06
324
325### Added
326
327- Support multiple task functions per worker.
328- Add custom worker weights support to worker choice strategies options.
329
330### Changed
331
332- Use O(1) queue implementation for tasks queueing.
333
334### Fixed
335
336- Fix median computation implementation.
337- Fix fair share worker choice strategy internals update.
338
339## [2.4.11] - 2023-04-23
340
341### Changed
342
343- Optimize free worker finding in worker choice strategies.
344
345## [2.4.10] - 2023-04-15
346
347### Fixed
348
349- Fix typescript type definition for task function: ensure the input data is optional.
350- Fix typescript type definition for pool execute(): ensure the input data is optional.
351
352## [2.4.9] - 2023-04-15
353
354### Added
355
356- Add tasks queue enablement runtime setter to pool.
357- Add tasks queue options runtime setter to pool.
358- Add worker choice strategy options runtime setter to pool.
359
360### Changed
361
362- Remove the tasks queuing experimental status.
363
364### Fixed
365
366- Fix task function type definition and validation.
367- Fix worker choice strategy options handling.
368
369## [2.4.8] - 2023-04-12
370
371### Fixed
372
373- Fix message between main worker and worker type definition for tasks.
374- Fix code documentation.
375
376## [2.4.7] - 2023-04-11
377
378### Added
379
380- Add worker tasks queue options to pool options.
381
382### Fixed
383
384- Fix missing documentation.
385
386## [2.4.6] - 2023-04-10
387
388### Fixed
389
390- Ensure one task at a time is executed per worker with tasks queueing enabled.
391- Properly count worker executing tasks with tasks queueing enabled.
392
393## [2.4.5] - 2023-04-09
394
395### Added
396
397- Use monotonic high resolution timer for worker tasks runtime.
398- Add worker tasks median runtime to statistics.
399- Add worker tasks queue (experimental).
400
401## [2.4.4] - 2023-04-07
402
403### Added
404
405- Add `PoolEvents` enumeration and `PoolEvent` type.
406
407### Fixed
408
409- Destroy worker only on alive check.
410
411## [2.4.3] - 2023-04-07
412
413### Fixed
414
415- Fix typedoc generation with inheritance.
416
417## [2.4.2] - 2023-04-06
418
419### Added
420
421- Add `full` event to dynamic pool.
422- Keep worker choice strategy in memory for conditional reuse.
423
424### Fixed
425
426- Fix possible negative worker key at worker removal in worker choice strategies.
427
428## [2.4.1] - 2023-04-05
429
430### Changed
431
432- Optimize worker choice strategy for dynamic pool.
433
434### Fixed
435
436- Ensure dynamic pool does not alter worker choice strategy expected behavior.
437
438## [2.4.0] - 2023-04-04
439
440### Added
441
442- Add `LESS_BUSY` worker choice strategy.
443
444### Changed
445
446- Optimize worker storage in pool.
447- Optimize worker alive status check.
448- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
449- Optimize `LESS_USED` worker choice strategy.
450- Update benchmarks versus external threads pools.
451- Optimize tasks usage statistics requirements for worker choice strategy.
452
453### Fixed
454
455- Ensure trimmable characters are checked at pool initialization.
456- Fix message id integer overflow.
457- Fix pool worker removal in worker choice strategy internals.
458- Fix package publication with pnpm.
459
460## [2.4.0-3] - 2023-04-04
461
462### Added
463
464- Add `LESS_BUSY` worker choice strategy.
465
466### Changed
467
468- Optimize worker storage in pool.
469- Optimize worker alive status check.
470- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
471- Optimize `LESS_USED` worker choice strategy.
472- Update benchmarks versus external threads pools.
473
474### Fixed
475
476- Ensure trimmable characters are checked at pool initialization.
477- Fix message id integer overflow.
478- Fix pool worker removal in worker choice strategy internals.
479- Fix package publication with pnpm.
480
481## [2.4.0-2] - 2023-04-03
482
483### Added
484
485- Add `LESS_BUSY` worker choice strategy.
486
487### Changed
488
489- Optimize worker storage in pool.
490- Optimize worker alive status check.
491- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
492- Optimize `LESS_USED` worker choice strategy.
493
494### Fixed
495
496- Ensure trimmable characters are checked at pool initialization.
497- Fix message id integer overflow.
498- Fix pool worker removal in worker choice strategy internals.
499- Fix package publication with pnpm.
500
501## [2.4.0-1] - 2023-04-03
502
503### Added
504
505- Add `LESS_BUSY` worker choice strategy.
506
507### Changed
508
509- Optimize worker storage in pool.
510- Optimize worker alive status check.
511- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
512- Optimize `LESS_USED` worker choice strategy.
513
514### Fixed
515
516- Ensure trimmable characters are checked at pool initialization.
517- Fix message id integer overflow.
518- Fix pool worker removal in worker choice strategy internals.
519
520## [2.4.0-0] - 2023-04-03
521
522### Added
523
524- Add `LESS_BUSY` worker choice strategy.
525
526### Changed
527
528- Optimize worker storage in pool.
529- Optimize worker alive status check.
530- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
531- Optimize `LESS_USED` worker choice strategy.
532
533### Fixed
534
535- Ensure trimmable characters are checked at pool initialization.
536- Fix message id integer overflow.
537- Fix pool worker removal in worker choice strategy internals.
538
539## [2.3.10] - 2023-03-18
540
541### Fixed
542
543- Fix package.json `exports` syntax for ESM and CommonJS.
544
545### Changed
546
547- Permit SemVer pre-release publication.
548
549## [2.3.10-2] - 2023-03-18
550
551### Fixed
552
553- Fix package.json `exports` syntax for ESM and CommonJS.
554
555## [2.3.10-1] - 2023-03-18
556
557### Changed
558
559- Permit SemVer pre-release publication.
560
561## [2.3.10-0] - 2023-03-18
562
563### Fixed
564
565- Fix package.json `exports` syntax for ESM and CommonJS.
566
567## [2.3.9] - 2023-03-18
568
569### Changed
570
571- Introduce ESM module support along with CommonJS one.
572
573### Fixed
574
575- Fix brown paper bag bug referencing the same object literal.
576
577## [2.3.8] - 2023-03-18
578
579### Changed
580
581- Switch internal benchmarking code to benny.
582- Switch to TypeScript 5.x.x.
583- Switch rollup bundler plugins to core ones.
584- Switch to TSDoc syntax.
585- Enforce conventional commits.
586
587### Fixed
588
589- Fix random integer generator.
590- Fix worker choice strategy pool type identification at initialization.
591
592## [2.3.7] - 2022-10-23
593
594### Changed
595
596- Switch to open collective FOSS project funding platform.
597- Switch to ts-standard linter configuration on TypeScript code.
598
599### Fixed
600
601- Fixed missing async on pool execute method.
602- Fixed typing in TypeScript example.
603- Fixed types in unit tests.
604
605## [2.3.6] - 2022-10-22
606
607### Changed
608
609- Cleanup pool attributes and methods.
610- Refine error types thrown.
611
612### Fixed
613
614- Fix continuous integration build on windows.
615- Fix code coverage reporting by using c8 instead of nyc.
616
617## [2.3.5] - 2022-10-21
618
619### Changed
620
621- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
622- Optimize tasks usage lookup implementation.
623
624### Fixed
625
626- Fix missed pool event emitter type export.
627- Fix typedoc documentation generation.
628
629## [2.3.4] - 2022-10-17
630
631### Added
632
633- Fully automate release process with release-it.
634
635### Changed
636
637- Optimize fair share task scheduling algorithm implementation.
638- Update benchmarks versus external pools results with latest version.
639
640## [2.3.3] - 2022-10-15
641
642### Added
643
644- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
645
646## [2.3.2] - 2022-10-14
647
648### Changed
649
650- Optimize fair share worker selection strategy implementation.
651
652### Fixed
653
654- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
655
656## [2.3.1] - 2022-10-13
657
658### Added
659
660- Pool worker choice strategies:
661 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
662 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
663
664## [2.2.2] - 2022-10-09
665
666### Fixed
667
668- Fixed `README.md` file.
669
670## [2.2.1] - 2022-10-08
671
672### Added
673
674- Dynamic worker choice strategy change at runtime.
675
676## [2.2.0] - 2022-01-05
677
678### Breaking Changes
679
680- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
681
682## [2.1.0] - 2021-08-29
683
684### Added
685
686- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
687
688### Breaking Changes
689
690- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
691- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
692- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
693- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
694
695## [2.0.2] - 2021-05-12
696
697### Bug fixes
698
699- Fix `busy` event emission on fixed pool type
700
701## [2.0.1] - 2021-03-16
702
703### Bug fixes
704
705- Check if pool options are properly set.
706- `busy` event is emitted on all pool types.
707
708## [2.0.0] - 2021-03-01
709
710### Bug fixes
711
712- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
713
714### Breaking Changes
715
716- `FullPool` event is now renamed to `busy`.
717- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
718 _Find more details on our JSDoc._
719
720- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
721
722- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
723
724### Pool options types declaration merge
725
726`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
727
728#### New `export` strategy
729
730```js
731// Before
732const DynamicThreadPool = require('poolifier/lib/dynamic')
733// After
734const { DynamicThreadPool } = require('poolifier/lib/dynamic')
735```
736
737But you should always prefer just using
738
739```js
740const { DynamicThreadPool } = require('poolifier')
741```
742
743#### New type definitions for input data and response
744
745For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
746_This is not a limitation by poolifier but Node.js._
747
748#### Public property replacements
749
750`numWorkers` property is now `numberOfWorkers`
751
752#### Internal (protected) properties and methods renaming
753
754These properties are not intended for end users
755
756- `id` => `nextMessageId`
757
758These methods are not intended for end users
759
760- `_chooseWorker` => `chooseWorker`
761- `_newWorker` => `createWorker`
762- `_execute` => `internalExecute`
763- `_chooseWorker` => `chooseWorker`
764- `_checkAlive` => `checkAlive`
765- `_run` => `run`
766- `_runAsync` => `runAsync`
767
768## [1.1.0] - 2020-05-21
769
770### Added
771
772- ThreadWorker support async functions as option
773- Various external library patches
774
775## [1.0.0] - 2020-01-24
776
777### Added
778
779- FixedThreadPool implementation
780- DynamicThreadPool implementation
781- WorkerThread implementation to improve developer experience