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