Help Center/ FunctionGraph/ Best Practices/ FunctionGraph Best Practices
Updated on 2025-08-22 GMT+08:00

FunctionGraph Best Practices

This document summarizes practices in common application scenarios of FunctionGraph. Each practice case is given detailed solution description and operation guidance, helping you easily build your services based on FunctionGraph.

Performance Optimization and Security

Table 1 Performance optimization and security practices

Practice

Description

Performance Optimization

Introduces performance optimization practices including cold start and function execution improvement and provides guidance to help you build more efficient and stable applications on FunctionGraph.

Cold Start Optimization

Optimize the cold start of a function to improve user experience in building a serverless architecture.

Security Best Practices

Improve the overall security capability of FunctionGraph.

Data Processing Practices

Table 2 Data processing best practices

Practice

Description

Using FunctionGraph to Convert DIS Data Format and Store the Data to CloudTable

Use functions and DIS to collect real-time IoT data streams, convert the format of the collected data, and store the data to CloudTable Service.

Uploading Files Using APIs in FunctionGraph

Use Node.js and Python as examples to describe how to configure a backend parsing function and use APIG to upload files from devices to cloud servers.

This feature applies to web and app scenarios, such as reporting service run logs and uploading web app images.

Converting Device Coordinate Data in IoTDA

Use functions and IoTDA to transfer data reported by IoT devices and device status changes to FunctionGraph to trigger function running and convert coordinates (from WGS84 coordinates to GCJ02 coordinates).

It is applicable to scenarios such as processing device-reported data for storage in OBS, structuring and cleansing reported data before storing it in databases, and triggering event notifications based on device status changes.

Using FunctionGraph to Encrypt and Decrypt Files in OBS

Use a function and an OBS Application Service trigger to encrypt and decrypt files in OBS.

Identifying Abnormal Service Logs in LTS and Storing Them in OBS

Use LTS to configure a function for extracting alarm logs, identify abnormal log data in LTS, store the data in an OBS bucket, and use SMN to push alarm SMS messages and emails to service personnel.

Using FunctionGraph to Filter Logs in LTS in Real Time

Configure a function to extract log data, analyze and filter key information, and transfer the data to LTS.

Using FunctionGraph to Rotate Images Stored in OBS

Use a function flow to automatically rotate images in OBS.

Function flows are available in CN East-Shanghai1 and AP-Singapore.

Using FunctionGraph to Compress and Watermark Images

Use a function flow to automatically compress and watermark images.

Function flows are available in CN East-Shanghai1 and AP-Singapore.

Functional Application Practices

Table 3 FunctionGraph functional application best practices

Practice

Description

Using FunctionGraph and CTS to Identify Login and Logout Operations from Invalid IP Addresses

Configure functions for obtaining, analyzing, and processing cloud service resource operation information using CTS, and then push alarm SMS messages and emails using SMN to notify service personnel of handling the alarms.

Using FunctionGraph to Periodically Start and Stop ECSs

Configure a function to periodically enable or disable the ECS function of Huawei public cloud VMs.

Using FunctionGraph Functions As the Backend to Implement APIG Custom Authorizers

Quickly create an API whose backend service is FunctionGraph and call the API using custom authorizer.

Using FunctionGraph HTTP Functions to Process gRPC Requests

Process gRPC requests in FunctionGraph.

Currently, only the LA-Santiago region is supported.

Using a Java Function and Log4j2 to Print Logs

Use Java functions to configure Log4j2 to print logs.

Using FunctionGraph to Deploy Stable Diffusion for AI Drawing

Deploy Stable-Diffusion applications in the application center of FunctionGraph and provides multiple methods for customizing AI drawing applications.

Deploying an MCP Server Using FunctionGraph

Deploy popular open-source MCP server applications in one click in FunctionGraph and provide services accessible from the Internet through APIG.

Function Building Practices

Table 4 Function building best practices

Practice

Description

Building an HTTP Function Using an Existing Spring Boot Project

Deploy a Spring Boot application as an HTTP function on FunctionGraph.

Building an HTTP Function Using Go

Deploy a Go application as an HTTP function on FunctionGraph.

Using FunctionGraph to Access RDS for MySQL

This section describes how to access RDS for MySQL from FunctionGraph and query data, and provides sample code for testing.