Functions can be invoked in synchronous mode. If you invoke a function in synchronous mode, an event directly triggers the function, and Function Compute executes the function and waits for a response. After the function is invoked, Function Compute directly returns the execution details, such as execution results, execution summary, and logs. This topic describes the scenarios and limits of synchronous invocations.
Scenarios
During a synchronous invocation, results are directly returned after an event is processed by a function. Synchronous invocations are applicable to a wide range of scenarios, including but not limited to the following scenarios:
The execution result must be viewed at the earliest opportunity.
The function to be invoked is configured with an HTTP trigger.
Limits
By default, each Alibaba Cloud account can run up to 100 instances in each region. The actual quota displayed on the General Quotas page in the Quota Center console prevails. You can increase the quota in the Quota Center console.
You can use the throttling metrics of functions to observe throttling behaviors in the CloudMonitor console.
Execution concurrency
Execution concurrency indicates the number of concurrent invocations of a function in a period of time. You can use the following formula to estimate the execution concurrency:
Execution concurrency = Request rate × Function execution duration
The request rate is the number of requests or events per second for a function.
The function execution duration starts when a request arrives at the instance and ends when the request is completely executed. Unit: seconds.
For example, you have a function that processes Object Storage Service (OSS) events. The average execution duration for the function is 3 seconds, and 10 OSS events are generated per second. The execution concurrency for your function is 30.
Execution concurrency affects billing on your functions. For more information about billing, see Billing overview.