- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- <iframe src="https://www.slidestalk.com/u5174/Cathys_Workflow_Presentation_KubeCon_Shanghai?embed" frame border="0" width="640" height="360" scrolling="no" allowfullscreen="true">复制
- 微信扫一扫分享
无服务器工作流:广泛应用无服务器的关键
展开查看详情
1 .Serverless Workflow: Key to Wide Serverless Adoption Cathy Zhang, Principal Architect Huawei Silicon Valley Center
2 .Agenda ● CNCF Serverless Function Workflow Model ● How to Use Workflow Model to Describe Serverless Application Use Cases ● Comparison of CNCF Function Workflow vs AWS Step Function ● Product Information Link on Serverless Workflow ● Q&A
3 . Function Workflow Model A Function Workflow can be naturally modeled as a state machine. There are three key components List of Events (trigger the function execution): Event For example: Storage event, Web Request event, Event 1 FN1 State DB Access event, Email event, etc. Event1 Payload List of States (build the workflow structure): Switch • event-state State • operation-state • switch-state Payload=A Payload=B • delay-state • parallel-state Operation Operation FN2 FN3 • end-state with success or failure status State State Functions associated with a state (executes the business logic ): FN4 • Directives for parallel/sequential execution of functions Event Event 2 State FN5 • Directives for Retry • Directives for information passing/filtering
4 .IoT Home Monitoring Use Case Application Workflow Specification Motion Event Face Event Recognition State-1 DoorOpen (Start) Event Family Non-Family Member Member Motion Event Face Event State-3 Recognition Time-out Non-Family Family Member Member Send Event DoorOpen Notification State-2 Event Send Operation Notification State Time-out End State
5 .How to Specify Workflow States "STATE-NAME": { "type": state type "start": a Boolean value to specify whether it is a start state "events": [ { "event-expression": a Boolean expression of events, e.g. “Event1 and Event2” "timeout": the timeout period waiting for the events, transition to end state "action-mode": functions are executed in sequence or in parallel "actions": the list of functions to be performed. "next-state": the next state to transition to after all the functions are successfully executed. } ] }
6 .How to Specify Function Retry { "function": the function that must be invoked "timeout": the amount of time to wait for the completion of the function "retry": [ { "match": the matching value for the retry (function response/timeout) "retry-interval": the interval between the time that the error response is received to the time the retry is started "max-retry": the maximum number of retry attempts "next-state": the next state to transition to when exceeding max-retry limit } ] }
7 .How to Specify Pass/Filter of Information
8 .Travel Booking Use Case Application Workflow Specification TravelBooking Event Booking Validation, ReqEvent State-1 Notify Manager (Start) Manager Event Response State-2 Interpret the response Event Reject Approve Check Price of Airline1 Operation Check Price of Airline2 State-1 Check Price of Airline3 Price Info Operation Compare Prices, times State-2 and Book the ticket End State
9 .Loan Application Use Case Application Workflow Specification LoanReq Event Loan Application Event State-1 Sanity Check (Start) Pass Fail Check Background Operation Check Credit History State-1 Check Financial Strength Send result to manager Loan Manager Event Interpret the response Response Event State-2 Approve Prepare Loan Operation Documents State-2 Reject Notify customer to sign the loan End State
10 .Video Streaming Use Case Application Workflow Specification Video Upload Event Analyze Video File Event State-1 Metadata (Start) Original Encoding Info Invoke MP4 Media Transcoder Service Operation State-1 Invoke HLS Media Transcoder Service Invoke DASH Media Transcoder Service MP4 Service Response Event Response Benefit of Breaking an Application into a Workflow HLS Service Event encoding Publish the Response Event State-2 Transcoding Modify/replace/add a function without impacting DASH Service Wait for more other functions or other steps. Response Event responses Switch State Flexibility to add a new step to provide new All responses service, such as creating thumbnails, inserting received ads in the video stream, inserting a video End transcription, etc. State
11 .CNCF Workflow vs AWS Step Function AWS Step Function Flow Step Function can not handle event. User needs to configure extra lambda function to connect an event to a step function and needs to coordinate these configurations manually Customer needs to provision Dynamo DB and use it to pass info from one Step Function to the next step function Configure multiple Lambda Functions and Step Functions vs one CNCF Workflow
12 .Information Links 1. https://github.com/cncf/wg-serverless/tree/master/workflow/spec 2. https://www.huaweicloud.com/en-us/product/functiongraph.html 3. https://aws.amazon.com/step-functions/
13 .Thank You! Questions?