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