A synchronous invocation is one way to invoke a function. When you invoke a function synchronously, the event directly triggers the function, and Function Compute runs the function and waits for a response. After the invocation is complete, Function Compute returns the execution results directly to you, such as the response, execution summary, and log output. This topic describes the scenarios and limits of synchronous invocations.
Scenarios
Use a synchronous invocation when you need to immediately execute a function and directly return the result.
Limits
By default, the total number of instances in a single region is limited to 100 for a single Alibaba Cloud account (primary account). The actual value prevails in Quota Center. To increase this limit, submit a request in Quota Center.
You can observe throttling behavior by using the related metric (throttles) of a function in the CloudMonitor console.
Concurrency
Concurrency refers to the number of times that your function code runs concurrently at any specified time. You can use the following formula to estimate the number of concurrent function invocations:
Number of concurrent invocations = Request rate × Function execution duration
-
Request rate: the rate at which the function is invoked, that is, the number of requests per second or the number of events per second.
-
Function execution duration: the period from when a function request reaches an instance to when the request is executed. Unit: seconds.
For example, a function that processes Alibaba Cloud Object Storage Service (OSS) events has an average execution duration of 3 seconds, and OSS publishes 10 events per second. Based on the formula, the function has 30 concurrent executions.
The number of concurrent function executions affects your billing. For more information about billing, see Billing overview.