Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
FunctionGraph
Service Overview
Issue 17
Date 2019-12-31
HUAWEI TECHNOLOGIES CO., LTD.
Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. i
Contents
1 Overview....................................................................................................................................1
2 Product Features...................................................................................................................... 42.1 Function-related Features.................................................................................................................................................... 42.2 Product Advantages................................................................................................................................................................6
3 Application Scenarios............................................................................................................. 8
4 Permissions Description....................................................................................................... 10
5 Related Services.....................................................................................................................13
6 Feature Updates.................................................................................................................... 15
7 Quotas and Usage Restrictions.......................................................................................... 18
8 Billing....................................................................................................................................... 20
FunctionGraphService Overview Contents
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. ii
1 Overview
FunctionGraph hosts and computes event-driven functions in a serverless contextwhile ensuring high availability, high scalability, and zero maintenance. All youneed to do is write your code and set conditions. You pay only for what you useand you are not charged when your code is not running.
Function Service ProcessFigure 1-1 shows the process of using functions.
FunctionGraphService Overview 1 Overview
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 1
Figure 1-1 Function service process
The process is explained as follows:
1. Write code in Node.js, Python, Java, Go, C#, or PHP. For details, see theFunctionGraph Developer Guide.
2. Alternatively, edit code inline, directly upload a ZIP or JAR file, or upload a ZIPfile from Object Storage Service (OBS). For details, see Table 2-2.
3. Create an API or set a cloud service event source to trigger the function. Fordetails, see FunctionGraph Getting Started.
4. During function execution, FunctionGraph scales automatically based on thenumber of requests without the need for configurations. For details about themaximum number of function instances that can be run concurrently, seeFunction Running Resource Restrictions.
5. FunctionGraph works with Log Tank Service (LTS), allowing you to query runlogs of your function without the need for configurations. For details, seeQuerying Logs.
6. FunctionGraph works with Cloud Eye, allowing you to view graphicalmonitoring information about your function without the need forconfigurations. For details, see Function Monitoring.
FunctionGraphService Overview 1 Overview
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 2
7. After function execution, FunctionGraph bills based on the compute time youconsume. The billing is down to the 100 ms range.
FunctionGraphService Overview 1 Overview
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 3
2 Product Features
2.1 Function-related Features
Function ManagementFunctionGraph provides console-based function management.
● The Node.js, Java, Python, Go, C#, and PHP runtimes are supported. You canalso use a custom runtime. Table 2-1 lists the supported runtimes.
Table 2-1 Runtimes
Runtime Supported Version
Node.js 6.10, 8.10, 10.16, and 12.13
Python 2.7 and 3.6
Java 8.0
Go 1.8
C# .NET Core 2.0, .NET Core 2.1,and .NET Core 3.1
PHP 7.3
Custom -
● Multiple code entry modes
FunctionGraph allows you to edit code inline, upload a ZIP file from ObjectStorage Service (OBS), or directly upload a ZIP or JAR file. Table 2-2 lists thecode entry modes supported for each runtime.
FunctionGraphService Overview 2 Product Features
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 4
Table 2-2 Code entry modes
Runtime Editing CodeInline
Uploading aZIP File
Uploading aJAR File
Uploading aZIP Filefrom OBS
Node.js Supported Supported Notsupported
Supported
Python Supported Supported Notsupported
Supported
Java Notsupported
Supported Supported Supported
Go Notsupported
Supported Notsupported
Supported
C# Notsupported
Supported Notsupported
Supported
PHP Supported Supported Notsupported
Supported
Custom Supported Supported Notsupported
Supported
TriggersFunctionGraph supports the following types of triggers: SMN, DMS, APIG, OBS,DIS, and timer triggers. Table 2-3 lists the supported trigger types and thefunction invocation mode of each trigger type.
Table 2-3 Function invocation modes
Trigger Type Function Invocation Mode
SMN trigger Asynchronous invocation
DMS trigger Asynchronous invocation
APIG trigger Synchronous invocation
OBS trigger Asynchronous invocation
DIS trigger Asynchronous invocation
Timer trigger Asynchronous invocation
Kafka trigger Synchronous invocation
FunctionGraphService Overview 2 Product Features
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 5
Logs and MetricsFunctionGraph graphically displays function monitoring metrics and collectsfunction running logs, enabling you to view function statuses, and locate problemsby querying logs.
For details on how to query logs, see Querying Logs.
For details on how to view function metrics, see Viewing Function Metrics.
For details about tenant-level monitoring information, see Dashboard.
Function InitializationThe initializer interface is introduced to:
● Isolate function initialization and request processing to enable clearerprogram logic and better structured and higher-performance code.
● Ensure smooth function upgrade to prevent performance loss during theapplication layer's cold start initialization. Enable new function instances toautomatically execute initialization logic before processing requests.
● Identify the overhead of application layer initialization, and accuratelydetermine when resource scaling is performed and how many resources arerequired. This feature makes request latency more stable when theapplication load increases and more function instances are required.
2.2 Product Advantages
No Servers to ManageFunctionGraph automatically runs your code and frees you from provisioning andmanaging servers, allowing you to focus on business innovation.
Auto-ScalingFunctionGraph automatically scales to suit fluctuations in resource demands andensures that the service remains accessible even during peaks and spikes.
It automatically scales in/out resources based on the number of service requests,and distributes requests to function instances through automatic load balancing.
Event-based TriggeringFunctionGraph integrates with multiple cloud services such as SMN, DIS, DMS, andOBS in an event-based triggering mechanism to meet service requirements.
It is interconnected with the LTS and Cloud Eye services, allowing you to viewfunction logs and metrics without the need for any configurations.
High AvailabilityIf an instance becomes faulty, FunctionGraph starts another instance to processnew requests and releases resources from the unhealthy instance.
FunctionGraphService Overview 2 Product Features
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 6
Pay per UseFor the use of functions, you will be billed based on the number of requests andexecution duration (rounded up to the nearest 100 ms).
RI BillingReserved instances (RIs) can be created to initialize functions to eliminate theinfluence of cold start on your services. RIs are always alive in the executionenvironment.
For the use of RIs, you will be billed based on the number of requests and therunning duration of RIs. The minimum running duration is 60s.
FunctionGraphService Overview 2 Product Features
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 7
3 Application Scenarios
FunctionGraph is suitable for various scenarios, such as real-time file processing,real-time data stream processing, web & mobile application backends, andartificial intelligence (AI) application.
Real-time File Processing
Uploading files from a client to OBS triggers functions that create imagethumbnails in real time, convert video formats, aggregate and filter data files, orimplement other file operations.
Advantages:
● FunctionGraph automatically scales out resources to run more functioninstances as the number of requests increases.
● Files are uploaded to OBS to trigger file processing functions.
● You will be billed only for resources used to process files as needed (you arenot billed for idle resources during lows in demand).
For example, create two buckets in OBS, and build a function for compressingimages uploaded to the specified bucket. For details, see Compressing Images.
Real-time Stream Processing
Combine FunctionGraph with DIS to process real-time streaming data for suchpurposes as application activity tracking, transaction order processing, click streamanalysis, data cleansing, metrics generation, log filtering, indexing, social mediaanalysis, and IoT device data telemetry and metering.
Advantages:
● Data is collected by means of DIS streams to trigger data processingfunctions.
● FunctionGraph automatically scales out resources to run more functioninstances as the number of requests increases.
● You will be billed only for resources used to process files as needed (you arenot billed for idle resources during lows in demand).
FunctionGraphService Overview 3 Application Scenarios
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 8
For example, build a function to process (such as to convert format) the real-timeIoT data streams collected by DIS, and store the processed data into CloudTableService (CloudTable). For details, see Processing DIS Data.
Web & Mobile BackendsInterconnect FunctionGraph with other cloud services or your VMs to quickly buildhighly available and scalable web & mobile backends.
Advantages:
● FunctionGraph ensures high reliability of website data using OBS andCloudTable, and high-availability of website logic using API Gateway.
● FunctionGraph automatically scales out resources to run more functioninstances as the number of requests increases.
● You will be billed only for resources used to process files as needed (you arenot billed for idle resources during lows in demand).
Artificial IntelligenceIntegrate FunctionGraph with EI services for text recognition and illicit imageidentification.
Advantages:
● FunctionGraph works with EI services for text recognition and contentmoderation to suit a wide range of scenarios – make adjustments wheneveryou need as demands change.
● You only need to apply for related services and write service code withouthaving to provision or manage servers.
● You will be billed only for function execution and used EI services withouthaving to pay for idle resources when service demands are low.
For example, build a function with an APIG trigger to provide pornographic imageidentification API services. For details, see Building an AI Application forIdentifying Pornographic Images.
FunctionGraphService Overview 3 Application Scenarios
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 9
4 Permissions Description
If you need to assign different permissions to employees in your enterprise toaccess your FunctionGraph resources, IAM is a good choice for fine-grainedpermissions management. IAM provides identity authentication, permissionsmanagement, and access control, helping you secure access to your cloudresources.
With IAM, you can use your account to create IAM users for your employees, andassign permissions to the users to control their access to specific resource types.For example, some software developers in your enterprise need to useFunctionGraph resources but must not delete them or perform any high-riskoperations. To achieve this result, you can create IAM users for the softwaredevelopers and grant them only the permissions required for using FunctionGraphresources.
If your account does not need individual IAM users for permissions management,you may skip over this chapter.
IAM can be used free of charge. You pay only for the resources in your account.For more information about IAM, see IAM Service Overview.
FunctionGraph PermissionsBy default, new IAM users do not have any permissions assigned. You need to adda user to one or more groups, and assign permissions policies to these groups. Theuser then inherits permissions from the groups it is a member of. This process iscalled authorization. After authorization, the user can perform specified operationson FunctionGraph based on the permissions.
FunctionGraph is a project-level service deployed and accessed in specific physicalregions. To assign FunctionGraph permissions to a user group, specify the scope asregion-specific projects and select projects for the permissions to take effect. If Allprojects is selected, the permissions will take effect for the user group in allregion-specific projects. When accessing FunctionGraph, the users need to switchto a region where they have been authorized to use the FunctionGraph service.
Table 4-1 lists all the system roles supported by FunctionGraph.
FunctionGraphService Overview 4 Permissions Description
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 10
Table 4-1 Role description
Role Name Description
FunctionGraph Administrator Administrator permissions for FunctionGraph
FunctionGraph Invoker Permissions for querying and invokingFunctionGraph functions
Tenant Administrator Administrator permissions for all cloud servicesin the region where the policy is assigned
Server Administrator Administrator permissions for all serverservices, including Elastic Cloud Server (ECS),Elastic Volume Service (EVS), and VirtualPrivate Cloud (VPC), in the region where thepolicy is assigned
Tenant Guest Permissions for viewing all cloud services in theregion where the policy is assigned
Table 4-2 lists the common operations supported by each system-defined policyof FunctionGraph. Please choose proper system-defined policies according to thistable.
Table 4-2 Common operations supported by each system role
Operation TenantAdministrator
FunctionGraphAdministrator
FunctionGraph Invoker
Tenant Guest
Creatingfunctions
√ √ × ×
Queryingfunctions
√ √ √ √
Modifyingfunctions
√ √ × ×
Deletingfunctions
√ √ × ×
Invokingfunctions
√ √ √ ×
Queryingfunction logs
√ × × √
Viewingfunctionmetrics
√ × × √
FunctionGraphService Overview 4 Permissions Description
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 11
Helpful Links● IAM Service Overview● Creating a User and Granting Permissions● Permissions Policies and Supported Actions
FunctionGraphService Overview 4 Permissions Description
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 12
5 Related Services
Table 5-1 describes the cloud services that have been interconnected withFunctionGraph.
Table 5-1 Interconnected services
Service Function
SMN FunctionGraph functions are constructed to process SMNnotifications. For details, see SMN User Guide.
DMS FunctionGraph functions are configured to automatically pollDMS queues for messages and process any new messages.For details, see DMS User Guide.
API Gateway FunctionGraph functions are invoked over HTTPS by definingREST APIs with specified backend services. For details, seeAPI Gateway User Guide.
OBS FunctionGraph functions are created to process OBS bucketevents, such as object creation or deletion events. Forexample, when an image is uploaded to the specified bucket,OBS invokes the function to read the image and create athumbnail. For details, see OBS User Guide.
DIS FunctionGraph functions are created to periodically poll DISstreams for new records, such as website click streams,financial transactions, social media streams, IT logs, andlocation-tracking events. For details, see DIS User Guide.
Cloud Eye FunctionGraph is interconnected with Cloud Eye to reportmonitoring metrics, allowing you to view function metricsand alarm messages through Cloud Eye. For details, seeCloud Eye User Guide.
VPC Functions can be configured to access resources in VirtualPrivate Clouds (VPCs) or to access the Internet throughsource network address translation (SNAT) by binding elasticIP addresses. For details, see VPC User Guide.
FunctionGraphService Overview 5 Related Services
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 13
Table 5-2 FunctionGraph operations that can be recorded by CTS
Operation Resource Type Trace Name
Creating a function Functions CreateFunction
Deleting a function Functions DeleteFunction
Modifying functioninformation
Functions ModifyFunctionMetadata
Publishing a functionversion
FunctionVersions PublishFunctionVersion
Deleting a function alias FunctionVersionsAlias DeleteVersionAlias
Deleting a functiontrigger
Trigger DeleteTrigger
Creating a functiontrigger
Trigger CreateTrigger
Disabling a functiontrigger
Trigger DisabledTrigger
Enabling a functiontrigger
Trigger enabledTrigger
Executing a function FunctionInstance invokeFunction
FunctionGraphService Overview 5 Related Services
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 14
6 Feature Updates
Date Description
2019-12-31 Added support for Kafka triggers.
2019-11-26 Optimized the classification of function templates.
2019-10-16 Added the monthly statistics function on the Dashboardpage.
2019-08-16 Added support for the following:● Test event persistence● Custom runtimes● Mounting file systems to functions
2019-5-27 1. Optimized the inline code editor by adding the functionsof testing functions, viewing testing results, and creatingmulti-level Python modules.
2. Added support for integrating function templates withrelated cloud services.
3. Added support for PHP 7.3. Code can be edited inline inPHP 7.3.
2019-3-15 1. Added the traffic shifting function, which allows you toset two versions of different traffic shifting weights foreach alias.
2. Added support for configuring functions to accessresources in Virtual Private Clouds (VPCs) or to access theInternet through source network address translation(SNAT) by binding elastic IP addresses.
3. Added the JSON serialization and deserializationinterfaces in the C# SDK.
2019-3-4 1. Added support for function initialization.2. Launched FunctionGraph API 2.0.
FunctionGraphService Overview 6 Feature Updates
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 15
Date Description
2019-1-26 1. Combined the package and deploy commands forremote deployment using AOS.
2. Added support for the following memory sizes: 1792 MB,2048 MB, 2560 MB, 3072 MB, 3584, and 4096 MB.
3. Optimized the implementation of function execution andconfiguration agencies.
4. Added support for querying logs by function version.
2018-12-25 1. Added support for automatically generating functionswith Serverless Sandbox (HSS).
2. Added support for running HSS in Windows.
2018-11-30 1. Added support for importing and exporting functionapps.
2. Added support for specifying different agencies forfunction execution and trigger creation.
2018-11-16 1. Added descriptions about FunctionGraph metricsmonitored on Cloud Eye.
2. Added the dependency management module formanaging dependency packages.
3. Added support for downloading function logs.
2018-11-2 1. Added support for C# (.NET Core 2.0) and C# (.NET Core2.1).
2. Added the Tools page for downloading SDKs, CLI, andHSS and calculating monthly price based on estimatedusage.
2018-10-18 1. Connected to Cloud Eye to report metrics to it. You canview monitoring graphs and alarm messages on theCloud Eye console.
2. Added third-party components for Node.js, includingsmnsdk, express, fgs-express, and request.
2018-09-29 1. Added support for function apps.2. Added support for editing multiple function code
directories.
2018-08-29 1. Added confirmation for deleting functions, workflows,triggers, versions, and aliases.
2. Added support for disabling functions.3. Enhanced CLI to support the interaction mode.4. Enhanced HSS to support loading of cloud-based events.5. Added new function templates.
FunctionGraphService Overview 6 Feature Updates
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 16
Date Description
2018-07-28 1. Added support for Node.js 8.10.2. Optimized the monitoring of invocation duration, and
provides maximum, average, and minimum invocationdurations.
3. Added support for configuring a backend timeout for anAPIG trigger.
4. Integrated common third-party components for Node.js.5. Added support for exporting function code and
configurations and importing functions.
2018-06-30 1. Put FunctionGraph into commercial use.
FunctionGraphService Overview 6 Feature Updates
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 17
7 Quotas and Usage Restrictions
Account Resource RestrictionsThe following table provides the quotas for account resources. For details on howto query and modify quotas, see Quotas.
Table 7-1 Account resource restrictions
Resource Restriction
Maximum number of functions thatcan be created under an account
400
Maximum number of versions allowedfor a function
10
Maximum number of aliases allowedfor a function
10
Maximum number of DIS and DMStriggers allowed for a function version
10
Size of code edited inline for afunction
10 KB
Size of a code deployment package (inZIP or JAR format)
50 MB
Size of the original code in adeployment package
250 MB
Maximum size of deploymentpackages allowed for an account
10 GB
Number of concurrent executions peraccount
100
Number of environment variablesallowed for a function
20 (2 KB)
FunctionGraphService Overview 7 Quotas and Usage Restrictions
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 18
Function Running Resource Restrictions
Table 7-2 Function running resource restrictions
Resource Restriction
Ephemeral disk space (/tmp space) 512 MB
Number of file descriptors 1024
Total number of processes and threads 1024
Maximum execution duration perrequest
900s
Valid payload size of invocationrequest body (synchronous invocation)
6 MB
Valid payload size of invocationresponse body (synchronousinvocation)
6 MB
Valid payload size of invocationrequest body (asynchronousinvocation)
128 KB
Size of imported resources ≤ 50 MB ZIP file
Size of exported resources ≤ 50 MB
FunctionGraphService Overview 7 Quotas and Usage Restrictions
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 19
8 Billing
The billing mode for FunctionGraph is pay per use, and the price is calculatedbased on the number of requests and execution duration. There are no minimumcharges required.
Total price = Price for requests + Price for execution duration
Free TierFunctionGraph offers a free tier for your account, which you can share with yourIAM users.
● Requests: 1 million free requests every month.● Execution duration: 400,000 GB-seconds free execution duration every
month. For example, if the memory for a function is 1 GB, the free executionduration every month is 400,000s. If the memory is 512 MB, the freeexecution duration is 800,000s.
NO TICE
The free tier is reset at the beginning of every calendar month.
Table 8-1 shows the free execution duration for different memory specifications.
Table 8-1 Free execution duration
Memory (MB) Free Execution Duration (s) per Month
128 3,200,000
256 1,600,000
512 800,000
768 533,333
1024 400,000
1280 320,000
FunctionGraphService Overview 8 Billing
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 20
Memory (MB) Free Execution Duration (s) per Month
1536 266,667
N 1024 x 400,000/N
Billing RulesPrice for requests
● You will be billed based on the number of requests, which is the total numberof times all functions are invoked.
● The first 1 million requests every month are free of charge. After 1 millionfree requests are used up, you will be billed based on the rates specified atFunctionGraph Pricing Details.
Price for execution duration
FunctionGraph provides reserved and pay-per-use instances, which are metereddifferently.
● You can create and release RIs and will be billed based on their executionduration. RIs stay alive in the execution environment, eliminating theinfluence of cold starts on latency.– If you call an API to create an RI, billing will begin as soon as the RI
creation is complete.– If you call another API to release an RI, new requests will not be routed
to the RI. The RI will be released within a certain period, and the billingwill stop.
Figure 8-1 Lifecycle of an RI
As shown in Figure 8-1, the billing lasts from T1 to T4.RIs are metered at a granularity of second. If an RI runs for any fraction of aminute, you will be billed for the full minute. Otherwise, you will be billedbased on the actual execution duration.For example, if an RI runs for 51s, you will be billed for 1 minute. If the RIruns for 61s, you will be billed for 61s.
FunctionGraphService Overview 8 Billing
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 21
● For pay-per-use instances of a function, they are created and released byFunctionGraph, and you will be billed based on the actual execution duration.The execution duration is calculated from the time the function code isexecuted until it terminates, and is rounded up to the nearest 100 ms. If afunction is executed for 1005 ms, you will be billed for 1100 ms.
● The unit of execution duration is GB-second, which means 1 GB per second.
Additional charges
Additional charges will apply if other cloud services are used with FunctionGraph.For more information, see FunctionGraph Pricing Details.
FunctionGraphService Overview 8 Billing
Issue 17 (2019-12-31) Copyright © Huawei Technologies Co., Ltd. 22