SCF uses concurrent instances (also called concurrences or instances) to process requests or events.
Currently, an SCF concurrent instance processes only one event at a time, and subsequent events or requests will not be received by the instance if it is still processing the current event and has not received the returned information. When the SCF platform receives sync/async requests and delivers them to a concurrent instance for processing, this logic always applies as detailed below:
If the current number of concurrent instances of a function is insufficient to process request events, the SCF platform will start new ones to process them.
The maximum expansion speed of new concurrent instances in a region under one account is 500 instances/minute, that is, up to 500 new concurrent instances can be started in one minute. If the limit is reached in one minute, no more new instances will be started until the minute elapses, during which a limited expansion error will occur if new instance expansion requests are initiated.
After a concurrent instance processes a request event, it will not be repossessed immediately; instead, it will be retained for a certain period of time. During the retention duration, if there are new request events that need to be processed, the retained concurrent instance will be used first, so the events can be processed quickly with no need to wait for start of new concurrent instances. The concurrent instance retention duration is dynamically adjusted by the SCF platform as needed; therefore, you cannot assume a certain retention duration when writing the function business code.
When a concurrent instance of a function is processing actual requests, it will be marked as running concurrent instance. In SCF monitoring information, you can query the running concurrent instances of a function, a specific function version, or an alias. As there are certain intervals in running instance information collection, if a function's execution time is very short and its number of concurrent instances is high, the current monitoring data may not be completely accurate.