| 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 | ## [3.0.9] - 2023-11-26 |
| 11 | |
| 12 | ### Fixed |
| 13 | |
| 14 | - Remove all pool events listener at pool destroying. |
| 15 | - Remove all worker node events listener at worker node destroying. |
| 16 | - Fix worker node event emitter listeners handling memory leak at pool options runtime change. |
| 17 | |
| 18 | ## [3.0.8] - 2023-11-25 |
| 19 | |
| 20 | ### Fixed |
| 21 | |
| 22 | - Ensure continuous tasks stealing on idle start at worker node idling |
| 23 | |
| 24 | ## [3.0.7] - 2023-11-24 |
| 25 | |
| 26 | ### Changed |
| 27 | |
| 28 | - Make continuous tasks stealing start at worker node idling. |
| 29 | |
| 30 | ## [3.0.6] - 2023-11-24 |
| 31 | |
| 32 | ### Fixed |
| 33 | |
| 34 | - Ensure pool statuses are checked at initialization, `start()` or `destroy()`. |
| 35 | - Ensure pool `ready` event can be emitted after several `start()/destroy()` cycles. |
| 36 | |
| 37 | ## [3.0.5] - 2023-10-27 |
| 38 | |
| 39 | ### Fixed |
| 40 | |
| 41 | - Ensure pool `ready` event can be emitted only once. |
| 42 | |
| 43 | ## [3.0.4] - 2023-10-20 |
| 44 | |
| 45 | ### Changed |
| 46 | |
| 47 | - Switch to Bencher for benchmarking: [https://bencher.dev/perf/poolifier](https://bencher.dev/perf/poolifier). |
| 48 | - Use builtin retry mechanism in worker choice strategies instead of custom one. |
| 49 | |
| 50 | ## [3.0.3] - 2023-10-19 |
| 51 | |
| 52 | ### Fixed |
| 53 | |
| 54 | - Avoid null exception at sending message to worker. |
| 55 | - Avoid null exception at checking worker node readiness. |
| 56 | |
| 57 | ## [3.0.2] - 2023-10-17 |
| 58 | |
| 59 | ### Fixed |
| 60 | |
| 61 | - Fix race condition at dynamic worker node task assignment and scheduled removal. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468) and [#1496](https://github.com/poolifier/poolifier/issues/1496). |
| 62 | |
| 63 | ## [3.0.1] - 2023-10-16 |
| 64 | |
| 65 | ### Fixed |
| 66 | |
| 67 | - Workaround possible race condition at work nodes array element removal and querying. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468). |
| 68 | |
| 69 | ### Changed |
| 70 | |
| 71 | - Switch the worker node eventing code to `EventTarget` API. |
| 72 | |
| 73 | ## [3.0.0] - 2023-10-08 |
| 74 | |
| 75 | ### Changed |
| 76 | |
| 77 | - Remove Node.js 16.x.x (EOL) support. |
| 78 | |
| 79 | ## [2.7.5] - 2023-10-03 |
| 80 | |
| 81 | ### Changed |
| 82 | |
| 83 | - Use `EventEmitterAsyncResource` type from `@types/node` for pool event emitter. TypeScript users will need to update to latest `@types/node` version. |
| 84 | |
| 85 | ## [2.7.4] - 2023-09-25 |
| 86 | |
| 87 | ### Fixed |
| 88 | |
| 89 | - Fix source maps (bundler issue). |
| 90 | |
| 91 | ## [2.7.3] - 2023-09-24 |
| 92 | |
| 93 | ### Changed |
| 94 | |
| 95 | - Convert pool event emitter to event emitter async resource. |
| 96 | |
| 97 | ## [2.7.2] - 2023-09-23 |
| 98 | |
| 99 | ### Changed |
| 100 | |
| 101 | - Add source maps to npm package to ease debugging. |
| 102 | |
| 103 | ### Added |
| 104 | |
| 105 | - Continuous benchmarking versus other worker pools: [https://poolifier.github.io/benchmark](https://poolifier.github.io/benchmark). |
| 106 | |
| 107 | ## [2.7.1] - 2023-09-20 |
| 108 | |
| 109 | ### Fixed |
| 110 | |
| 111 | - Ensure worker message listener used one time are removed after usage. |
| 112 | |
| 113 | ## [2.7.0] - 2023-09-19 |
| 114 | |
| 115 | ### Fixed |
| 116 | |
| 117 | - Fix task stealing related tasks queue options handling at runtime. |
| 118 | |
| 119 | ### Changed |
| 120 | |
| 121 | - Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API. |
| 122 | |
| 123 | ### Added |
| 124 | |
| 125 | - Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API: [PR #1148](https://github.com/poolifier/poolifier/pull/1148). |
| 126 | - Stricter worker constructor arguments validation. |
| 127 | |
| 128 | ## [2.6.45] - 2023-09-17 |
| 129 | |
| 130 | ### Changed |
| 131 | |
| 132 | - Disable publication on GitHub packages registry on release until authentication issue is fixed. |
| 133 | |
| 134 | ### Added |
| 135 | |
| 136 | - Add `startWorkers` to pool options to whether start the minimum number of workers at pool initialization or not. |
| 137 | - Add `start()` method to pool API to start the minimum number of workers. |
| 138 | - Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task stealing or not and whether enable tasks stealing under back pressure or not. |
| 139 | - Continuous internal benchmarking: [https://poolifier.github.io/benchmark-results/dev/bench](https://poolifier.github.io/benchmark-results/dev/bench). |
| 140 | |
| 141 | ## [2.6.44] - 2023-09-08 |
| 142 | |
| 143 | ### Fixed |
| 144 | |
| 145 | - Use a dedicated PAT to publish on GitHub packages registry. |
| 146 | |
| 147 | ### Added |
| 148 | |
| 149 | - Publish on GitHub packages registry on release. |
| 150 | |
| 151 | ### Changed |
| 152 | |
| 153 | - Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128). |
| 154 | |
| 155 | ## [2.6.43] - 2023-09-08 |
| 156 | |
| 157 | ### Added |
| 158 | |
| 159 | - Publish on GitHub packages registry on release. |
| 160 | |
| 161 | ### Changed |
| 162 | |
| 163 | - Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128). |
| 164 | |
| 165 | ## [2.6.42] - 2023-09-06 |
| 166 | |
| 167 | ### Changed |
| 168 | |
| 169 | - Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ... |
| 170 | |
| 171 | ## [2.6.41] - 2023-09-03 |
| 172 | |
| 173 | ### Changed |
| 174 | |
| 175 | - Optimize worker choice strategies implementation. |
| 176 | |
| 177 | ## [2.6.40] - 2023-09-01 |
| 178 | |
| 179 | ### Fixed |
| 180 | |
| 181 | - Do not pre-choose in WRR worker choice strategy to avoid bias. |
| 182 | - Avoid array out of bound in worker choice strategies after worker node removal. |
| 183 | |
| 184 | ## [2.6.39] - 2023-08-30 |
| 185 | |
| 186 | ### Fixed |
| 187 | |
| 188 | - Fix race condition in worker choice strategies at worker node info querying while not yet initialized. |
| 189 | |
| 190 | ## [2.6.38] - 2023-08-30 |
| 191 | |
| 192 | ### Added |
| 193 | |
| 194 | - Bundle typescript types declaration into one file. |
| 195 | |
| 196 | ### Changed |
| 197 | |
| 198 | - Improve interleaved weighted round robin worker choice strategy implementation. |
| 199 | |
| 200 | ## [2.6.37] - 2023-08-28 |
| 201 | |
| 202 | ### Fixed |
| 203 | |
| 204 | - Ensure unused worker usage statistics are deleted at runtime. |
| 205 | |
| 206 | ### Changed |
| 207 | |
| 208 | - Rename worker choice strategy options `choiceRetries` to `retries`. |
| 209 | - Avoid unnecessary branching in worker choice strategies. |
| 210 | |
| 211 | ## [2.6.36] - 2023-08-27 |
| 212 | |
| 213 | ### Fixed |
| 214 | |
| 215 | - Fix pool `execute()` arguments check. |
| 216 | |
| 217 | ### Changed |
| 218 | |
| 219 | - Make continuous tasks stealing algorithm less aggressive. |
| 220 | - Fine tune tasks stealing algorithm under back pressure. |
| 221 | |
| 222 | ## [2.6.35] - 2023-08-25 |
| 223 | |
| 224 | ### Fixed |
| 225 | |
| 226 | - Don't account worker usage statistics for tasks that have failed. |
| 227 | - Fix pool information runtime and wait time median computation. |
| 228 | |
| 229 | ### Changed |
| 230 | |
| 231 | - Update simple moving average implementation to use a circular buffer. |
| 232 | - Update simple moving median implementation to use a circular buffer. |
| 233 | - Account for stolen tasks in worker usage statistics and pool information. |
| 234 | |
| 235 | ### Added |
| 236 | |
| 237 | - Continuous tasks stealing algorithm. |
| 238 | |
| 239 | ## [2.6.34] - 2023-08-24 |
| 240 | |
| 241 | ### Fixes |
| 242 | |
| 243 | - Avoid cascading tasks stealing under back pressure. |
| 244 | |
| 245 | ### Changed |
| 246 | |
| 247 | - Add fastpath to queued tasks rescheduling. |
| 248 | |
| 249 | ## [2.6.33] - 2023-08-24 |
| 250 | |
| 251 | ### Fixed |
| 252 | |
| 253 | - Fix queued tasks rescheduling. |
| 254 | |
| 255 | ### Changed |
| 256 | |
| 257 | - Rename tasks queue options `queueMaxSize` to `size`. |
| 258 | |
| 259 | ### Added |
| 260 | |
| 261 | - Task stealing scheduling algorithm if tasks queueing is enabled. |
| 262 | |
| 263 | ## [2.6.32] - 2023-08-23 |
| 264 | |
| 265 | ### Fixed |
| 266 | |
| 267 | - Ensure no task can be executed when the pool is destroyed. |
| 268 | |
| 269 | ### Added |
| 270 | |
| 271 | - Add `queueMaxSize` option to tasks queue options. |
| 272 | - Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing. |
| 273 | - Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled. |
| 274 | |
| 275 | ## [2.6.31] - 2023-08-20 |
| 276 | |
| 277 | ### Fixed |
| 278 | |
| 279 | - Fix worker choice strategy retries mechanism in some edge cases. |
| 280 | |
| 281 | ### Changed |
| 282 | |
| 283 | - Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage. |
| 284 | - Remove the experimental status of the `LEAST_ELU` worker choice strategy. |
| 285 | |
| 286 | ## [2.6.30] - 2023-08-19 |
| 287 | |
| 288 | ### Fixed |
| 289 | |
| 290 | - Ensure pool event `backPressure` is emitted. |
| 291 | - Ensure pool event `full` is emitted only once. |
| 292 | - Ensure worker node cannot be instantiated without proper arguments. |
| 293 | |
| 294 | ## [2.6.29] - 2023-08-18 |
| 295 | |
| 296 | ### Fixed |
| 297 | |
| 298 | - Fix race condition between readiness and task functions worker message handling at startup. |
| 299 | - Fix duplicate task function worker usage statistics computation per task function. |
| 300 | - Update task function worker usage statistics if and only if there's at least two different task functions. |
| 301 | - Fix race condition at task function worker usage executing task computation leading to negative value. |
| 302 | |
| 303 | ### Added |
| 304 | |
| 305 | - Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2). |
| 306 | - Use back pressure detection in worker choice strategies. |
| 307 | - Add worker choice strategies retries mechanism if no worker is eligible. |
| 308 | |
| 309 | ## [2.6.28] - 2023-08-16 |
| 310 | |
| 311 | ### Fixed |
| 312 | |
| 313 | - Ensure pool workers are properly initialized. |
| 314 | |
| 315 | ### Added |
| 316 | |
| 317 | - HTTP server pool examples: express-cluster, express-hybrid. |
| 318 | |
| 319 | ### Changed |
| 320 | |
| 321 | - Remove now useless branching in worker hot code path. |
| 322 | |
| 323 | ## [2.6.27] - 2023-08-15 |
| 324 | |
| 325 | ### Fixed |
| 326 | |
| 327 | - Add `KillHandler` type definition to exported types. |
| 328 | |
| 329 | ### Added |
| 330 | |
| 331 | - Add `destroy` event to pool API. |
| 332 | |
| 333 | ## [2.6.26] - 2023-08-15 |
| 334 | |
| 335 | ### Added |
| 336 | |
| 337 | - Add kill handler to worker options allowing to execute custom code when worker is killed. |
| 338 | - Add `listTaskFunctions()` method to pool API. |
| 339 | - SMTP client pool example: nodemailer. |
| 340 | |
| 341 | ## [2.6.25] - 2023-08-13 |
| 342 | |
| 343 | ### Added |
| 344 | |
| 345 | - HTTP server pool examples: fastify-cluster, fastify-hybrid. |
| 346 | - WebSocket server pool examples: ws-cluster, ws-hybrid. |
| 347 | |
| 348 | ## [2.6.24] - 2023-08-12 |
| 349 | |
| 350 | ### Added |
| 351 | |
| 352 | - Add array of transferable objects to the `execute()` method arguments. |
| 353 | - WebSocket server pool examples: ws-worker_threads. |
| 354 | |
| 355 | ## [2.6.23] - 2023-08-11 |
| 356 | |
| 357 | ### Fixed |
| 358 | |
| 359 | - Fix pool busyness semantic when tasks queueing is enabled: the pool is busy when the number of executing tasks on each worker has reached the maximum tasks concurrency per worker. |
| 360 | |
| 361 | ### Added |
| 362 | |
| 363 | - HTTP client pool examples: fetch, node-fetch and axios with multiple task functions. |
| 364 | - HTTP server pool examples: express-worker_threads, fastify-worker_threads. |
| 365 | |
| 366 | ## [2.6.22] - 2023-08-10 |
| 367 | |
| 368 | ### Fixed |
| 369 | |
| 370 | - Add missing `types` field to package.json `exports`. |
| 371 | |
| 372 | ### Changed |
| 373 | |
| 374 | - Structure markdown documentation (PR #811). |
| 375 | |
| 376 | ## [2.6.21] - 2023-08-03 |
| 377 | |
| 378 | ### Changed |
| 379 | |
| 380 | - Improve code documentation. |
| 381 | - Code refactoring and cleanup for better maintainability and readability. |
| 382 | |
| 383 | ## [2.6.20] - 2023-07-21 |
| 384 | |
| 385 | ### Fixed |
| 386 | |
| 387 | - Fix queued tasks redistribution on error task execution starvation. |
| 388 | - Ensure tasks queueing per worker condition is untangled from the pool busyness semantic. |
| 389 | |
| 390 | ### Changed |
| 391 | |
| 392 | - Drastically reduce lookups by worker in the worker nodes. |
| 393 | |
| 394 | ## [2.6.19] - 2023-07-20 |
| 395 | |
| 396 | ### Added |
| 397 | |
| 398 | - Dedicated internal communication channel for worker_threads pools. |
| 399 | |
| 400 | ## [2.6.18] - 2023-07-19 |
| 401 | |
| 402 | ### Changed |
| 403 | |
| 404 | - Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller. |
| 405 | |
| 406 | ## [2.6.17] - 2023-07-16 |
| 407 | |
| 408 | ### Added |
| 409 | |
| 410 | - Add `listTaskFunctions()` method to worker API. |
| 411 | |
| 412 | ## [2.6.16] - 2023-07-12 |
| 413 | |
| 414 | ### Fixed |
| 415 | |
| 416 | - Fix pool startup detection. |
| 417 | - Fix worker task functions handling. |
| 418 | |
| 419 | ## [2.6.15] - 2023-07-11 |
| 420 | |
| 421 | ### Added |
| 422 | |
| 423 | - Take into account worker node readiness in worker choice strategies. |
| 424 | |
| 425 | ## [2.6.14] - 2023-07-10 |
| 426 | |
| 427 | ### Fixed |
| 428 | |
| 429 | - Fix task function statistics tracking. |
| 430 | |
| 431 | ## [2.6.13] - 2023-07-10 |
| 432 | |
| 433 | ### Added |
| 434 | |
| 435 | - Add per task function statistics tracking. |
| 436 | - Add public methods to manipulate the worker task functions at runtime. |
| 437 | |
| 438 | ## [2.6.12] - 2023-07-09 |
| 439 | |
| 440 | ### Fixed |
| 441 | |
| 442 | - Workaround import issue with `node:os` module in node 16.x.x. |
| 443 | |
| 444 | ## [2.6.11] - 2023-07-09 |
| 445 | |
| 446 | ### Fixed |
| 447 | |
| 448 | - Fix pool readiness semantic. |
| 449 | |
| 450 | ## [2.6.10] - 2023-07-08 |
| 451 | |
| 452 | ### Fixed |
| 453 | |
| 454 | - Ensure workers are not recreated on error at pool startup. |
| 455 | |
| 456 | ### Added |
| 457 | |
| 458 | - Add `ready` and `strategy` fields to pool information. |
| 459 | - Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready. |
| 460 | - Add dynamic pool sizing checks. |
| 461 | |
| 462 | ## [2.6.9] - 2023-07-07 |
| 463 | |
| 464 | ### Fixed |
| 465 | |
| 466 | - Recreate the right worker type on uncaught exception. |
| 467 | |
| 468 | ### Added |
| 469 | |
| 470 | - Add minimum and maximum to internal measurement statistics. |
| 471 | - Add `runTime` and `waitTime` to pool information. |
| 472 | - Check worker inactive time only on dynamic worker. |
| 473 | |
| 474 | ## [2.6.8] - 2023-07-03 |
| 475 | |
| 476 | ### Fixed |
| 477 | |
| 478 | - Brown paper bag release to fix version handling in pool information. |
| 479 | |
| 480 | ## [2.6.7] - 2023-07-03 |
| 481 | |
| 482 | ### Fixed |
| 483 | |
| 484 | - Ensure worker queued tasks at error are reassigned to other pool workers. |
| 485 | |
| 486 | ### Added |
| 487 | |
| 488 | - Add pool `utilization` ratio to pool information. |
| 489 | - Add `version` to pool information. |
| 490 | - Add worker information to worker nodes. |
| 491 | |
| 492 | ## [2.6.6] - 2023-07-01 |
| 493 | |
| 494 | ### Added |
| 495 | |
| 496 | - Add safe helper `availableParallelism()` to help sizing the pool. |
| 497 | |
| 498 | ### Fixed |
| 499 | |
| 500 | - Ensure message handler is only registered in worker. |
| 501 | |
| 502 | ## [2.6.5] - 2023-06-27 |
| 503 | |
| 504 | ### Known issues |
| 505 | |
| 506 | - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782 |
| 507 | |
| 508 | ### Fixed |
| 509 | |
| 510 | - Artificial version bump to 2.6.5 to workaround publication issue. |
| 511 | - Ensure cluster pool `destroy()` gracefully shutdowns worker's server. |
| 512 | - Ensure pool event is emitted before task error promise rejection. |
| 513 | - Fix queued tasks count computation. |
| 514 | |
| 515 | ### Removed |
| 516 | |
| 517 | - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. |
| 518 | |
| 519 | ## [2.6.4] - 2023-06-27 |
| 520 | |
| 521 | ### Known issues |
| 522 | |
| 523 | - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782 |
| 524 | |
| 525 | ### Fixed |
| 526 | |
| 527 | - Ensure cluster pool `destroy()` gracefully shutdowns worker's server. |
| 528 | - Ensure pool event is emitted before task error promise rejection. |
| 529 | - Fix queued tasks count computation. |
| 530 | |
| 531 | ### Removed |
| 532 | |
| 533 | - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC. |
| 534 | |
| 535 | ## [2.6.3] - 2023-06-19 |
| 536 | |
| 537 | ### Fixed |
| 538 | |
| 539 | - Ensure no tasks are queued when trying to soft kill a dynamic worker. |
| 540 | - Update strategies internals after statistics computation. |
| 541 | |
| 542 | ### Changed |
| 543 | |
| 544 | - Optimize O(1) queue implementation. |
| 545 | |
| 546 | ## [2.6.2] - 2023-06-12 |
| 547 | |
| 548 | ### Fixed |
| 549 | |
| 550 | - Fix new worker use after creation in dynamic pool given the current worker choice strategy. |
| 551 | |
| 552 | ## [2.6.1] - 2023-06-10 |
| 553 | |
| 554 | ### Added |
| 555 | |
| 556 | - Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md). |
| 557 | |
| 558 | ### Fixed |
| 559 | |
| 560 | - Fix average statistics computation: ensure failed tasks are not accounted. |
| 561 | |
| 562 | ## [2.6.0] - 2023-06-09 |
| 563 | |
| 564 | ### Added |
| 565 | |
| 566 | - Add `LEAST_ELU` worker choice strategy (experimental). |
| 567 | - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy. |
| 568 | |
| 569 | ### Changed |
| 570 | |
| 571 | - Refactor pool worker node usage internals. |
| 572 | - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed. |
| 573 | - Breaking change: pool information `info` property object fields have been renamed. |
| 574 | |
| 575 | ### Fixed |
| 576 | |
| 577 | - Fix wait time accounting. |
| 578 | - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time. |
| 579 | - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks. |
| 580 | |
| 581 | ## [2.5.4] - 2023-06-07 |
| 582 | |
| 583 | ### Added |
| 584 | |
| 585 | - Add Event Loop Utilization (ELU) statistics to worker tasks usage. |
| 586 | |
| 587 | ### Changed |
| 588 | |
| 589 | - Compute statistics at the worker level only if needed. |
| 590 | - Add `worker_threads` options to thread pool options. |
| 591 | |
| 592 | ### Fixed |
| 593 | |
| 594 | - Make the `LEAST_BUSY` strategy only relies on task runtime. |
| 595 | |
| 596 | ## [2.5.3] - 2023-06-04 |
| 597 | |
| 598 | ### Changed |
| 599 | |
| 600 | - Refine pool information content. |
| 601 | - Limit pool internals public exposure. |
| 602 | |
| 603 | ## [2.5.2] - 2023-06-02 |
| 604 | |
| 605 | ### Added |
| 606 | |
| 607 | - Add `taskError` pool event for task execution error. |
| 608 | - Add pool information `info` property to pool. |
| 609 | - Emit pool information on `busy` and `full` pool events. |
| 610 | |
| 611 | ## [2.5.1] - 2023-06-01 |
| 612 | |
| 613 | ### Added |
| 614 | |
| 615 | - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`. |
| 616 | - Add `error` pool event for uncaught worker error. |
| 617 | |
| 618 | ## [2.5.0] - 2023-05-31 |
| 619 | |
| 620 | ### Added |
| 621 | |
| 622 | - Switch pool event emitter to `EventEmitterAsyncResource`. |
| 623 | - Add tasks wait time accounting in per worker tasks usage. |
| 624 | - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental). |
| 625 | |
| 626 | ### Changed |
| 627 | |
| 628 | - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`. |
| 629 | |
| 630 | ## [2.4.14] - 2023-05-09 |
| 631 | |
| 632 | ### Fixed |
| 633 | |
| 634 | - Ensure no undefined task runtime can land in the tasks history. |
| 635 | - Fix median computation implementation once again. |
| 636 | |
| 637 | ### Added |
| 638 | |
| 639 | - Unit tests for median and queue implementations. |
| 640 | |
| 641 | ## [2.4.13] - 2023-05-08 |
| 642 | |
| 643 | ### Fixed |
| 644 | |
| 645 | - Fix worker choice strategy options validation. |
| 646 | - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission. |
| 647 | |
| 648 | ## [2.4.12] - 2023-05-06 |
| 649 | |
| 650 | ### Added |
| 651 | |
| 652 | - Support multiple task functions per worker. |
| 653 | - Add custom worker weights support to worker choice strategies options. |
| 654 | |
| 655 | ### Changed |
| 656 | |
| 657 | - Use O(1) queue implementation for tasks queueing. |
| 658 | |
| 659 | ### Fixed |
| 660 | |
| 661 | - Fix median computation implementation. |
| 662 | - Fix fair share worker choice strategy internals update. |
| 663 | |
| 664 | ## [2.4.11] - 2023-04-23 |
| 665 | |
| 666 | ### Changed |
| 667 | |
| 668 | - Optimize free worker finding in worker choice strategies. |
| 669 | |
| 670 | ## [2.4.10] - 2023-04-15 |
| 671 | |
| 672 | ### Fixed |
| 673 | |
| 674 | - Fix typescript type definition for task function: ensure the input data is optional. |
| 675 | - Fix typescript type definition for pool execute(): ensure the input data is optional. |
| 676 | |
| 677 | ## [2.4.9] - 2023-04-15 |
| 678 | |
| 679 | ### Added |
| 680 | |
| 681 | - Add tasks queue enablement runtime setter to pool. |
| 682 | - Add tasks queue options runtime setter to pool. |
| 683 | - Add worker choice strategy options runtime setter to pool. |
| 684 | |
| 685 | ### Changed |
| 686 | |
| 687 | - Remove the tasks queuing experimental status. |
| 688 | |
| 689 | ### Fixed |
| 690 | |
| 691 | - Fix task function type definition and validation. |
| 692 | - Fix worker choice strategy options handling. |
| 693 | |
| 694 | ## [2.4.8] - 2023-04-12 |
| 695 | |
| 696 | ### Fixed |
| 697 | |
| 698 | - Fix message between main worker and worker type definition for tasks. |
| 699 | - Fix code documentation. |
| 700 | |
| 701 | ## [2.4.7] - 2023-04-11 |
| 702 | |
| 703 | ### Added |
| 704 | |
| 705 | - Add worker tasks queue options to pool options. |
| 706 | |
| 707 | ### Fixed |
| 708 | |
| 709 | - Fix missing documentation. |
| 710 | |
| 711 | ## [2.4.6] - 2023-04-10 |
| 712 | |
| 713 | ### Fixed |
| 714 | |
| 715 | - Ensure one task at a time is executed per worker with tasks queueing enabled. |
| 716 | - Properly count worker executing tasks with tasks queueing enabled. |
| 717 | |
| 718 | ## [2.4.5] - 2023-04-09 |
| 719 | |
| 720 | ### Added |
| 721 | |
| 722 | - Use monotonic high resolution timer for worker tasks runtime. |
| 723 | - Add worker tasks median runtime to statistics. |
| 724 | - Add worker tasks queue (experimental). |
| 725 | |
| 726 | ## [2.4.4] - 2023-04-07 |
| 727 | |
| 728 | ### Added |
| 729 | |
| 730 | - Add `PoolEvents` enumeration and `PoolEvent` type. |
| 731 | |
| 732 | ### Fixed |
| 733 | |
| 734 | - Destroy worker only on alive check. |
| 735 | |
| 736 | ## [2.4.3] - 2023-04-07 |
| 737 | |
| 738 | ### Fixed |
| 739 | |
| 740 | - Fix typedoc generation with inheritance. |
| 741 | |
| 742 | ## [2.4.2] - 2023-04-06 |
| 743 | |
| 744 | ### Added |
| 745 | |
| 746 | - Add `full` event to dynamic pool. |
| 747 | - Keep worker choice strategy in memory for conditional reuse. |
| 748 | |
| 749 | ### Fixed |
| 750 | |
| 751 | - Fix possible negative worker key at worker removal in worker choice strategies. |
| 752 | |
| 753 | ## [2.4.1] - 2023-04-05 |
| 754 | |
| 755 | ### Changed |
| 756 | |
| 757 | - Optimize worker choice strategy for dynamic pool. |
| 758 | |
| 759 | ### Fixed |
| 760 | |
| 761 | - Ensure dynamic pool does not alter worker choice strategy expected behavior. |
| 762 | |
| 763 | ## [2.4.0] - 2023-04-04 |
| 764 | |
| 765 | ### Added |
| 766 | |
| 767 | - Add `LESS_BUSY` worker choice strategy. |
| 768 | |
| 769 | ### Changed |
| 770 | |
| 771 | - Optimize worker storage in pool. |
| 772 | - Optimize worker alive status check. |
| 773 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 774 | - Optimize `LESS_USED` worker choice strategy. |
| 775 | - Update benchmark versus external threads pools. |
| 776 | - Optimize tasks usage statistics requirements for worker choice strategy. |
| 777 | |
| 778 | ### Fixed |
| 779 | |
| 780 | - Ensure trimmable characters are checked at pool initialization. |
| 781 | - Fix message id integer overflow. |
| 782 | - Fix pool worker removal in worker choice strategy internals. |
| 783 | - Fix package publication with pnpm. |
| 784 | |
| 785 | ## [2.4.0-3] - 2023-04-04 |
| 786 | |
| 787 | ### Added |
| 788 | |
| 789 | - Add `LESS_BUSY` worker choice strategy. |
| 790 | |
| 791 | ### Changed |
| 792 | |
| 793 | - Optimize worker storage in pool. |
| 794 | - Optimize worker alive status check. |
| 795 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 796 | - Optimize `LESS_USED` worker choice strategy. |
| 797 | - Update benchmark versus external threads pools. |
| 798 | |
| 799 | ### Fixed |
| 800 | |
| 801 | - Ensure trimmable characters are checked at pool initialization. |
| 802 | - Fix message id integer overflow. |
| 803 | - Fix pool worker removal in worker choice strategy internals. |
| 804 | - Fix package publication with pnpm. |
| 805 | |
| 806 | ## [2.4.0-2] - 2023-04-03 |
| 807 | |
| 808 | ### Added |
| 809 | |
| 810 | - Add `LESS_BUSY` worker choice strategy. |
| 811 | |
| 812 | ### Changed |
| 813 | |
| 814 | - Optimize worker storage in pool. |
| 815 | - Optimize worker alive status check. |
| 816 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 817 | - Optimize `LESS_USED` worker choice strategy. |
| 818 | |
| 819 | ### Fixed |
| 820 | |
| 821 | - Ensure trimmable characters are checked at pool initialization. |
| 822 | - Fix message id integer overflow. |
| 823 | - Fix pool worker removal in worker choice strategy internals. |
| 824 | - Fix package publication with pnpm. |
| 825 | |
| 826 | ## [2.4.0-1] - 2023-04-03 |
| 827 | |
| 828 | ### Added |
| 829 | |
| 830 | - Add `LESS_BUSY` worker choice strategy. |
| 831 | |
| 832 | ### Changed |
| 833 | |
| 834 | - Optimize worker storage in pool. |
| 835 | - Optimize worker alive status check. |
| 836 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 837 | - Optimize `LESS_USED` worker choice strategy. |
| 838 | |
| 839 | ### Fixed |
| 840 | |
| 841 | - Ensure trimmable characters are checked at pool initialization. |
| 842 | - Fix message id integer overflow. |
| 843 | - Fix pool worker removal in worker choice strategy internals. |
| 844 | |
| 845 | ## [2.4.0-0] - 2023-04-03 |
| 846 | |
| 847 | ### Added |
| 848 | |
| 849 | - Add `LESS_BUSY` worker choice strategy. |
| 850 | |
| 851 | ### Changed |
| 852 | |
| 853 | - Optimize worker storage in pool. |
| 854 | - Optimize worker alive status check. |
| 855 | - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`. |
| 856 | - Optimize `LESS_USED` worker choice strategy. |
| 857 | |
| 858 | ### Fixed |
| 859 | |
| 860 | - Ensure trimmable characters are checked at pool initialization. |
| 861 | - Fix message id integer overflow. |
| 862 | - Fix pool worker removal in worker choice strategy internals. |
| 863 | |
| 864 | ## [2.3.10] - 2023-03-18 |
| 865 | |
| 866 | ### Fixed |
| 867 | |
| 868 | - Fix package.json `exports` syntax for ESM and CommonJS. |
| 869 | |
| 870 | ### Changed |
| 871 | |
| 872 | - Permit SemVer pre-release publication. |
| 873 | |
| 874 | ## [2.3.10-2] - 2023-03-18 |
| 875 | |
| 876 | ### Fixed |
| 877 | |
| 878 | - Fix package.json `exports` syntax for ESM and CommonJS. |
| 879 | |
| 880 | ## [2.3.10-1] - 2023-03-18 |
| 881 | |
| 882 | ### Changed |
| 883 | |
| 884 | - Permit SemVer pre-release publication. |
| 885 | |
| 886 | ## [2.3.10-0] - 2023-03-18 |
| 887 | |
| 888 | ### Fixed |
| 889 | |
| 890 | - Fix package.json `exports` syntax for ESM and CommonJS. |
| 891 | |
| 892 | ## [2.3.9] - 2023-03-18 |
| 893 | |
| 894 | ### Changed |
| 895 | |
| 896 | - Introduce ESM module support along with CommonJS one. |
| 897 | |
| 898 | ### Fixed |
| 899 | |
| 900 | - Fix brown paper bag bug referencing the same object literal. |
| 901 | |
| 902 | ## [2.3.8] - 2023-03-18 |
| 903 | |
| 904 | ### Changed |
| 905 | |
| 906 | - Switch internal benchmarking code to benny. |
| 907 | - Switch to TypeScript 5.x.x. |
| 908 | - Switch rollup bundler plugins to core ones. |
| 909 | - Switch to TSDoc syntax. |
| 910 | - Enforce conventional commits. |
| 911 | |
| 912 | ### Fixed |
| 913 | |
| 914 | - Fix random integer generator. |
| 915 | - Fix worker choice strategy pool type identification at initialization. |
| 916 | |
| 917 | ## [2.3.7] - 2022-10-23 |
| 918 | |
| 919 | ### Changed |
| 920 | |
| 921 | - Switch to open collective FOSS project funding platform. |
| 922 | - Switch to ts-standard linter configuration on TypeScript code. |
| 923 | |
| 924 | ### Fixed |
| 925 | |
| 926 | - Fixed missing async on pool execute method. |
| 927 | - Fixed typing in TypeScript example. |
| 928 | - Fixed types in unit tests. |
| 929 | |
| 930 | ## [2.3.6] - 2022-10-22 |
| 931 | |
| 932 | ### Changed |
| 933 | |
| 934 | - Cleanup pool attributes and methods. |
| 935 | - Refine error types thrown. |
| 936 | |
| 937 | ### Fixed |
| 938 | |
| 939 | - Fix continuous integration build on windows. |
| 940 | - Fix code coverage reporting by using c8 instead of nyc. |
| 941 | |
| 942 | ## [2.3.5] - 2022-10-21 |
| 943 | |
| 944 | ### Changed |
| 945 | |
| 946 | - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter. |
| 947 | - Optimize tasks usage lookup implementation. |
| 948 | |
| 949 | ### Fixed |
| 950 | |
| 951 | - Fix missed pool event emitter type export. |
| 952 | - Fix typedoc documentation generation. |
| 953 | |
| 954 | ## [2.3.4] - 2022-10-17 |
| 955 | |
| 956 | ### Added |
| 957 | |
| 958 | - Fully automate release process with release-it. |
| 959 | |
| 960 | ### Changed |
| 961 | |
| 962 | - Optimize fair share task scheduling algorithm implementation. |
| 963 | - Update benchmark versus external pools results with latest version. |
| 964 | |
| 965 | ## [2.3.3] - 2022-10-15 |
| 966 | |
| 967 | ### Added |
| 968 | |
| 969 | - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options. |
| 970 | |
| 971 | ## [2.3.2] - 2022-10-14 |
| 972 | |
| 973 | ### Changed |
| 974 | |
| 975 | - Optimize fair share worker selection strategy implementation. |
| 976 | |
| 977 | ### Fixed |
| 978 | |
| 979 | - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled. |
| 980 | |
| 981 | ## [2.3.1] - 2022-10-13 |
| 982 | |
| 983 | ### Added |
| 984 | |
| 985 | - Pool worker choice strategies: |
| 986 | - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now. |
| 987 | - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now. |
| 988 | |
| 989 | ## [2.2.2] - 2022-10-09 |
| 990 | |
| 991 | ### Fixed |
| 992 | |
| 993 | - Fixed `README.md` file. |
| 994 | |
| 995 | ## [2.2.1] - 2022-10-08 |
| 996 | |
| 997 | ### Added |
| 998 | |
| 999 | - Dynamic worker choice strategy change at runtime. |
| 1000 | |
| 1001 | ## [2.2.0] - 2022-01-05 |
| 1002 | |
| 1003 | ### Breaking Changes |
| 1004 | |
| 1005 | - Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version. |
| 1006 | |
| 1007 | ## [2.1.0] - 2021-08-29 |
| 1008 | |
| 1009 | ### Added |
| 1010 | |
| 1011 | - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker. |
| 1012 | |
| 1013 | ### Breaking Changes |
| 1014 | |
| 1015 | - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute. |
| 1016 | - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`. |
| 1017 | - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`. |
| 1018 | - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker. |
| 1019 | |
| 1020 | ## [2.0.2] - 2021-05-12 |
| 1021 | |
| 1022 | ### Bug fixes |
| 1023 | |
| 1024 | - Fix `busy` event emission on fixed pool type |
| 1025 | |
| 1026 | ## [2.0.1] - 2021-03-16 |
| 1027 | |
| 1028 | ### Bug fixes |
| 1029 | |
| 1030 | - Check if pool options are properly set. |
| 1031 | - `busy` event is emitted on all pool types. |
| 1032 | |
| 1033 | ## [2.0.0] - 2021-03-01 |
| 1034 | |
| 1035 | ### Bug fixes |
| 1036 | |
| 1037 | - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70). |
| 1038 | |
| 1039 | ### Breaking Changes |
| 1040 | |
| 1041 | - `FullPool` event is now renamed to `busy`. |
| 1042 | - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`. |
| 1043 | _Find more details on our JSDoc._ |
| 1044 | |
| 1045 | - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed. |
| 1046 | |
| 1047 | - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes. |
| 1048 | |
| 1049 | ### Pool options types declaration merge |
| 1050 | |
| 1051 | `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`. |
| 1052 | |
| 1053 | #### New `export` strategy |
| 1054 | |
| 1055 | ```js |
| 1056 | // Before |
| 1057 | const DynamicThreadPool = require('poolifier/lib/dynamic') |
| 1058 | // After |
| 1059 | const { DynamicThreadPool } = require('poolifier/lib/dynamic') |
| 1060 | ``` |
| 1061 | |
| 1062 | But you should always prefer just using |
| 1063 | |
| 1064 | ```js |
| 1065 | const { DynamicThreadPool } = require('poolifier') |
| 1066 | ``` |
| 1067 | |
| 1068 | #### New type definitions for input data and response |
| 1069 | |
| 1070 | For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data. |
| 1071 | _This is not a limitation by poolifier but Node.js._ |
| 1072 | |
| 1073 | #### Public property replacements |
| 1074 | |
| 1075 | `numWorkers` property is now `numberOfWorkers` |
| 1076 | |
| 1077 | #### Internal (protected) properties and methods renaming |
| 1078 | |
| 1079 | These properties are not intended for end users |
| 1080 | |
| 1081 | - `id` => `nextMessageId` |
| 1082 | |
| 1083 | These methods are not intended for end users |
| 1084 | |
| 1085 | - `_chooseWorker` => `chooseWorker` |
| 1086 | - `_newWorker` => `createWorker` |
| 1087 | - `_execute` => `internalExecute` |
| 1088 | - `_chooseWorker` => `chooseWorker` |
| 1089 | - `_checkAlive` => `checkAlive` |
| 1090 | - `_run` => `run` |
| 1091 | - `_runAsync` => `runAsync` |
| 1092 | |
| 1093 | ## [1.1.0] - 2020-05-21 |
| 1094 | |
| 1095 | ### Added |
| 1096 | |
| 1097 | - ThreadWorker support async functions as option |
| 1098 | - Various external library patches |
| 1099 | |
| 1100 | ## [1.0.0] - 2020-01-24 |
| 1101 | |
| 1102 | ### Added |
| 1103 | |
| 1104 | - FixedThreadPool implementation |
| 1105 | - DynamicThreadPool implementation |
| 1106 | - WorkerThread implementation to improve developer experience |