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