Application Services Workflow (ASW) is an orchestration product used to coordinate the execution of distributed tasks. According to the definition of Tencent Cloud state language, the distributed tasks and Services are arranged, and the work flows will be executed in a reliable and coordinated manner according to the set order. By scheduling cloud functions with multiple Tencent cloud services step by step, tedious tasks such as task coordination, state management and error handling required by the development and operation of business processes can be completed through low code configuration, enabling the R&D team to build and update applications more simply and efficiently.
01. Comparison between ASW workflow and traditional workflow
features | ASW workflow | Traditional workflow |
---|---|---|
Ease of use | Cloud services have been integrated to invoke resources on the cloud. | You need to develop the integration manually. |
Functional richness | Use TCSL syntax to support business logic such as selection, parallelism, looping, and error handling. | You need to perform secondary transformation based on services. |
security | Cloud native applications, cloud data transmission & backup, the whole process meets the requirements of security compliance control. | Data transfer and storage security between multiple VPCS are required due to low security. |
Maintenance costs | Maintenance free. | Requires professional team maintenance, high cost. |
Elastic capacity | With enterprise-level flexible capacity expansion, to cope with the challenges of large traffic at ease. | Manual capacity expansion is required to resolve architecture problems. |
02. Application scenarios of ASW workflow
-
Audio and video processing
Using ASW workflows helps you orchestrate multiple tasks, such as transcoding, screenshots, content recognition, content auditing, and so on, into a complete processing flow. Through cloud functions, transcoding tasks can be sliced and processed in parallel, greatly improving the throughput of task processing and meeting the requirements of video and social application scenarios with high real-time and concurrent capability.
-
ETL job processing
Some data processing systems often need to deal with a large amount of data periodically/planned, using ASW workflow can quickly build a highly available data processing pipeline. For example, the securities company collects the trading situation every 12 hours and lists the top5 trading volume at that time. It also analyzes the popularity and trend of goods by analyzing the transaction flow logs of seckill website every day to detect errors caused by sell-outs. The ASW workflow uses cloud functions to process the transaction data in parallel, write the results back to the database service, and generate a series of reports at different latitudes. With the nearly infinite capacity of function expansion, it is easy to calculate large data and complete data modeling analysis.
-
Genetic data processing
ASW workflow can arrange multiple batch computing distributed jobs in series or in parallel, and reliably support large scale computing with long execution time and large concurrency. Such as secondary analysis of genetic data to identify variations in a biological sample compared to a standard genomic reference, and ultimately yield correlations. ASW workflow can improve execution reliability, resource utilization, and cost optimization.
-
Automated operation and maintenance
Automatic operation and maintenance are often faced with many challenges such as complicated steps, varying time, low reliability of stand-alone scripts, complex dependence and low manual efficiency, and progress cannot be visualized. ASW combined with cloud function can solve these problems well. For example, automatic software deployment starts from building Docker container, uploading container image, tracking down image of each node and starting container of new version image. Logs generated by each step of function will be saved to log service for query and sharing. Compared with stand-alone o&M scripts, automatic O&M based on ASW has the characteristics of high availability, built-in error handling mechanism and graphical progress.
-
AI machine training
ASW workflows can orchestrate a series of AI capabilities to complete a complex AI job scenario training. You can use ASW workflows to accelerate the delivery of secure, resilient machine learning applications while reducing the amount of code you have to write and maintain.
03. How to use ASW workflow?
Here is an example of how to use workflow quickly by orchestrating a cloud function.
1. Create functions
Log in to the cloud function console, create a cloud function named sum running Python 3.6, and click to go to the console address
# -* -coding: utf8 -* -import json def main_handler(event, context): sum = 0 for i in event["values"]: sum += i return sumCopy the code
2. Create a workflow
- Log in to the Application and Choreography Service Flow console, click “New” on the Workflow page, enter the Create Workflow page, select “Code Creation”, edit the workflow definition code in the “Code” area, and enter the following workflow definition:
- ASW Workflow Console address: Click to enter
{" Comment ":" ", "StartAt" : "sum", "States" : {" sum ": {" Type" : "Task", "Comment" : "sum function called", "Resource" : "qrn:qcs:asw:ap-guangzhou:123456789:sdk:json:qcloud:scf:Invoke/sum/$DEFAULT/default", "End": true } } }Copy the code
Resource defines the sum function to be called in the following format:
"QRN: QCS: asw: areas} {function: {Appid} : the SDK: json: qcloud: SCF: Invoke / {function name} / {function version alias} / {} function namespace"Copy the code
- Click Next. On the Configure Basic Information page, enter the workflow name, select the role and workflow type, and click Finish.
3. Run the workflow
- In the workflow list, click name of the created workflow. Basic information about the workflow is displayed on the page, and click Start Execution.
In the Start Execution window that is displayed, enter the input required for the workflow in JSON format, for example:
{"values": [1, 2, 3, 4, 5]}
Copy the code
- Click OK. After the status execution is complete, you can view the execution result on the details page.
- At the bottom of the current page, click the cloud function link in “Execution History” in “Resources”, you can directly jump to the cloud function console to view the details of function execution.
Welcome to experience ASW workflow products and services to learn more: product details.
You can join Tencent Cloud ASW communication group by identifying 👇 qr code below.
One More Thing
Experience Tencent Cloud Serverless Demo immediately and receive Serverless new user package 👉 Tencent Cloud Serverless novice experience
Welcome to: Serverless Chinese!