tencent cloud

Serverless Cloud Function

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Related Concepts
How It Works
Strengths
Scenarios
Related Products
Purchase Guide
Billing Overview
Billing Mode
Billable Items and Billing Modes
Function Computing Power Support
Free Tier
SCF Pricing
Billing Example
Payment Overdue
Getting Started
Creating Event Function in Console
User Guide
Quota Management
Managing Functions
Web Function Management
Log Management
Concurrence Management
Trigger Management
Function URL
A Custom Domain Name
Version Management
Alias Management
Permission Management
Running Instance Management
Plugin Management
Managing Monitors and Alarms
Network Configuration
Layer Management
Execution Configuration
Extended Storage Management
DNS Caching Configuration
Resource Managed Mode Management
Near-Offline Resource Hosting Model
Workflow
Triggers
Trigger Overview
Trigger Event Message Structure Summary
API Gateway Trigger
COS Trigger
CLS Trigger
Timer Trigger
CKafka Trigger
Apache Kafka Trigger
MQTT Trigger
Trigger Configuration Description
MPS Trigger
CLB Trigger Description
TencentCloud API Trigger
Development Guide
Basic Concepts
Testing a Function
Environment Variables
Dependency Installation
Using Container Image
Error Types and Retry Policies
Dead Letter Queue
Connecting SCF to Database
Automated Deployment
Cloud Function Status Code
Common Errors and Solutions
Developer Tools
Serverless Web IDE
Calling SDK Across Functions
Third-Party Tools
Code Development
Python
Node.js
Golang
PHP
Java
Custom Runtime
Deploying Image as Function
Web Framework Development
Deploying Framework on Command Line
Quickly Deploying Egg Framework
Quickly Deploying Express Framework
Quickly Deploying Flask Framework
Quickly Deploying Koa Framework
Quickly Deploying Laravel Framework
Quickly Deploying Nest.js Framework
Quickly Deploying Next.js Framework
Quickly Deploying Nuxt.js Framework
Quickly Deploying Django Framework
Use Cases
Overview
Solutions with Tencent Cloud Services
Business Development
TRTC Practices
COS Practices
CKafka Practice
CLS
CLB Practice
MPS
CDN
CDWPG
VOD
SMS
ES
Scheduled Task
Video Processing
Success Stories
Tencent Online Education
Online Video Industry
Tencent Online Education
Best Practice of Tencent IEG Going Global
API Documentation
History
Introduction
API Category
Making API Requests
Other APIs
Namespace APIs
Layer Management APIs
Async Event Management APIs
Trigger APIs
Function APIs
Function and Layer Status Description
Data Types
Error Codes
SDK Documentation
FAQs
General
Web Function
Billing FAQs
Network FAQs
Log FAQs
SCF utility class
Event Handling FAQs
API Gateway Trigger FAQs
Related Agreement
Service Level Agreement
Contact Us
Glossary

Provisioned Concurrency

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2024-12-02 20:07:18
Provisioned concurrency can start concurrent instances in advance according to the configuration. SCF will not repossess these instances proactively; instead, it will ensure as much as possible that a corresponding number of concurrent instances are available to process requests.
The provisioned concurrency is version-specific. When it's set, the requested computing resources are prepared in advance to shorten the time required for cold start, and initialization of runtime environment and business code.

Overview

Provisioned concurrency is a version-level configuration. When it’s configured for a function version, the following happen:
1. SCF immediately launches instances until the configured value is reached.
2. SCF does not repossess provisioned concurrent instances proactively. Instead, it guarantees the number of provisioned concurrent instances as much as possible.
The speed of launching instances for provisioned concurrency defaults to 100 instances per minute. This has nothing to do with the speed for launching instances for elastic invocation. It does not count toward the quota of 500 concurrent instances/minute at the region level.
SCF does not repossess provisioned concurrent instances proactively. However, concurrent instances can become unavailable due to exiting the process or exceeding the memory limit. Once an instance becomes unavailable, it is released and a new instance is launched to meet the requirement of the provisioned concurrency configuration. During this period, the number of actual concurrent instances may be temporarily smaller than the number of provisioned concurrent instances. Concurrent instances do not incur charges when they are not launched. You can check the status of provisioned concurrency in number of concurrent executions and provisioned concurrency in the function monitoring data.
For the service stability and version consistency, provisioned concurrency can be configured only on published versions, but not the $LATEST version. For more information, see Version Management.

Provisioned Concurrency and Concurrency Management

