Skip to main content
Version: Next

ConcurrencySystemOptions

Index

Properties

optionalautoscaleIntervalSecs

autoscaleIntervalSecs?: number = 10

Defines in seconds how often the system should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1 might have a severe impact on performance. We suggest using a value from 5 to 20.

optionalcurrentHistorySecs

currentHistorySecs?: number = 5

How far back the task-gating decision looks, in seconds — the window used to judge whether the system is overloaded right now, before dispatching one more task. Deliberately shorter than snapshotHistorySecs, so that dispatch reacts to spikes quickly while scaling stays stable.

optionaldesiredConcurrency

desiredConcurrency?: number

The desired number of tasks that should be running parallel on the start of the pool, if there is a large enough supply of them. By default, it is minConcurrency.

optionaldesiredConcurrencyRatio

desiredConcurrencyRatio?: number = 0.90

Minimum level of desired concurrency to reach before more scaling up is allowed.

optionalloadSignals

loadSignals?: LoadSignalsOptions

The signals that tell the system whether the machine is overloaded: per-resource tuning for the built-in four (memory, event loop, CPU, storage backend) plus any custom implementations of your own. See LoadSignalsOptions.

optionallog

optionalloggingIntervalSecs

loggingIntervalSecs?: null | number = null | number

Specifies a period in which the instance logs its state, in seconds. Set to null to disable periodic logging.

optionalmaxConcurrency

maxConcurrency?: number = 200

The maximum number of tasks running in parallel.

optionalmaxTasksPerMinute

maxTasksPerMinute?: number

The maximum number of tasks per minute the system can run. By default, this is set to Infinity, but you can pass any positive, non-zero integer.

optionalminConcurrency

minConcurrency?: number = 1

The minimum number of tasks running in parallel.

WARNING: If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.

optionalscaleDownStepRatio

scaleDownStepRatio?: number = 0.05

Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one.

optionalscaleUpStepRatio

scaleUpStepRatio?: number = 0.05

Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one.

optionalsnapshotHistorySecs

snapshotHistorySecs?: number = 30

How far back the autoscaling decisions look, in seconds — the window the historical system status is evaluated over, and therefore how much history the signals retain (the memory cost of raising it).