Reserved Instance Management
Introduction
FunctionGraph provides on-demand and reserved instances.
- On-demand instances are created and released by FunctionGraph based on actual function usage. When receiving requests to call functions, FunctionGraph automatically allocates execution resources to the requests.
- Reserved instances can be created and released by you as required. After you create reserved instances for a function, FunctionGraph preferentially forwards requests to the reserved instances. If the number of requests exceeds the processing capability of the reserved instances, FunctionGraph will forward the excessive requests to on-demand instances and automatically allocates execution resources to these requests.
After reserved instances are created for a function, the code, dependencies, and initializer of the function are automatically loaded. Reserved instances are always alive in the execution environment, eliminating the influence of cold starts on your services. (Do not execute one-time services using the initializer of reserved instances.)
You can configure a fixed number of reserved instances or scheduled and intelligent recommendation policies.
Configuring a Fixed Number of Reserved Instances
Ensure that the function for which you want to create reserved instances already exists on the FunctionGraph console.
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the target function to go to the details page.
- Choose Configuration > Concurrency, and click Add.
Figure 1 Clicking Add
- Set parameters by referring to Table 1.
You can create a specified number of reserved instances for a function version or alias. This number cannot exceed the maximum number of requests per instance or the maximum number of instances per function.Figure 2 Basic settings
Table 1 Basic settings Parameter
Description
Function Name
Name of the current function.
Type
Select Version or Aliases.
Version
Set this parameter when you select Version for Type.
Alias
Set this parameter when you select Aliases for Type.
Min. Instances
Minimum number of instances. Max.: 1000. FunctionGraph reserves the specified number of instances for the function. These instances will always run unless you change Min. Instances to 0.
Idle Mode
This mode saves costs as CPU resources are not used when reserved instances are not invoked.
- Reserved instances cannot be configured for both a function alias and the corresponding version. For example, if the alias of the latest version is 1.0 and reserved instances have been configured for this version, no more instances can be configured for alias 1.0.
- After the idle mode is enabled, reserved instances are initialized and the mode change needs some time to take effect. You will still be billed at the price of reserved instances for non-idle mode in this period.
- If the function concurrency is greater than the number of reserved instances, the excess requests will be allocated to on-demand instances, which involve a cold start.
- Click OK. The new policy is displayed in the reserved instance policy list.
Figure 3 Policy list
Configuring a Scheduled Scaling Policy
Configure the number of reserved instances that will run in a specified period and a cron expression. During this period, FunctionGraph adjusts the number of reserved instances based on the cron expression. When the period expires, the fixed number of instances will be reserved.
- Configure the basic settings by referring to Table 1, and then click Add Policy.
Figure 4 Clicking Add Policy
- Set parameters by referring to Table 2.
Table 2 Scheduled scaling policy parameters Parameter
Description
Policy Name
Policy name.
Cron Expression (UTC)
Set this parameter by referring to Cron Expressions for a Function Timer Trigger.
Validity
Local time when the cron expression is effective.
The scheduled scaling policy is effective only during this validity period. In other time, the Min. Instances in the basic settings is used.
Min. Instances
The number of reserved instances to be created when the policy is effective.
Set a number that meets your service requirements.
NOTE:The number must be greater than or equal to the Min. Instances in the basic settings.
- Click OK. The new policy is displayed in the reserved instance policy list.
Figure 5 Policy list
- To modify the reserved instance policy, click Edit in the Operation column. Then modify or add scheduled scaling policies.
- To delete a reserved instance policy under a function version or alias, click Delete in the Operation column.
- To view concurrent instances, click a quantifier in the reserved instance policy list, and click a scheduled scaling policy name.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot