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