All Products
Search
Document Center

Function Compute:Function type selection

Last Updated:Sep 05, 2025

To meet user needs in different scenarios, Function Compute provides four types of functions: event functions, web functions, task functions, and GPU functions. This topic describes the applicable scenarios and differences of the function types supported by Function Compute to help you make a well-informed decision.

Overview

When using Function Compute, you can choose the appropriate function type and runtime based on your business scenario and technology stack preference.

  • For web applications and API services, you can use web functions combined with Custom Runtime. This function supports various popular web application frameworks and can be accessed through a browser or directly invoked by a URL.

  • For scenarios such as file processing and data stream processing, it is recommended to use event functions combined with Built-in Runtime. You can configure event triggers and integrate various Alibaba Cloud products such as Object Storage Service, ApsaraMQ for RocketMQ, and Simple Log Service.

  • For model inference scenarios such as chatbots and text-to-image, you can use GPU functions combined with Custom Container. Based on container images of popular AI projects such as ComfyUI, RAG, and TensorRT, you can quickly build AI model inference services.

  • For scenarios of scheduled tasks and audio and video transcoding such as asynchronous tasks, it is recommended to use task functions combined with Built-in Runtime.

For detailed information about function types and runtimes, see the table below.

Note
  • Built-in Runtime and Custom Runtime are both deployed to functions in the form of code packages. If containerized deployment is required, you can also choose Custom Container as the runtime.

  • GPU Functions only support using Custom Container as the runtime.

Selection analysis

Comparison

Comparison item

Event Function

Web Function

Task Function

GPU Function

Features

Used for processing files and data streams. It can be triggered by events from various Alibaba Cloud services. For more information, see Overview, ApsaraMQ for Kafka triggers, and Simple Log Service triggers.

Supports popular web application frameworks and can be accessed through a browser or invoked by using a URL.

Used for processing asynchronous requests and can track and save the states of an asynchronous invocation in each phase.

Supports container images of popular AI projects such as Stable Diffusion WebUI, ComfyUI, RAG, and TensorRT to quickly build AI model inference services.

Applicable scenarios

  • Integration with other Alibaba Cloud services: real-time file processing with Object Storage Service (OSS), log processing with Simple Log Service, and more

  • ETL data transformation: database data cleansing, message queue processing, and more

  • Quickly building applications with popular web frameworks: SpringBoot, Express, Flask, and more

  • Migrating existing applications: HTML5 websites, REST APIs, BFF, mobile apps, miniapps, game settlements, and more.

  • Regular tasks: scheduled, periodic, script tasks, and more

  • Multimedia processing: audio and video transcoding, live recording, image editing, and more

  • Traditional online inference: computer vision (CV) recognition, natural language processing (NLP), and more

  • AIGC model inference: Text-to-text, text-to-image, text-to-audio, and more

Runtime

Recommended: built-in runtime

Recommended: custom runtime

Recommended: built-in runtime

Only supporting Custom Container runtimes

Asynchronous task

Disabled by default

Disabled by default

Enabled by default

Disabled by default

Note

If you need to enable asynchronous tasks for an existing function, you can follow the steps in Manage tasks.

Function runtime selection

Comparison item

Built-in Runtime

Custom Runtime

Custom Container

Development workflow

Write handlers based on the interfaces defined by Function Compute.

Develop web applications based on framework templates and observe the results in real time through a public endpoint.

Upload custom images to Alibaba Cloud Container Registry, or use images that are already available in the Registry.

Supported instance types

CPU instances

CPU instances

CPU instances and GPU-accelerated instances

Single instance multiple concurrency

Not supported

Supported

Supported

Cold start

Shortest. The runtime is not included in the code package, leading to faster response time.

Short. The code package is an HTTP server, which is relatively large but does not require image pulling, resulting in a short cold start.

Relatively long. Image pulling results in a relatively long cold start.

Code deliverable format

ZIP, JAR (Java), and folder

Container image

Code deliverable size limitations

Some regions (such as Hangzhou) have a maximum of 500 MB, while other regions have a maximum of 100 MB.

Note

You can configure layers to add dependencies and reduce the size of the code package.

  • The size of an uncompressed CPU instance image cannot exceed 10 GB.

  • The size of an uncompressed GPU-accelerated instance image cannot exceed 15 GB.

Note

For AI inference applications, you can store large models in NAS or OSS to reduce the image size.

Supported programming languages

Node.js, Python, PHP, Java, C#, Go

No limits

No limits

Create functions via the console

Event function

If you want to invoke associated functions through event triggers such as OSS triggers, Kafka triggers, and SLS triggers, create event functions and use a built-in runtime.

image

Web function

If you want to write programs based on popular frameworks in various languages such as Java SpringBoot, Node.js Express, Python Flask, and Golang Gin, create web functions and use a custom runtime.

image

Task function

If you want to initiate asynchronous invocations for functions and need to track and save the states of each phase of the asynchronous invocation, create task functions and use a built-in runtime.

image

GPU function

If you want to create GPU instances using container images of popular AI projects such as Stable Diffusion WebUI, ComfyUI, RAG, and TensorRT, create GPU functions. This function type only supports Custom Container runtimes.

image