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