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