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