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