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