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