### Added
- Add `startWorkers` to pool options to whether start the minimum number of workers at pool creation or not.
-- Add `tasksStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable tasks stealing or not and whether enable tasks stealing on back pressure or not.
+- Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable tasks stealing or not and whether enable tasks stealing on back pressure or not.
- Continuous internal benchmarking: https://poolifier.github.io/benchmark-results/dev/bench.
## [2.6.44] - 2023-09-08
- `size` (optional) - The maximum number of tasks that can be queued on a worker before flagging it as back pressured. It must be a positive integer.
- `concurrency` (optional) - The maximum number of tasks that can be executed concurrently on a worker. It must be a positive integer.
- - `tasksStealing` (optional) - Tasks stealing enablement.
+ - `taskStealing` (optional) - Tasks stealing enablement.
- `tasksStealingOnBackPressure` (optional) - Tasks stealing enablement on back pressure.
- Default: `{ size: (pool maximum size)^2, concurrency: 1, tasksStealing: true, tasksStealingOnBackPressure: true }`
+ Default: `{ size: (pool maximum size)^2, concurrency: 1, taskStealing: true, tasksStealingOnBackPressure: true }`
#### `ThreadPoolOptions extends PoolOptions`
...{
size: Math.pow(this.maxSize, 2),
concurrency: 1,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
},
...tasksQueueOptions
// Send the statistics message to worker.
this.sendStatisticsMessageToWorker(workerNodeKey)
if (this.opts.enableTasksQueue === true) {
- if (this.opts.tasksQueueOptions?.tasksStealing === true) {
+ if (this.opts.tasksQueueOptions?.taskStealing === true) {
this.workerNodes[workerNodeKey].onEmptyQueue =
this.taskStealingOnEmptyQueue.bind(this)
}
*/
readonly concurrency?: number
/**
- * Whether to enable tasks stealing.
+ * Whether to enable task stealing.
*
* @defaultValue true
*/
- readonly tasksStealing?: boolean
+ readonly taskStealing?: boolean
/**
* Whether to enable tasks stealing on back pressure.
*
tasksQueueOptions: {
concurrency: 2,
size: 4,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
},
workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED,
expect(pool.opts.tasksQueueOptions).toStrictEqual({
concurrency: 1,
size: 4,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
})
pool.enableTasksQueue(true, { concurrency: 2 })
expect(pool.opts.tasksQueueOptions).toStrictEqual({
concurrency: 2,
size: 4,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
})
pool.enableTasksQueue(false)
expect(pool.opts.tasksQueueOptions).toStrictEqual({
concurrency: 1,
size: 4,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
})
pool.setTasksQueueOptions({ concurrency: 2 })
expect(pool.opts.tasksQueueOptions).toStrictEqual({
concurrency: 2,
size: 4,
- tasksStealing: true,
+ taskStealing: true,
tasksStealingOnBackPressure: true
})
expect(() =>