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