Skip to main content

Worker Function Configuration

Worker function meta information configuration is described in JSON format, and the specific fields are as follows:

namestringWorker function name, which is used to identify the specific Worker function when calling
urlstringWorker function code package address, the format is zip, supports http(s) remote address and file local address
signaturestringCode package signature, used to determine the validity of the code package and whether there is an update
runtimestringRuntime type, optional values: nodejs-v16 (v16.15.1), aworker
handlerstringWorker function entry, only valid when the runtime is nodejs-v16
initializerstringInitialize Worker function entry, only valid when runtime is nodejs-v16
sourceFilestringWorker function execution file name, only valid when runtime is aworker
namespacestring, optionalResource space, used when sharing resources among multiple Worker functions
workerWorkerConfig, optionalWorker Function instance configuration
environmentsEnvironment[], optionalWorker Environment variables required by the function
resourceLimitResourceLimit, optionalWorker Functions can use resource limits
rateLimitRateLimit, optionalWorker Function current limiting configuration

Worker Function instance configuration

The following configurations are optional

shrinkStrategystringShrinking strategy, the default value is LCC, optional values: FILO (create first and then destroy), FIFO (create first and destroy first), LCC (destruct minimum current concurrency)
initializationTimeoutnumberInitialization timeout, default 10s
maxActivateRequestsnumberThe maximum number of simultaneous execution requests, the default is 10
reservationCountnumberThe number of reserved instances, the default is 0
replicaCountLimitnumberMaximum number of instances, default is 10
fastFailRequestsOnStartingbooleanWhether to return an error directly when the worker instance fails to start, otherwise wait for an available instance until the timeout, the default is true
v8Optionsstring[]v8 parameters
execArgvstring[]aworker execution parameters
disposablebooleanWhether to use the disposable mode, the default is false

environment variable

The format is as follows:

key: string;
value: string;

Specify the environment variables required by the Worker instance, such as:

"environments": [
"key": "NODE_ENV",
"value": "production"

Resource Limits

The following configurations are optional

memorynumberThe upper limit of available memory for each worker instance, the default is 500MB
cpunumberAvailable CPU time per worker instance

Current limiting configuration

The following configurations are optional, and the token bucket mode is used for current limit:

maxTokenCountnumberMaximum number of tokens available
tokensPerFillnumberNumber of tokens per fill
fillIntervalnumberToken Fill Interval