Function Type Selection
This section describes the scenarios and differences of function types supported by FunctionGraph.
Suggestion
FunctionGraph allows you to create event and HTTP functions by compiling code online, uploading code files, or using container images. And it supports GPU computing resources.
When using FunctionGraph, you can select a proper function type and runtime based on your service scenarios and technology stack preferences. For details about function type selection in common scenarios, see Table 1.
Scenarios |
Suggestion |
Description |
---|---|---|
Web applications and API services |
Creating an HTTP function by compiling code |
HTTP functions support mainstream web application frameworks and can be accessed using browsers or directly invoked using URLs. |
File processing and data stream processing |
Creating an event function with the built-in runtime |
Event functions can integrate with other Huawei Cloud services, such as Object Storage Service (OBS), Distributed Message Service (DMS) for RabbitMQ, and Log Tank Service (LTS). |
Model inference scenarios such as chatbot and text-to-image generation |
Creating an HTTP function based on a custom image with GPU enabled |
Use container images of popular AI projects (such as Stable Diffusion, ComfyUI, and Ollama) to create HTTP functions and enable GPUs to quickly build AI model inference services. |
Asynchronous tasks such as scheduled tasks and audio/video transcoding |
Creating an event function with the built-in runtime |
Event functions can be triggered by specific events or scheduled events. |
Function Type Comparison
For details about event functions and HTTP functions, see Table 2.
Item |
Event Function |
HTTP Function |
---|---|---|
Feature |
Processes files and data streams triggered by events of various cloud products, such as EG trigger (OBS Application Service),Kafka trigger, and LTS triggers. You can use it to process asynchronous requests and trace and save the status of each asynchronous invocation. |
Supports popular web application frameworks and AI projects, which can be accessed through browsers or invoked through URLs. |
Scenarios |
|
|
Runtime |
You are advised to use a built-in runtime. |
You are advised to use a custom runtime or custom image. |
Function Running Environment Comparison
For details about the function running environment, see Table 3.
Item |
Built-in Runtime |
Custom Runtime |
Custom Image |
---|---|---|---|
Development process |
Write a request handling program based on the handler defined in FunctionGraph. |
Develop applications based on the web application framework template and view the result through the public network access. |
Upload a custom image to SWR and use the image, or use an existing image in SWR. |
Supported instance types |
CPU instance |
CPU and GPU instances |
CPU and GPU instances |
Instance concurrency |
Not supported |
Supported |
Supported |
Cold start |
Fastest The code package does not contain the runtime. |
Fast The code package is an HTTP server program and is large in size. No container image needs to be pulled. |
Slow The image needs to be pulled. |
Code file size limit |
The code package size cannot exceed 100 MB or 500 MB. For details, see the Notes and Constraints. |
The size of an undecompressed image cannot exceed 10 GB. |
|
Code file format |
ZIP, JAR (Java) |
Container images |
|
Language |
Node.js, Python, PHP, Java, C#, Go |
Unlimited |
Unlimited |
Creating a Function on the FunctionGraph Console
You can create the following functions on the FunctionGraph console:
If you want to invoke an associated function through a specific event or a timer trigger, create an event function on the FunctionGraph console, as shown in Figure 1. You are advised to select a built-in runtime. For details, see Creating an Event Function.
If you want to compile programs based on popular frameworks in various languages, you can create HTTP functions on the FunctionGraph console, as shown in Figure 2. You are advised to select a custom runtime. For details, see Creating an HTTP Function.
If you want to use a container image of a popular AI project (such as Stable Diffusion WebUI, ComfyUI, and Ollama), you can create a GPU-accelerated and image-based HTTP function on the FunctionGraph console, as shown in Figure 3.
FunctionGraph provides function templates for various scenarios. With these templates, you can quickly build a function application with the code and environment variables automatically filled, as can be seen in Figure 4. For details, see Creating a Function Using a Template.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot