Function Compute offers a variety of billing methods, competitive pricing, and fine-grained resource usage monitoring. These features can help you manage resources for serverless applications and reduce resource costs.

Billing methods for Function Compute

Applications have different types of load and require different resource configurations and levels of scalability. Function Compute supports the following billing methods: subscription and pay-as-you-go. You can choose appropriate billing methods to minimize costs in different scenarios.

Your subscription resource quota is shared by all functions in the same region within your Alibaba Cloud account. Function Compute calculates the amount of resources used by all functions each second and deducts the consumed amount from the subscription resource quota. For more information about the subscription and pay-as-you-go billing methods, see Overview. Costs over time

Choose a suitable billing method for your application

Choose a billing method that fits how your application uses resources. For example, if your online application in the production environment is latency-sensitive, you must reserve resources to ensure low latency for the application. In this case, you can use the subscription billing method to reduce costs. In contrast, tests and offline data processing tasks are latency-insensitive but require high throughput. If a large number of tasks must be complete within a specified amount of time, a large amount of resources is temporarily required. In this case, you can use the pay-as-you-go billing method to achieve a balance between resource utilization and costs.

In the Function Compute console, you can view the usage of resources within your Alibaba Cloud account on the Resource Center page. For example, you can view the points in time when your application has stable or flexible resource requirements. This information can help you allocate subscription and pay-as-you-go resources more efficiently. Resource Center - Resource Usage Details

Release idle reserved resources

Function Compute provides fine-grained and multi-dimensional information about resource usage. You can view the information about reserved resources and consumed resources for each function. To reduce costs, you can release idle reserved resources.

The following figure shows that the reserved instances allocated to the function have remained idle for a long amount of time. In this case, you can release these reserved instances to reduce costs. Provisioned Instances

Shift loads and reduce bursts

To handle a large number of requests when the timeline is flexible, you can limit the number of concurrent instances and use asynchronous operations to process the requests. The following figure shows that a more stable resource demand can be covered by subscription resources to a greater extent. This can help reduce costs. Function Compute caches requests in queues and processes the requests at a rate that matches the configured function resource limit. Function Compute also implements load balancing and isolation to prevent functions from affecting each other. To ensure balanced resource usage, you need only to properly set the maximum number of concurrent instances. Shift loads and reduce bursts

Use resources during off-peak hours

Some tasks such as regression tests can be run with flexible timelines. You can run these tasks during off-peak hours. For example, you can run regression tests between 21:00 of the current day and 09:00 of the next day. Function Compute provides triggers for you to run your tasks at scheduled points in time. This way, you can use subscription resources to run tasks at a low cost.

Use resources during off-peak hours