Merge branch 'master' of github.com:poolifier/poolifier
[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 ## [2.4.7] - 2023-04-11
11
12 ### Added
13
14 - Add worker tasks queue options to pool options.
15
16 ### Fixed
17
18 - Fix missing documentation.
19
20 ## [2.4.6] - 2023-04-10
21
22 ### Fixed
23
24 - Ensure one task at a time is executed per worker with tasks queueing enabled.
25 - Properly count worker running tasks with tasks queueing enabled.
26
27 ## [2.4.5] - 2023-04-09
28
29 ### Added
30
31 - Use monotonic high resolution timer for worker tasks run time.
32 - Add worker tasks median run time to statistics.
33 - Add worker tasks queue (experimental).
34
35 ## [2.4.4] - 2023-04-07
36
37 ### Added
38
39 - Add `PoolEvents` enumeration and `PoolEvent` type.
40
41 ### Fixed
42
43 - Destroy worker only on alive check.
44
45 ## [2.4.3] - 2023-04-07
46
47 ### Fixed
48
49 - Fix typedoc generation with inheritance.
50
51 ## [2.4.2] - 2023-04-06
52
53 ### Added
54
55 - Add `full` event to dynamic pool.
56 - Keep worker choice strategy in memory for conditional reuse.
57
58 ### Fixed
59
60 - Fix possible negative worker key at worker removal in worker choice strategies.
61
62 ## [2.4.1] - 2023-04-05
63
64 ### Changed
65
66 - Optimize worker choice strategy for dynamic pool.
67
68 ### Fixed
69
70 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
71
72 ## [2.4.0] - 2023-04-04
73
74 ### Added
75
76 - Add `LESS_BUSY` worker choice strategy.
77
78 ### Changed
79
80 - Optimize worker storage in pool.
81 - Optimize worker alive status check.
82 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
83 - Optimize `LESS_USED` worker choice strategy.
84 - Update benchmarks versus external threads pools.
85 - Optimize tasks usage statistics requirements for worker choice strategy.
86
87 ### Fixed
88
89 - Ensure trimmable characters are checked at pool initialization.
90 - Fix message id integer overflow.
91 - Fix pool worker removal in worker choice strategy internals.
92 - Fix package publication with pnpm.
93
94 ## [2.4.0-3] - 2023-04-04
95
96 ### Added
97
98 - Add `LESS_BUSY` worker choice strategy.
99
100 ### Changed
101
102 - Optimize worker storage in pool.
103 - Optimize worker alive status check.
104 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
105 - Optimize `LESS_USED` worker choice strategy.
106 - Update benchmarks versus external threads pools.
107
108 ### Fixed
109
110 - Ensure trimmable characters are checked at pool initialization.
111 - Fix message id integer overflow.
112 - Fix pool worker removal in worker choice strategy internals.
113 - Fix package publication with pnpm.
114
115 ## [2.4.0-2] - 2023-04-03
116
117 ### Added
118
119 - Add `LESS_BUSY` worker choice strategy.
120
121 ### Changed
122
123 - Optimize worker storage in pool.
124 - Optimize worker alive status check.
125 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
126 - Optimize `LESS_USED` worker choice strategy.
127
128 ### Fixed
129
130 - Ensure trimmable characters are checked at pool initialization.
131 - Fix message id integer overflow.
132 - Fix pool worker removal in worker choice strategy internals.
133 - Fix package publication with pnpm.
134
135 ## [2.4.0-1] - 2023-04-03
136
137 ### Added
138
139 - Add `LESS_BUSY` worker choice strategy.
140
141 ### Changed
142
143 - Optimize worker storage in pool.
144 - Optimize worker alive status check.
145 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
146 - Optimize `LESS_USED` worker choice strategy.
147
148 ### Fixed
149
150 - Ensure trimmable characters are checked at pool initialization.
151 - Fix message id integer overflow.
152 - Fix pool worker removal in worker choice strategy internals.
153
154 ## [2.4.0-0] - 2023-04-03
155
156 ### Added
157
158 - Add `LESS_BUSY` worker choice strategy.
159
160 ### Changed
161
162 - Optimize worker storage in pool.
163 - Optimize worker alive status check.
164 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
165 - Optimize `LESS_USED` worker choice strategy.
166
167 ### Fixed
168
169 - Ensure trimmable characters are checked at pool initialization.
170 - Fix message id integer overflow.
171 - Fix pool worker removal in worker choice strategy internals.
172
173 ## [2.3.10] - 2023-03-18
174
175 ### Fixed
176
177 - Fix `exports` syntax for ESM and CommonJS.
178
179 ### Changed
180
181 - Permit SemVer pre-release publication.
182
183 ## [2.3.10-2] - 2023-03-18
184
185 ### Fixed
186
187 - Fix `exports` syntax for ESM and CommonJS.
188
189 ## [2.3.10-1] - 2023-03-18
190
191 ### Changed
192
193 - Permit SemVer pre-release publication.
194
195 ## [2.3.10-0] - 2023-03-18
196
197 ### Fixed
198
199 - Fix `exports` syntax for ESM and CommonJS.
200
201 ## [2.3.9] - 2023-03-18
202
203 ### Changed
204
205 - Introduce ESM module support along with CommonJS one.
206
207 ### Fixed
208
209 - Fix brown paper bag bug referencing the same object literal.
210
211 ## [2.3.8] - 2023-03-18
212
213 ### Changed
214
215 - Switch internal benchmarking code to benny.
216 - Switch to TypeScript 5.x.x.
217 - Switch rollup bundler plugins to core ones.
218 - Switch to TSDoc syntax.
219 - Enforce conventional commits.
220
221 ### Fixed
222
223 - Fix random integer generator.
224 - Fix worker choice strategy pool type identification at initialization.
225
226 ## [2.3.7] - 2022-10-23
227
228 ### Changed
229
230 - Switch to open collective FOSS project funding platform.
231 - Switch to ts-standard linter configuration on TypeScript code.
232
233 ### Fixed
234
235 - Fixed missing async on pool execute method.
236 - Fixed typing in TypeScript example.
237 - Fixed types in unit tests.
238
239 ## [2.3.6] - 2022-10-22
240
241 ### Changed
242
243 - Cleanup pool attributes and methods.
244 - Refine error types thrown.
245
246 ### Fixed
247
248 - Fix continuous integration build on windows.
249 - Fix code coverage reporting by using c8 instead of nyc.
250
251 ## [2.3.5] - 2022-10-21
252
253 ### Changed
254
255 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
256 - Optimize tasks usage lookup implementation.
257
258 ### Fixed
259
260 - Fix missed pool event emitter type export.
261 - Fix typedoc documentation generation.
262
263 ## [2.3.4] - 2022-10-17
264
265 ### Added
266
267 - Fully automate release process with release-it.
268
269 ### Changed
270
271 - Optimize fair share task scheduling algorithm implementation.
272 - Update benchmarks versus external pools results with latest version.
273
274 ## [2.3.3] - 2022-10-15
275
276 ### Added
277
278 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
279
280 ## [2.3.2] - 2022-10-14
281
282 ### Changed
283
284 - Optimize fair share worker selection strategy implementation.
285
286 ### Fixed
287
288 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
289
290 ## [2.3.1] - 2022-10-13
291
292 ### Added
293
294 - Pool worker choice strategies:
295 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
296 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
297
298 ## [2.2.2] - 2022-10-09
299
300 ### Fixed
301
302 - Fixed `README.md` file.
303
304 ## [2.2.1] - 2022-10-08
305
306 ### Added
307
308 - Dynamic worker choice strategy change at runtime.
309
310 ## [2.2.0] - 2022-01-05
311
312 ### Breaking Changes
313
314 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
315
316 ## [2.1.0] - 2021-08-29
317
318 ### Added
319
320 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
321
322 ### Breaking Changes
323
324 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
325 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
326 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
327 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
328
329 ## [2.0.2] - 2021-05-12
330
331 ### Bug fixes
332
333 - Fix `busy` event emission on fixed pool type
334
335 ## [2.0.1] - 2021-03-16
336
337 ### Bug fixes
338
339 - Check if pool options are properly set.
340 - `busy` event is emitted on all pool types.
341
342 ## [2.0.0] - 2021-03-01
343
344 ### Bug fixes
345
346 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
347
348 ### Breaking Changes
349
350 - `FullPool` event is now renamed to `busy`.
351 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
352 _Find more details on our JSDoc._
353
354 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
355
356 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
357
358 ### Pool options types declaration merge
359
360 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
361
362 #### New `export` strategy
363
364 ```js
365 // Before
366 const DynamicThreadPool = require('poolifier/lib/dynamic')
367 // After
368 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
369 ```
370
371 But you should always prefer just using
372
373 ```js
374 const { DynamicThreadPool } = require('poolifier')
375 ```
376
377 #### New type definitions for input data and response
378
379 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
380 _This is not a limitation by poolifier but NodeJS._
381
382 #### Public property replacements
383
384 `numWorkers` property is now `numberOfWorkers`
385
386 #### Internal (protected) properties and methods renaming
387
388 These properties are not intended for end users
389
390 - `id` => `nextMessageId`
391
392 These methods are not intended for end users
393
394 - `_chooseWorker` => `chooseWorker`
395 - `_newWorker` => `createWorker`
396 - `_execute` => `internalExecute`
397 - `_chooseWorker` => `chooseWorker`
398 - `_checkAlive` => `checkAlive`
399 - `_run` => `run`
400 - `_runAsync` => `runAsync`
401
402 ## [1.1.0] - 2020-05-21
403
404 ### Added
405
406 - ThreadWorker support async functions as option
407 - Various external library patches
408
409 ## [1.0.0] - 2020-01-24
410
411 ### Added
412
413 - FixedThreadPool implementation
414 - DynamicThreadPool implementation
415 - WorkerThread implementation to improve developer experience