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

Instance types

  • Elastic instance: the basic instance type of Function Compute. Elastic instances are suitable for scenarios in which traffic spikes occur, such as big events, large promotions, and red envelope snatching scenarios.
  • Performance instance: a type of instance that has high specifications and resource limits. Performance instances are suitable for compute-intensive scenarios, such as audio and video processing, AI modeling, and enterprise-level Java applications.

    If you select a performance instance, your functions are executed on an instance that has stronger computing power.

Instance specifications

  • Elastic instances

    The following table describes the specifications of elastic instances. You can select instance specifications based on your business requirements.

    Memory size (MB) Maximum package size (MB) Maximum execution duration of functions (s) Maximum disk size (MB) Maximum bandwidth (Gbit/s)
    128 100 86,400 512 1
    256 100 86,400 512 1
    512 100 864,00 512 1
    1,024 100 86,400 512 1
    2,048 100 86,400 512 1
    3,072 100 86,400 512 1
  • Performance instances

    The following table describes the specifications of performance instances. You can select instance specifications based on your business requirements.

    Number of CPU cores Memory size (GB) Maximum package size (MB) Maximum execution duration of functions (s) Maximum disk size (GB) Maximum bandwidth (Gbit/s)
    2 4 500 86,400 10 1
    4 8 500 86,400 10 1.5
    8 16 500 86,400 10 2.5
    16 32 500 86,400 10 5

For more information, see Limits on resource usage.

Usage notes

Performance instances are less scalable than elastic instances because performance instances have higher specifications. If your business requires performance instances and you want to reduce the amount of time consumed by a cold start or improve resource utilization, we recommend that you use the following solutions:

  • Provisioned mode: the most suitable solution to resolve the cold start issue of performance instances. You can reserve a fixed number of instances based on your resource budget, reserve resources for a specified period of time based on business fluctuations, or use an auto scaling solution based on usage thresholds. In provisioned mode, the cold start latency can be significantly reduced when performance instances are used.
  • Single instance for concurrent requests: the most suitable solution to improve resource utilization of performance instances. You can use a single instance to process concurrent requests. This way, the CPU or memory resources are preemptively shared to improve resource utilization when multiple tasks are executed on one instance at the same time.

Instance modes

Performance instances and elastic instances support the following modes:

  • On-demand mode

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

    • Execution duration of functions by a single instance for individual requests
      When an on-demand instance processes a single request at a time, the execution duration starts when the request arrives at the instance and ends when the request is completely executed. instanceconcurrency=1
    • Execution duration of functions by a single instance for concurrent requests

      When an on-demand instance concurrently processes multiple requests, the execution duration starts when the first request arrives at the instance and ends when the last request is completely executed. You can reuse resources to concurrently process multiple requests. This way, resource costs are reduced.

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

References