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