All Products
Search
Document Center

Function Compute (2.0):Overview

Last Updated:Sep 01, 2023

When you invoke a function in asynchronous mode, the request is persisted to the internal queue of Function Compute before it is processed in a reliable manner. If you want to track and save the states of asynchronous invocations in each phase to obtain better task control capabilities and observability, you can enable the task mode to process asynchronous requests. This topic describes the background information, limits, and common features of asynchronous tasks.

Background

After you enable the asynchronous task feature, you can obtain the following capabilities:

  • The system records detailed status transition information of each invocation, such as invocation inputs, execution results, and error messages.

  • You can manage each invocation. For example, you can terminate an invocation.

Latency is increased for function invocations and executions when the asynchronous task feature is enabled because status information needs to be saved. The increased latency does not cause additional fees. For more information about the billing of Function Compute, see Billing overview.

Limits

  • Scenario limits

    Although the asynchronous task feature provides more capabilities, more system overheads are incurred. We recommend that you disable the asynchronous task feature in the following scenarios:

    • Your business applications are sensitive to the latencies of request processing links and require the average latency to be less than 100 milliseconds.

    • You need to initiate at least thousands of asynchronous invocations per second.

  • Limits on regions

    Asynchronous tasks are supported in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Hong Kong), Singapore, UK (London), US (Silicon Valley), US (Virginia), Germany (Frankfurt), Australia (Sydney), India (Mumbai), Japan (Tokyo), and South Korea (Seoul).

  • Validity period

    You can query task information only of the past seven days.

Feature comparison

If you want to build an asynchronous task processing platform or run simple scheduled tasks, you can use Kubernetes jobs. The following is a comparison between asynchronous tasks of Function Compute and Kubernetes jobs.

Item

Asynchronous tasks of Function Compute

Kubernetes jobs

Supported scenarios

Real-time tasks that last tens of milliseconds and offline tasks that last tens of hours.

Offline tasks with low requirements on the task submission speeds, fixed task loads, and low requirements on timeliness.

Observability

Supported. Metrics, such as logs and the number of queued tasks, and the observability capabilities, including the query of task link durations and task status, are provided.

You must integrate open source software to implement the observability capabilities.

Automatic scaling of task instances

Supported. Automatic scaling based on the number of queued tasks and instance resource usage can be performed.

You must use task queues to manually implement scaling and load balancing of instances, which is more complicated.

Scaling speed of task instances

In milliseconds.

In minutes.

Resource utilization of task instances

You need to only select the instance type. The instances are automatically scaled. You are charged based on the actual task-processing durations. The resource utilization is high.

You must determine the specifications and number of instances when jobs are submitted. It is difficult to implement auto scaling and load balancing of instances. The resource utilization is low.

Task submission speed

A single user can submit tens of thousands of tasks per second.

Up to hundreds of Jobs can be started in a cluster per second.

Scheduled or deferred task submission

Supported.

Scheduled task submission is supported. Deferred task submission is not supported.

Task deduplication

Supported.

Not supported.

Task termination

Supported.

Supported under specific conditions. You can terminate a task by terminating a task instance.

Task throttling

Supported. Throttling can be performed at different granularities, such as at the user level or at the task-processing function level.

Not supported.

Automatic result callback for a task

Supported.

Not supported.

Development and O&M costs

You need to only implement the processing logics of tasks.

You must maintain the Kubernetes cluster.

Common features

See the following topics to learn about common features of asynchronous tasks: