When a client cancels a request, Function Compute starts a new instance and stops the current one. This behavior applies only to CPU functions with a single-instance concurrency of 1. Because an instance at this concurrency level can handle only one request at a time, the platform replaces it to prevent a new request from being scheduled to an instance that is still processing the canceled request, which could corrupt your function logic.
To prevent instance restarts, use one of the following methods:
| Method | Applicable function types | Action |
|---|---|---|
| Configure a health check | All types, including event functions and task functions | Configure instance health checks |
| Increase single-instance concurrency | CPU functions only (not supported for event functions or task functions) | Configure single-instance concurrency |
Method 1: Configure a health check
After you configure instance health checks, the instance no longer restarts when a 499 error occurs. Instance health is then determined solely by your health check configuration. This method works for all function types.
Method 2: Increase single-instance concurrency
Configure single-instance concurrency to allow the instance to handle multiple requests in parallel.
Single-instance concurrency is not supported for event functions or task functions. Use Method 1 for those function types.