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