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