Setting up the provisioned concurrency can speed up function initialization. However, the provisioned concurrency has nothing to do with the concurrency capability. It does not affect the maximum number of concurrent requests a function can process, which depends entirely on the function's reserved quota or region-level concurrency quota.
A function version with 128 MB memory is taken as an example below:
Scenario
Average concurrency
Provisioned concurrency
Function reserved quota
Result
Default
100 concurrent instances
Not configured
Not configured
All concurrent instances need to be initialized when they process requests for the first time. The concurrency quota of the function is affected by other functions under the same account and may be exceeded.
Function disabled
100 concurrent instances
Not configured
0 MB (0 concurrent instances)
The reserved quota is 0, the function is disabled, and all requests will get an overrun error.
No provisioned concurrency required
100 concurrent instances
Not configured
19,200 MB (150 concurrent instances)
All concurrent instances need to be initialized when they process requests for the first time. 150 concurrent instances can be guaranteed, and an overrun error will occur if this limit is exceeded.
80% provisioning
100 concurrent instances
10,240 MB (80 concurrent instances)
19,200 MB (150 concurrent instances)
80 concurrent instances don't need to be initialized, and 20 concurrent instances need to be initialized when they are invoked for the first time. 150 concurrent instances can be guaranteed, and an overrun error will occur if this limit is exceeded.
100% provisioning
100 concurrent instances
12,800 MB (100 concurrent instances)
19,200 MB (150 concurrent instances)
100 concurrent instances don't need to be initialized, and excessive concurrent instances need to be initialized when they are invoked for the first time. 150 concurrent instances can be guaranteed, and an overrun error will occur if this limit is exceeded.
Full provisioning
100 concurrent instances
19,200 MB (150 concurrent instances)
19,200 MB (150 concurrent instances)
All concurrent instances don't need to be initialized. 150 concurrent instances can be guaranteed, and an overrun error will occur if this limit is exceeded.
Overprovisioning
100 concurrent instances
25,600 MB (200 concurrent instances)
19,200 MB (150 concurrent instances)
It is the same as full provisioning except that it incurs additional fees for 50 more provisioned concurrent instances.
The concurrency management system (region-level concurrency quota and function-level reserved quota) is responsible for processing requests concurrently, while provisioned concurrency is responsible for ensuring that there are concurrent instances available to process requests. The decoupling of the two can implement capabilities such as traffic switch with no initialization process.

Provisioned Concurrency Limits

The configured provisioned concurrency quota is subject to the account-level quota; in other words, the total provisioned concurrency quotas of all versions of all functions in a region is less than or equal to the concurrency quota at the account level.

Directions

Adding provisioned concurrency

For a published function version, you can set a desired number of provisioned concurrent instances.
1. Log in to the SCF console and select Functions on the left sidebar.
2. On the Functions list page, select the name of the target function to enter the Function management page.
3. Select Concurrency quota from the left, go to the Provisioned concurrency page and click Add provisioned concurrency.
4. In the Add provisioned function concurrency window that pops up, select the target version, set the number of provisioned concurrent instances and click Submit. After completing the settings, you can view the configuration status in Provisioned Concurrency.

Updating provisioned concurrency

You can modify the number of concurrent instances as needed.
1. Log in to the SCF console and select Functions on the left sidebar.
2. On the Functions list page, select the name of the target function to enter the Function management page.
3. On the Concurrency quota page, select Set on the right of the target version.
4. In the Configure provisioned function concurrency window that pops up, update the value and click Submit. After the settings are completed, SCF will adjust the number of concurrent instances according to your modification in a certain period of time.

Deleting provisioned concurrency

You can delete a provisioned concurrency configuration if you don’t need to use it.
1. Log in to the SCF console and select Functions on the left sidebar.
2. On the Functions list page, select the name of the target function to enter the Function management page.
3. Select Concurrency quota from the left, go to the Provisioned concurrency page, locate the version you want to delete and click Delete.
4. In the Delete provisioned function concurrency window that pops up, click OK. After the configuration is deleted, concurrent instances are released gradually.

More

Using provisioned concurrency for traffic switch

You can set the reserved quota for a function based on the volume of concurrent business requests and configure the provisioned concurrency based on the traffic switch needs as instructed below:
1. Publish a new version.
2. Set the desired provisioned value for the new version.
3. Wait for the provisioned concurrent instances of the new version to be started completely.
4. Gradually switch the traffic from the previous version to the new version through traffic routing configuration. If a problem occurs, switch the traffic back to the previous version.
5. Switch the traffic completely to the new version and delete the provisioned concurrency of the old version if nothing goes wrong after a period of time.
In the example below, the reserved quota of the function is 150 concurrent instances, which means the function can concurrently process up to 150 requests. You can set 100 provisioned concurrent instances for multiple versions (100 instances are started for each version), so as to switch the traffic with no initialization needed.
Scenario
Average Business Concurrency
Provisioned Concurrency
Function Reserved Quota
Effect
100% provisioning
100 concurrent instances
12,800 MB (100 concurrent instances)
19,200 MB (150 concurrent instances)
100 concurrent instances don't need to be initialized, and excessive concurrent instances need to be initialized when they are invoked for the first time. 150 concurrent instances can be guaranteed, and an overrun error will occur if this limit is exceeded.
As shown in the figure below, 100 provisioned concurrent instances is configured for both version 4 and version 5, and you can use the traffic grayscale capability to switch the 100 concurrent instances of the business from version 4 to version 5. No matter how the 100 concurrent instances are allocated to versions 4 and 5 according to any proportion, no instances will need to be initialized, thus making it easier for you to publish a version and switch traffic more quickly.




Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan