This topic describes how to use the SDK to specify the instance concurrency for a specified function.

SDK code samples

The following sample code uses SDK for Node.js as an example to specify the instance concurrency for a function:

// create function
var resp = await client.createFunction(serviceName, {
    functionName: funcName,
    handler: 'counter.handler',
    memorySize: 512,
    runtime: 'nodejs10',
    code: {
        zipFile: fs.readFileSync('/tmp/counter.zip', 'base64'),
    },
    instanceConcurrency: 10,
});

// update function
var resp = await client.updateFunction(serviceName, funcName, {
    instanceConcurrency: 20,
});

// get function
var resp = await client.getFunction(serviceName, funcName);