Function Compute provides two types of instances: performance instances and elastic instances. This topic compares the two types of instances and describes the specifications, usage notes, usage modes, and billing methods of the two types of instances.

Instance types

  • Elastic instance: the basic instance type of Function Compute. Elastic instances have specifications lower than those of performance instances. Elastic instances are applicable to burst traffic scenarios, such as activities, large promotions, and red envelope snatching.
  • Performance instance: an instance type that has higher specifications. Function Compute provides multiple specifications with more resources allowed for performance instances. Therefore, performance instances are applicable to more scenarios than elastic instances.

For more information, see Limits on resource usage.

You can specify the instance type and specifications when you create or modify a function. For more information, see Create a function and Modify a function. If you select a performance instance, your functions are executed on an instance with stronger computing power.

Instance specifications

  • Elastic instance
    Memory size (MB) Maximum package size (MB) Maximum execution duration of functions (s) Disk size (MB)
    128–3,072 50 900 512
  • Performance instance

    The following table describes the specifications provided by Function Compute for performance instances. You can select instance specifications based on your business requirements.

    Number of CPU cores Memory size (GB) Package size (MB) Execution duration of functions (s) Disk size (GB) Bandwidth (Gbit/s)
    2 4 500 7,200 10 1
    4 8 500 7,200 10 1.5
    8 16 500 7,200 10 2.5
    16 32 500 7,200 10 5

Usage notes

  • Prerequisites for using performance instances

    You must create a virtual private cloud (VPC) before you can use performance instances. To create a VPC, contact the technical support.

  • Limits on switching the instance type

    If you switch the instance type without risk assessment, function errors may occur. To prevent such errors, Function Compute allows you to switch the instance type only from the elastic instance to the performance instance when you modify a function.

  • Combination of instance types for reduced cold start time
    Compared with elastic instances, performance instances scale out slowly and have inferior elastic scalability. If long execution duration, a large amount of CPU resources, fast cold start, and cost-effectiveness are required, you can use a combination of performance instances and other features, such as multiple requests, provisioned instances, and subscriptions.
    • Performance instances: provide long execution duration of functions, large package size, and specific CPU resources. For more information, see Instance specifications.
    • Multiple requests: use the same instance based on well-defined CPU and memory capacity for multiple requests to reduce costs. For more information, see A single instance that concurrently processes multiple requests.
    • Provisioned instances: reduce the cold start time. For more information, see Overview.
    • Subscriptions: offset the fees for instances that are provisioned for a long period of time. This billing method reduces costs. For more information, see Overview.
  • Cold start feedback for performance instances
    Issues related to cold start may occur in scenarios in which scale-out is required, such as sparse invocations and increasing loads. A cold start takes hundreds of milliseconds on elastic instances, whereas it takes dozens of seconds to minutes on performance instances. To prevent slow response speed caused by long cold start time, Function Compute returns the status of performance instances to you within a short period of time. invoke response

Instance usage modes

Performance instances and elastic instances support the following usage modes:

  • On-demand mode

    In on-demand mode, Function Compute automatically allocates and releases instances for functions. In this mode, the execution duration starts from the time when a request is sent to execute a function and ends when the request is executed. An on-demand instance can process a single request at a time or concurrently process multiple requests. For more information, see A single instance that concurrently processes multiple requests.

    • Execution duration of functions by a single instance that processes a single request at a time
      When an on-demand instance processes a single request, the execution duration is calculated from the time when the request arrives at the instance to the time when the request is executed. instanceconcurrency=1
    • Execution duration of functions by a single instance that concurrently processes multiple requests

      When an on-demand instance concurrently processes multiple requests, the execution duration is calculated from the time when the first request arrives at the instance to the time when the last request is executed. You can reduce costs by reusing resources to concurrently process multiple requests.

      instanceconcurrency>1
    Notice In pay-as-you-go mode, the execution duration of functions by on-demand performance instances and that by on-demand elastic instances are billed at different granularities.
    • Elastic instances: The billing granularity is 1 millisecond.
    • Performance instances: The billing granularity is 1 millisecond. If the execution duration is less than 1 minute, it is billed as 1 minute. For example, if the execution duration of functions by an on-demand performance instance is 51 milliseconds, the execution duration is billed as 1 minute. If the execution duration is 60,001 milliseconds, it is billed as 60,001 milliseconds.
  • Provisioned mode
    In provisioned mode, you allocate, release, and manage instances. For more information, see Overview. In this mode, the execution duration starts from the time when Function Compute starts a provisioned instance and ends when you release the instance. Therefore, regardless of whether the provisioned instance executes requests, you are charged for the instance until you release the instance. On-Demand Resources
    Notice In pay-as-you-go mode, the execution duration of functions by provisioned performance instances and that by provisioned elastic instances are both billed at the granularity of 1 second. If the execution duration is less than 1 minute, it is billed as 1 minute. For example, if the execution duration of functions by a provisioned instance is 51 seconds, the execution duration is billed as 1 minute. If the execution duration is 61 seconds, it is billed as 61 seconds.

Billing methods

For more information about the billing methods, see the following topics:

References