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