All Products
Search
Document Center

Operations in Function Compute

Last Updated: May 30, 2019

This topic describes the basic operations in Function Compute. Function Compute allows you to quickly build an application by writing function code, meaning no server management is required. Additionally, Function Compute supports elastic scaling. You can use services on a Pay-As-You-Go basis.

Developer tools

Function Compute supports the following tools: command-line tool fcli, command-line tool fun, and console. You can use fcli or the console to build services or query logs.

Build service

To build a service in Function Compute, follow these steps:

FCOperations

  1. Create a service.

  2. Create a function. Program an application by using function code.

  3. Trigger function execution. Use an event to trigger the execution of a function.

  4. View function execution logs.

  5. View service monitoring and alarming.

Create a service

A service is an object that helps you organize and manage resources in Function Compute. You can grant access permissions, configure logs, or create functions for a service.

Create a function

Functions are segments of application code that run a specific function, and are used in system scheduling and running. You can use the handlers provided by Function Compute to write code and then deploy the code as functions in Function Compute. Services in Function Compute correspond to the microservices in the software application architecture. When you build an application in Function Compute, you must abstract service logic into microservices as needed, and then implement the microservices as services in Function Compute.

You can create multiple functions for one service and set different memory sizes, environment variables, or other attributes for each function. This layered abstraction of services and functions balances the tradeoff between system abstraction and implementation flexibility. For example, to implement a microservice, you can use Alibaba Cloud Intelligent Speech Interaction to convert text into voices, and then combine this voice segment with images to form a video. When text is converted into voices, other services are called. Usually, you can configure a small memory size for this operation. However, video synthesis is a computing-intensive service and requires a large memory. To reduce cost, you can combine functions of different specifications to implement a microservice.

Trigger a function execution

In Function Compute, an event can be used to trigger the execution of a function. For example, if an OSS trigger is configured, a function is executed when an object in an OSS bucket is created or deleted. You can process the uploaded object or clean up the redundant data of the deleted object as needed. If a Log Service trigger is configured, a function is executed when a new log entry is written into the Logstore in Log Service. You can then easily process the new log entry.

  • For more information about triggers supported by Function Compute, see Triggers.

  • For more information about triggers, see Introduction.

  • For more information about trigger-related operations, see Basic operations.

You can directly use the console, the fcli tool, or the SDK to call a function with no need to configure triggers.

View function execution logs

Viewing logs is critical to system debugging. For more information about how to configure and view logs in Function Compute, see Function logs.

View service monitoring

You can view service monitoring in the Function Compute console.