Esta página aún no está disponible en su idioma local. Estamos trabajando arduamente para agregar más versiones de idiomas. Gracias por tu apoyo.
- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Before You Start
- Building Functions
-
Configuring Functions
- Configuring Initialization
- Configuring Basic Settings
- Configuring Agency Permissions
- Configuring the Network
- Configuring Disk Mounting
- Configuring Environment Variables
- Configuring Asynchronous Execution Notification
- Configuring Single-Instance Multi-Concurrency
- Managing Versions
- Managing Aliases
- Configuring Dynamic Memory
- Configuring Heartbeat Function
- Configuring Tags
- Configuring a Log Group and Log Stream
- Online Debugging
- Creating Triggers
- Invoking the Function
- Monitoring
- Function Management
- Dependency Management
- Reserved Instance Management (Old)
- Reserved Instance Management
- Increasing Resource Quota
- CLI Command Reference
- Audit
- Best Practices
- devg
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Examples
- Extension and OpenTelemetry APIs
-
APIs
- Function Invocation
- Function Quotas
- Dependencies
- Test Events
- Function Tracing
-
Function Lifecycle Management
- Querying Functions
- Creating a Function
- Deleting a Function or Function Version
- Querying the Code of a Function
- Modifying the Code of a Function
- Querying the Metadata of a Function
- Modifying the Metadata of a Function
- Updating Max. Instances of a Function
- Querying Function Tags
- Enabling or Disabling the Snapshot Function
- Querying ServiceBridge Functions Bound to a Specified Function
- Querying Snapshot Status
- Querying Resource Tags
- Querying Resources
- Deleting Resource Tags
- Creating Resource Tags
- Updating the Pinning Status of a Function
- Querying the Available ServiceBridge Version
- Versions and Aliases
- Function Metrics
- Function Logs
- Function Templates
- Reserved Instances
- Function Import and Export
- Function Triggers
-
Function Flows
- Executing a Flow Synchronously
- Executing a Flow Asynchronously
- Deleting Flows
- Querying a Flow
- Creating a Flow
- Querying Instances of a Flow
- Querying a Flow Instance
- Querying Metadata of a Flow Instance
- Modifying Metadata of a Flow Instance
- Querying Flow Metrics
- Querying Metrics of a Flow
- Re-executing a Flow
- Stopping a Flow
- Querying Records of a Flow in Pagination Mode
- Calling Back a Flow
-
Asynchronous Execution Notification
- Querying Asynchronous Execution Notification Settings of a Function Version
- Deleting Asynchronous Execution Notification Settings
- Configuring Asynchronous Execution Notification
- Querying Asynchronous Execution Notification Settings of a Function's All Versions
- Querying Asynchronous Invocation Requests
- Querying Active Asynchronous Invocation Requests
- Stopping an Asynchronous Invocation Request
- Permissions Policies and Supported Actions
- Appendix
- Change History
- SDK Reference
-
FAQs
-
General FAQs
- What Is FunctionGraph?
- Do I Need to Apply for Any Compute, Storage, or Network Services When Using FunctionGraph?
- Do I Need to Deploy My Code After Programming?
- How Do I Obtain a Token?
- What Runtimes Does FunctionGraph Support?
- How Much Disk Space Is Allocated to Each FunctionGraph Function?
- Does FunctionGraph Support Function Versioning?
- How Does a Function Read or Write Files?
- How Do I Set a Proxy When Using CLI?
- Does FunctionGraph Support Function Extension?
- Which Permissions Are Required for an IAM User to Use FunctionGraph?
- How Can I Create an ODBC Drive-based Python Dependency Package for Database Query?
- What Is the Quota of FunctionGraph?
- What Chinese Fonts Does FunctionGraph Support?
- How Does FunctionGraph Resolve a Private DNS Domain Name?
- How Does a Container Image–based Function Resolve a Private DNS Domain Name?
- How Do I Use a Domain Name to Access an API Registered with API Gateway (Dedicated)?
- What Are the Common Application Scenarios of FunctionGraph?
- Why Can't the API Gateway Domain Name Bound to a Service Be Resolved During Function Invocation?
- Does FunctionGraph Support Synchronous Transmission at the Maximum Intranet Bandwidth?
- What If the VPC Quota Is Used Up?
- How Can I Print Info, Error, or Warn Logs?
- Can I Set the Domain Name of an API to My Own Domain Name?
- Can I Change the Runtime?
- Can I Change a Function's Name?
- Why Is Message "failed to mount exist system path" Displayed?
- How Do I Obtain Uploaded Files?
- Why Can't I Receive Responses for Synchronous Invocation?
- What Should I Do If the os.system("command &") Execution Logs Are Not Collected?
- Which Directories Can Be Accessed When a Custom Runtime Is Used?
- Which Minor Versions of Python 3.6 and 3.9 Are Supported?
- Which Actions Can Be Used Instead of a VPC Administrator Agency for VPC Access?
- What Are the Possible Causes for Function Timeout?
- How Do I Obtain the Code of a Function?
- Do You Have Sample Code for Initializers?
- How Do I Enable Structured Log Query?
- Can I Enable a Listening Port in a Function to Receive External TCP Requests via EIP?
- Does FunctionGraph Support Domain Name Resolution?
- How Do I Obtain the Source IP Address of an HTTP Request Initiated by a Function?
- Function Creation FAQs
-
Trigger Management FAQs
- What Events Can Trigger a FunctionGraph Function?
- What If Error Code 500 Is Reported When Functions that Use APIG Triggers Return Strings?
- What Do LATEST and TRIM_HORIZON Mean in DIS Trigger Configuration?
- How Do I Use an APIG Trigger to Invoke a Function?
- How Does a Function Obtain the Request Path or Parameters When Using an APIG Trigger?
- Can I Configure a Kafka Trigger in a Different Subnet from My Function?
-
Dependency Management FAQs
- What Is a Dependency?
- When Do I Need a Dependency?
- What Are the Precautions for Using a Dependency?
- What Dependencies Does FunctionGraph Support?
- Does FunctionGraph Support Class Libraries?
- How Do I Use Third-Party Dependencies on FunctionGraph?
- How Do I Create Function Dependencies?
- How Do I Create a Dependency on the FunctionGraph Console?
- How Do I Add a Dependency to a Function?
-
Function Execution FAQs
- How Long Does It Take to Execute a FunctionGraph Function?
- Which Steps Are Included in Function Execution?
- How Does FunctionGraph Process Concurrent Requests?
- What If Function Instances Have Not Been Executed for a Long Time?
- How Can I Speed Up Initial Access to a Function?
- How Do I Know the Actual Memory Used for Function Execution?
- Why Is My First Request Slow?
- What Do I Do If an Error Occurs When Calling an API?
- How Do I Read the Request Header of a Function?
- Can the Synchronous Execution Interface Be Invoked on a Private Network?
- Why Does a Function Use More Memory Than Estimated and Even Trigger the Out of Memory Alarm?
- How Do I Check the Memory Usage When Seeing "runtime memory limit exceeded"?
- How Do I Troubleshoot "CrashLoopBackOff"?
- After I Updated an Image with the Same Name, Reserved Instances Still Use the Old Image. What Can I Do?
- Function Configuration FAQs
- External Resource Access FAQs
-
Other FAQs
- How Do I View the Alarm Rules Configured for a Function?
- Does FunctionGraph Support ZIP Decompiling During Video Transcoding?
- Will Resources Created During FunctionGraph 2.0 OBT Be Automatically Released When They Expire? Will Them Be Billed?
- What Is an App in FunctionGraph?
- Do I Need to Pay for Cold Start Time?
- Why Am I Seeing a Message Indicating that My Account Was Suspended When Creating a Function?
- Will the Requests of All My Functions in Different Regions Be Billed?
- Migration from FunctionGraph V1 to V2
-
General FAQs
Configuring Single-Instance Multi-Concurrency
This feature is supported only by FunctionGraph v2.
Overview
By default, each function instance processes only one request at a specific time. For example, to process three concurrent requests, FunctionGraph triggers three function instances. To address this issue, FunctionGraph has launched the single-instance multi-concurrency feature, allowing multiple requests to be processed concurrently on one instance.
Scenario
This feature is suitable for functions which spend a long time to initialize or wait for a response from downstream services. The feature has the following advantages:
- Fewer cold starts and lower latency: Usually, FunctionGraph starts three instances to process three requests, involving three cold starts. If you configure the concurrency of three requests per instance, only one instance is required, involving only one cold start.
- Shorter processing duration and lower cost: Normally, the total duration of multiple requests is the sum of each request's processing time. With this feature configured, the total duration is from the start of the first request to the end of the last request.
Comparison
If a function takes 5s to execute each time and you set the number of requests that can be concurrently processed by an instance to 1, three requests need to be processed in three instances, respectively. Therefore, the total execution duration is 15s.
When you set Max. Requests per Instance to 5, if three requests are sent, they will be concurrently processed by one instance. The total execution time is 5s.
If the maximum number of requests per instance is greater than 1, new instances will be automatically added when this number is reached. The maximum number of instances will not exceed Max. Instances per Function you set.
Comparison Item |
Single-Instance Single-Concurrency |
Single-Instance Multi-Concurrency |
---|---|---|
Log printing |
- |
To print logs, Node.js Runtime uses the console.info() function, Python Runtime uses the print() function, and Java Runtime uses the System.out.println() function. In this mode, current request IDs are included in the log content. However, when multiple requests are concurrently processed by an instance, the request IDs are incorrect if you continue to use the preceding functions to print logs. In this case, use context.getLogger() to obtain a log output object, for example, Python Runtime. log = context.getLogger() log.info("test") |
Shared variables |
Not involved. |
Modifying shared variables will cause errors. Mutual exclusion protection is required when you modify non-thread-safe variables during function writing. |
Monitoring metrics |
Perform monitoring based on the actual situation. |
Under the same load, the number of function instances decreases significantly. |
Flow control error |
Not involved. |
When there are too many requests, the error code in the body is FSS.0429, the status in the response header is 429, and the error message is Your request has been controlled by overload sdk, please retry later. |
Configuring Single-Instance Multi-Concurrency
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- Choose Configuration > Concurrency.
Set parameters by referring to Table 2 and click Save.Figure 1 Concurrency configuration
Table 2 Description Parameter
Description
Max. Requests per Instance
Number of concurrent requests supported by a single instance. The default value is 1. The value ranges from 1 to 1,000.
Max. Instances per Function
Maximum number of instances in which a function can run. Default: 400. Maximum: 1000. –1: The function can run in any number of instances.
NOTE:
Requests that exceed the processing capability of instances will be discarded.
Errors caused by excessive requests will not be displayed in function logs. You can obtain error details by referring to Configuring Asynchronous Execution Notification.
Configuration Constraints
- For Python functions, threads on an instance are bound to one core due to the Python Global Interpreter Lock (GIL) lock. As a result, concurrent requests can only be processed using the single core, not multiple cores. The function processing performance cannot be improved even if larger resource specifications are configured.
- For Node.js functions, the single-process single-thread processing of the V8 engine results in processing of concurrent requests only using a single core, not multiple cores. The function processing performance cannot be improved even if larger resource specifications are configured.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.