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