SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
Amazon Simple Work Flow Engine (SWF):
How Beamr uses SWF for video optimization in the cloud
Dan Julius, VP R&D, Beamr
There are few times when something new comes along
that makes me think the following:
- Really? Nahh...
- Hmm.. Maybe..
- OMG!! How the f*** does it do that?
- GIVE IT TO ME NOW!!
“
Lens In The Face
- Optimized ±5B Photos in 2015
- Reduces JPEG file size from 20%-80%
- Community of tens of thousands photographers
- Free trial available at jpegmini.com
- Enterprise and consumer products
SOURCE
1080p @ 3.5 mbps
BEAMR VIDEO
1080p @ 2.1 mbps
*Images are courtesy of Universal Studios
REDUCED BY 40%
BEAMR KEY FEATURES
5©2016 Beamr Imaging Ltd. All Rights Reserved
Bitrate reduction Always safe Fully automatic Standard compliant
Significant reduction.
in bitrate or file size
Retains original
image or video
quality
No additional QC
steps required
No modification needed
for existing players
Agenda
6©2016 Beamr Imaging Ltd. All Rights Reserved 55
1. Why workflows?
2. SWF Concepts
3. Tips and Gotchas
4. Q&A
For Python → Ask me later
Java/Ruby → Checkout Flow Framework
No Code
Workflows
A Simple Workflow
8©2016 Beamr Imaging Ltd. All Rights Reserved 55
But…
9©2016 Beamr Imaging Ltd. All Rights Reserved 55
Reality isn’t always simple
Simple Workflow Service
SWF
The Players
©2016 Beamr Imaging Ltd. All Rights Reserved
Activity Workers
DECIDERS
SWF
11
Activity Workers
©2016 Beamr Imaging Ltd. All Rights Reserved
Activity Workers
Responsible for doing the “work”
Typically a long-running process
Poll queue task-list → Do work
While True:
Poll an SWF queue task-list
Process the task
Return result to SWF
12
Deciders
©2016 Beamr Imaging Ltd. All Rights Reserved
DECIDERS
Responsible for making workflow decisions
Typically a long-running process
While True:
Poll task-list for a decision
Analyze execution history
Make a decision on next step(s)
Return result to SWF
13
SWF Responsibilities
©2016 Beamr Imaging Ltd. All Rights Reserved
Coordinate system components
Schedule “decision tasks” (a queue?)
Schedule “activity tasks” (a queue?)
Maintain workflow state
Catch errors and timeouts
Provide an API to track workflow-execution progress
Does No work. Makes No decisions.
14
Example of Two-Task Workflow Life Cycle
15©2016 Beamr Imaging Ltd. All Rights Reserved
SWF Decider Worker A Worker B
start execution
new exc. what to do?
Schedule A
starting...
A task for you...
Completed. Result is...
New history. what now?
Schedule B
A task for you...
Completed. Result is...
New history. What now?
Close. Result is...
Are we done?
no
Are we done?
Yes
START ENDTask A Task B
Tips for Activity Workers
©2016 Beamr Imaging Ltd. All Rights Reserved
Do only one thing
Be Stateless
Catch all exceptions and return failure
Send heartbeats (and check responses)
While True:
Poll an SWF task-list
Process the task
Return result to SWF
16
Tips for Deciders
©2016 Beamr Imaging Ltd. All Rights Reserved
Focus on Decision Making. Avoid doing any
work.
Be Stateless
Decide based on entire* execution history
While True:
Poll SWF for an execution
Analyze execution history
Make a decision on next step(s)
Return result to SWF
Parallelize tasks when appropriate by returning
multiple decisions.
Catch all exceptions and always return a valid
decision
Expect the unexpected... (e.g. a decision may be rejected)
17
The Execution History
©2016 Beamr Imaging Ltd. All Rights Reserved
[ {
"eventId": 11,
"eventTimestamp": 1326671603.102,
"eventType": "WorkflowExecutionTimedOut",
...
},
...
{
"activityTaskScheduledEventAttributes": {
"activityId": "verification-27",
"activityType": {
"name": "activityVerify",
"version": "1.0"
},
…..
"input": "5634-0056-4367-0923,12/12,437",
...
},
"eventId": 8,
...
"eventType": "ActivityTaskScheduled"
},
...
{
...
"eventId": 2,
"eventTimestamp": 1326668003.094,
"eventType": "DecisionTaskScheduled"
}
]
The workflow-execution “state”
It’s just json
Every event is noted
Decisions are noted
Scheduled tasks are noted
Start and Finish are noted
…
How to make a decision?
- Read the execution history
- Apply some “logic”
- Return one or more decisions
18
DEMO
CLI Demo
©2016 Beamr Imaging Ltd. All Rights Reserved
A distributed “Image Processing” workflow
Prerequisites:
- AWS Account, IAM Credentials
- AWSCLI
- bash / jq / ImageMagic / JPEGmini
20
CLI Demo - Registration
©2016 Beamr Imaging Ltd. All Rights Reserved
Register Domain / Workflow / Activity Types
We use “code” to configure SWF. No CloudFormation available.
LOFT_Domain
demo (Domain)
Process
Media
Ingest
CleanupOptimize
Thumbnail
21
CLI Demo - Process Media Workflow
©2016 Beamr Imaging Ltd. All Rights Reserved
START ENDIngest Cleanup
Optimize
Thumbnail
Download from Web
to EFS
Process files on EFS
Upload results to S3
Remove files form
EFS
22
Tips and Gotchas
Some Advanced Topics
©2016 Beamr Imaging Ltd. All Rights Reserved
Child Workflows
- Simplify large workflows
- Reuse child-workflows
Signals
- Sent from somewhere (external / activity)
- SWF will schedule a Decision-Task
24
[
...
{
"eventId": 153,
"eventTimestamp": 1326671603.102,
"eventType": "WorkflowExecutionSignaled",
"workflowExecutionSignaledEventAttributes"{
...
}
...
},
...
]
High Availability
©2016 Beamr Imaging Ltd. All Rights Reserved
REST API
At least two deciders, and two
workers of each type, across
multiple zones
25
The Execution History
©2016 Beamr Imaging Ltd. All Rights Reserved
Beware of the “LastEvent” samples
Note the previousStartedEventId
When then History gets long
- Note the nextPageToken.
Pages are small (100 items).
Beware of rate limits.
- Cache history pages
- Use ChildWorkflows or ContinueAsNewWorkflow
- Use short names in input and results fields
[ {
"eventId": 11,
"eventTimestamp": 1326671603.102,
"eventType": "WorkflowExecutionTimedOut",
...
},
...
{
"activityTaskScheduledEventAttributes": {
"activityId": "verification-27",
"activityType": {
"name": "activityVerify",
"version": "1.0"
},
…..
"input": "5634-0056-4367-0923,12/12,437",
...
},
"eventId": 8,
...
"eventType": "ActivityTaskScheduled"
},
...
{
...
"eventId": 2,
"eventTimestamp": 1326668003.094,
"eventType": "DecisionTaskScheduled"
}
]
26
Monitoring and Scaling
©2016 Beamr Imaging Ltd. All Rights Reserved
Processes to Monitoring
- Monitor each decider process
- Monitor each worker process
Metrics to Monitor
- Activity task list sizes
- Decider task list sizes
- DecisionTaskScheduleToStartTime
- ActivityTaskScheduleToStartTime
Scale Workers with Spot instances
- Use short-timeouts
- Heartbeats
27
Things Will Break...
©2016 Beamr Imaging Ltd. All Rights Reserved
API calls may fail, therefore backoff and retry
- Rate limiting
- Network errors
Expect the unexpected:
- Decisions or Responses may be rejected
- Closing a workflow execution could fail due to pending signals
- An Activity Worker response may fail due to cancelled execution
- Events may be aggregated, or delivered out of order
- Task lists are only mostly FIFO
28
Q&A
Dan Julius
VP R&D, Beamr
dan@beamr.com
Backup Slides
Workflows vs. Messages
©2016 Beamr Imaging Ltd. All Rights Reserved
A complex workflow requires more than just passing
messages from task to task…
Workflows have “state”
Tasks might need to be synchronized
Tasks can fail or timeout
32
How SWF Works (maybe)
©2016 Beamr Imaging Ltd. All Rights Reserved
SWF
Worker A Worker B
Decider
task-list
task-list
task-list
Execution
history
33
Poll
The Manual Worker
©2016 Beamr Imaging Ltd. All Rights Reserved
The worker process:
While True:
Poll an SWF task-list
Send email to manual-worker
The employee:
When an email is received,
Process task, and submit completion form
Web
Server
Email
Respond to SWF
Submit Form
SWFWorker
Process
Manual
Labour
34
Timeouts
©2016 Beamr Imaging Ltd. All Rights Reserved 35
Timeouts
©2016 Beamr Imaging Ltd. All Rights Reserved 36
More Advanced Topics
©2016 Beamr Imaging Ltd. All Rights Reserved
Markers
- Added by deciders
- Simplify understanding history
- “Milestones”
Timers
- Set by deciders
- SWF will schedule a Decision-Task when timer fires
Priorities
- SWF will can re-order tasks based on Priority
[
...
{
"eventId": 153,
"eventTimestamp": 1326671603.102,
"eventType": "TimerFired",
"TimerFiredEventAttributes"{
...
}
...
},
...
]
37
[
...
{
"eventId": 153,
"eventTimestamp": 1326671603.102,
"eventType": "MarkerRecorded",
"markerRecordedEventAttributes"{
...
}
...
},
...
]
Some Concepts
©2016 Beamr Imaging Ltd. All Rights Reserved
Worklow Activity
Task
State
Logical Flow
Activity Workers Asynchronous processing
Distributed processing
Scalability
Domain
Activity Type Activity Version
Activity Timeouts
Results
Decider
Input Data
Events
Workflow execution
Execution History
Polling
workflowId + runId
Workflow Starters
decisions
Activity Task
Lambda Task Decision Task
Task Lists
38

Contenu connexe

Tendances

vFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS AppsvFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS Apps
VMware vFabric
 

Tendances (19)

Don't touch that server
Don't touch that serverDon't touch that server
Don't touch that server
 
Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2
 
Continuous Application Delivery to WebSphere - Featuring IBM UrbanCode
Continuous Application Delivery to WebSphere - Featuring IBM UrbanCodeContinuous Application Delivery to WebSphere - Featuring IBM UrbanCode
Continuous Application Delivery to WebSphere - Featuring IBM UrbanCode
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance Reporting
 
vFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS AppsvFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS Apps
 
Aptimize SharePoint Datasheet
Aptimize SharePoint DatasheetAptimize SharePoint Datasheet
Aptimize SharePoint Datasheet
 
Delivering Applications Continuously to Cloud
Delivering Applications Continuously to CloudDelivering Applications Continuously to Cloud
Delivering Applications Continuously to Cloud
 
Preserving Customizations with Overlays & Custom Objects in AR System 7.6.04:...
Preserving Customizations with Overlays & Custom Objects in AR System 7.6.04:...Preserving Customizations with Overlays & Custom Objects in AR System 7.6.04:...
Preserving Customizations with Overlays & Custom Objects in AR System 7.6.04:...
 
Improving Software Delivery with DevOps & Software Defined Environments | The...
Improving Software Delivery with DevOps & Software Defined Environments | The...Improving Software Delivery with DevOps & Software Defined Environments | The...
Improving Software Delivery with DevOps & Software Defined Environments | The...
 
Death to Manual Deployments
Death to Manual DeploymentsDeath to Manual Deployments
Death to Manual Deployments
 
Avoiding the Release Weekend
Avoiding the Release Weekend Avoiding the Release Weekend
Avoiding the Release Weekend
 
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
 
A05
A05A05
A05
 
IBM WebSphere Liberty and Docker Deep Dive
IBM WebSphere Liberty and Docker Deep DiveIBM WebSphere Liberty and Docker Deep Dive
IBM WebSphere Liberty and Docker Deep Dive
 
VMware 2V0-21.20 Practice Test
VMware 2V0-21.20 Practice Test VMware 2V0-21.20 Practice Test
VMware 2V0-21.20 Practice Test
 
Success Factors for a Mature Microservices Implementation
Success Factors for a Mature Microservices ImplementationSuccess Factors for a Mature Microservices Implementation
Success Factors for a Mature Microservices Implementation
 
A Cloud Native Platform - Cloud Native Day Santa Monica
A Cloud Native Platform - Cloud Native Day Santa MonicaA Cloud Native Platform - Cloud Native Day Santa Monica
A Cloud Native Platform - Cloud Native Day Santa Monica
 
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case StudyEdge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
 
JNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerJNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution Server
 

En vedette

Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
Amazon Web Services
 

En vedette (20)

Introducing Amazon Simple Workflow (Amazon SWF)
Introducing Amazon Simple Workflow (Amazon SWF)Introducing Amazon Simple Workflow (Amazon SWF)
Introducing Amazon Simple Workflow (Amazon SWF)
 
httpie
httpiehttpie
httpie
 
Building Your Practice on AWS: An APN Breakfast Session
Building Your Practice on AWS: An APN Breakfast SessionBuilding Your Practice on AWS: An APN Breakfast Session
Building Your Practice on AWS: An APN Breakfast Session
 
#EarthOnAWS: How the Cloud Is Transforming Earth Observation | AWS Public Sec...
#EarthOnAWS: How the Cloud Is Transforming Earth Observation | AWS Public Sec...#EarthOnAWS: How the Cloud Is Transforming Earth Observation | AWS Public Sec...
#EarthOnAWS: How the Cloud Is Transforming Earth Observation | AWS Public Sec...
 
Amazon S3 - Masterclass - Pop-up Loft Tel Aviv
Amazon S3 - Masterclass - Pop-up Loft Tel AvivAmazon S3 - Masterclass - Pop-up Loft Tel Aviv
Amazon S3 - Masterclass - Pop-up Loft Tel Aviv
 
Develping mobile services on aws - Pop-up Loft Tel Aviv
Develping mobile services on aws - Pop-up Loft Tel AvivDevelping mobile services on aws - Pop-up Loft Tel Aviv
Develping mobile services on aws - Pop-up Loft Tel Aviv
 
Amazon EC2
Amazon EC2Amazon EC2
Amazon EC2
 
AWS Mobile Hub + AWS Device Farm
AWS Mobile Hub + AWS Device FarmAWS Mobile Hub + AWS Device Farm
AWS Mobile Hub + AWS Device Farm
 
DevOps as a Pathway to AWS | AWS Public Sector Summit 2016
DevOps as a Pathway to AWS | AWS Public Sector Summit 2016DevOps as a Pathway to AWS | AWS Public Sector Summit 2016
DevOps as a Pathway to AWS | AWS Public Sector Summit 2016
 
Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401
 
Account Separation and Mandatory Access Control on AWS | Security Roadshow Du...
Account Separation and Mandatory Access Control on AWS | Security Roadshow Du...Account Separation and Mandatory Access Control on AWS | Security Roadshow Du...
Account Separation and Mandatory Access Control on AWS | Security Roadshow Du...
 
Keynote - Currency fair
Keynote - Currency fairKeynote - Currency fair
Keynote - Currency fair
 
Workshop: We love APIs
Workshop: We love APIsWorkshop: We love APIs
Workshop: We love APIs
 
Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
Faster Time to Science - Scaling BioMedical Research in the Cloud with SciOps...
 
Cloud First: New Architecture for New Infrastructure
Cloud First: New Architecture for New InfrastructureCloud First: New Architecture for New Infrastructure
Cloud First: New Architecture for New Infrastructure
 
Another Day, Another Billion Packets
Another Day, Another Billion PacketsAnother Day, Another Billion Packets
Another Day, Another Billion Packets
 
Keynote - AON
Keynote - AONKeynote - AON
Keynote - AON
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Introducing Database Offerings on AWS - Technical 101
Introducing Database Offerings on AWS - Technical 101Introducing Database Offerings on AWS - Technical 101
Introducing Database Offerings on AWS - Technical 101
 
Log Analysis At Scale
Log Analysis At ScaleLog Analysis At Scale
Log Analysis At Scale
 

Similaire à Amazon Simple Work Flow Engine (SWF): How Beamr uses SWF for video optimization in the cloud - Pop-up Loft Tel Aviv

Scoping Workshop WrapupTemplate.ppt
Scoping Workshop WrapupTemplate.pptScoping Workshop WrapupTemplate.ppt
Scoping Workshop WrapupTemplate.ppt
shubhtomar5
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
Hicham Khallouki
 

Similaire à Amazon Simple Work Flow Engine (SWF): How Beamr uses SWF for video optimization in the cloud - Pop-up Loft Tel Aviv (20)

Designing ACM solutions AMIS25
Designing  ACM solutions   AMIS25Designing  ACM solutions   AMIS25
Designing ACM solutions AMIS25
 
What's new in designer
What's new in designerWhat's new in designer
What's new in designer
 
Impact2014: Practical Performance Troubleshooting
Impact2014: Practical Performance TroubleshootingImpact2014: Practical Performance Troubleshooting
Impact2014: Practical Performance Troubleshooting
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
 
Scoping Workshop WrapupTemplate.ppt
Scoping Workshop WrapupTemplate.pptScoping Workshop WrapupTemplate.ppt
Scoping Workshop WrapupTemplate.ppt
 
S903 palla
S903 pallaS903 palla
S903 palla
 
AEM Communities 6.1 - MongoSV '15
AEM Communities 6.1 - MongoSV '15AEM Communities 6.1 - MongoSV '15
AEM Communities 6.1 - MongoSV '15
 
MongoDB Days Silicon Valley: Using MongoDB with Adobe AEM Communities
MongoDB Days Silicon Valley: Using MongoDB with Adobe AEM CommunitiesMongoDB Days Silicon Valley: Using MongoDB with Adobe AEM Communities
MongoDB Days Silicon Valley: Using MongoDB with Adobe AEM Communities
 
IBM API Management BPM Systems Engage
IBM API Management BPM Systems EngageIBM API Management BPM Systems Engage
IBM API Management BPM Systems Engage
 
Monitoring for Operational Outcomes and Application Insights: Best Practices ...
Monitoring for Operational Outcomes and Application Insights: Best Practices ...Monitoring for Operational Outcomes and Application Insights: Best Practices ...
Monitoring for Operational Outcomes and Application Insights: Best Practices ...
 
Tool overview – how to capture – how to create basic workflow .pptx
Tool overview – how to capture – how to create basic workflow .pptxTool overview – how to capture – how to create basic workflow .pptx
Tool overview – how to capture – how to create basic workflow .pptx
 
XPages is Workflow's new best friend
XPages is Workflow's new best friendXPages is Workflow's new best friend
XPages is Workflow's new best friend
 
Stating the obvious - All Day DevOps 2017
Stating the obvious  - All Day DevOps 2017Stating the obvious  - All Day DevOps 2017
Stating the obvious - All Day DevOps 2017
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
 
SaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
SaltConf 2015: Salt stack at web scale: Better, Stronger, FasterSaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
SaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
 
Lotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes ClientLotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes Client
 
DevOPs Transformation Workshop
DevOPs Transformation WorkshopDevOPs Transformation Workshop
DevOPs Transformation Workshop
 
Streams Studio Support for IBM InfoSphere Streams V4.0
Streams Studio Support for IBM InfoSphere Streams V4.0Streams Studio Support for IBM InfoSphere Streams V4.0
Streams Studio Support for IBM InfoSphere Streams V4.0
 
A301 ctu madrid2016-monitoring
A301 ctu madrid2016-monitoringA301 ctu madrid2016-monitoring
A301 ctu madrid2016-monitoring
 

Plus de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Dernier

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Dernier (20)

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Buy Epson EcoTank L3210 Colour Printer Online.pptx
Buy Epson EcoTank L3210 Colour Printer Online.pptxBuy Epson EcoTank L3210 Colour Printer Online.pptx
Buy Epson EcoTank L3210 Colour Printer Online.pptx
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 

Amazon Simple Work Flow Engine (SWF): How Beamr uses SWF for video optimization in the cloud - Pop-up Loft Tel Aviv

  • 1. Amazon Simple Work Flow Engine (SWF): How Beamr uses SWF for video optimization in the cloud Dan Julius, VP R&D, Beamr
  • 2. There are few times when something new comes along that makes me think the following: - Really? Nahh... - Hmm.. Maybe.. - OMG!! How the f*** does it do that? - GIVE IT TO ME NOW!! “ Lens In The Face
  • 3. - Optimized ±5B Photos in 2015 - Reduces JPEG file size from 20%-80% - Community of tens of thousands photographers - Free trial available at jpegmini.com - Enterprise and consumer products
  • 4. SOURCE 1080p @ 3.5 mbps BEAMR VIDEO 1080p @ 2.1 mbps *Images are courtesy of Universal Studios REDUCED BY 40%
  • 5. BEAMR KEY FEATURES 5©2016 Beamr Imaging Ltd. All Rights Reserved Bitrate reduction Always safe Fully automatic Standard compliant Significant reduction. in bitrate or file size Retains original image or video quality No additional QC steps required No modification needed for existing players
  • 6. Agenda 6©2016 Beamr Imaging Ltd. All Rights Reserved 55 1. Why workflows? 2. SWF Concepts 3. Tips and Gotchas 4. Q&A For Python → Ask me later Java/Ruby → Checkout Flow Framework No Code
  • 8. A Simple Workflow 8©2016 Beamr Imaging Ltd. All Rights Reserved 55
  • 9. But… 9©2016 Beamr Imaging Ltd. All Rights Reserved 55 Reality isn’t always simple
  • 11. The Players ©2016 Beamr Imaging Ltd. All Rights Reserved Activity Workers DECIDERS SWF 11
  • 12. Activity Workers ©2016 Beamr Imaging Ltd. All Rights Reserved Activity Workers Responsible for doing the “work” Typically a long-running process Poll queue task-list → Do work While True: Poll an SWF queue task-list Process the task Return result to SWF 12
  • 13. Deciders ©2016 Beamr Imaging Ltd. All Rights Reserved DECIDERS Responsible for making workflow decisions Typically a long-running process While True: Poll task-list for a decision Analyze execution history Make a decision on next step(s) Return result to SWF 13
  • 14. SWF Responsibilities ©2016 Beamr Imaging Ltd. All Rights Reserved Coordinate system components Schedule “decision tasks” (a queue?) Schedule “activity tasks” (a queue?) Maintain workflow state Catch errors and timeouts Provide an API to track workflow-execution progress Does No work. Makes No decisions. 14
  • 15. Example of Two-Task Workflow Life Cycle 15©2016 Beamr Imaging Ltd. All Rights Reserved SWF Decider Worker A Worker B start execution new exc. what to do? Schedule A starting... A task for you... Completed. Result is... New history. what now? Schedule B A task for you... Completed. Result is... New history. What now? Close. Result is... Are we done? no Are we done? Yes START ENDTask A Task B
  • 16. Tips for Activity Workers ©2016 Beamr Imaging Ltd. All Rights Reserved Do only one thing Be Stateless Catch all exceptions and return failure Send heartbeats (and check responses) While True: Poll an SWF task-list Process the task Return result to SWF 16
  • 17. Tips for Deciders ©2016 Beamr Imaging Ltd. All Rights Reserved Focus on Decision Making. Avoid doing any work. Be Stateless Decide based on entire* execution history While True: Poll SWF for an execution Analyze execution history Make a decision on next step(s) Return result to SWF Parallelize tasks when appropriate by returning multiple decisions. Catch all exceptions and always return a valid decision Expect the unexpected... (e.g. a decision may be rejected) 17
  • 18. The Execution History ©2016 Beamr Imaging Ltd. All Rights Reserved [ { "eventId": 11, "eventTimestamp": 1326671603.102, "eventType": "WorkflowExecutionTimedOut", ... }, ... { "activityTaskScheduledEventAttributes": { "activityId": "verification-27", "activityType": { "name": "activityVerify", "version": "1.0" }, ….. "input": "5634-0056-4367-0923,12/12,437", ... }, "eventId": 8, ... "eventType": "ActivityTaskScheduled" }, ... { ... "eventId": 2, "eventTimestamp": 1326668003.094, "eventType": "DecisionTaskScheduled" } ] The workflow-execution “state” It’s just json Every event is noted Decisions are noted Scheduled tasks are noted Start and Finish are noted … How to make a decision? - Read the execution history - Apply some “logic” - Return one or more decisions 18
  • 19. DEMO
  • 20. CLI Demo ©2016 Beamr Imaging Ltd. All Rights Reserved A distributed “Image Processing” workflow Prerequisites: - AWS Account, IAM Credentials - AWSCLI - bash / jq / ImageMagic / JPEGmini 20
  • 21. CLI Demo - Registration ©2016 Beamr Imaging Ltd. All Rights Reserved Register Domain / Workflow / Activity Types We use “code” to configure SWF. No CloudFormation available. LOFT_Domain demo (Domain) Process Media Ingest CleanupOptimize Thumbnail 21
  • 22. CLI Demo - Process Media Workflow ©2016 Beamr Imaging Ltd. All Rights Reserved START ENDIngest Cleanup Optimize Thumbnail Download from Web to EFS Process files on EFS Upload results to S3 Remove files form EFS 22
  • 24. Some Advanced Topics ©2016 Beamr Imaging Ltd. All Rights Reserved Child Workflows - Simplify large workflows - Reuse child-workflows Signals - Sent from somewhere (external / activity) - SWF will schedule a Decision-Task 24 [ ... { "eventId": 153, "eventTimestamp": 1326671603.102, "eventType": "WorkflowExecutionSignaled", "workflowExecutionSignaledEventAttributes"{ ... } ... }, ... ]
  • 25. High Availability ©2016 Beamr Imaging Ltd. All Rights Reserved REST API At least two deciders, and two workers of each type, across multiple zones 25
  • 26. The Execution History ©2016 Beamr Imaging Ltd. All Rights Reserved Beware of the “LastEvent” samples Note the previousStartedEventId When then History gets long - Note the nextPageToken. Pages are small (100 items). Beware of rate limits. - Cache history pages - Use ChildWorkflows or ContinueAsNewWorkflow - Use short names in input and results fields [ { "eventId": 11, "eventTimestamp": 1326671603.102, "eventType": "WorkflowExecutionTimedOut", ... }, ... { "activityTaskScheduledEventAttributes": { "activityId": "verification-27", "activityType": { "name": "activityVerify", "version": "1.0" }, ….. "input": "5634-0056-4367-0923,12/12,437", ... }, "eventId": 8, ... "eventType": "ActivityTaskScheduled" }, ... { ... "eventId": 2, "eventTimestamp": 1326668003.094, "eventType": "DecisionTaskScheduled" } ] 26
  • 27. Monitoring and Scaling ©2016 Beamr Imaging Ltd. All Rights Reserved Processes to Monitoring - Monitor each decider process - Monitor each worker process Metrics to Monitor - Activity task list sizes - Decider task list sizes - DecisionTaskScheduleToStartTime - ActivityTaskScheduleToStartTime Scale Workers with Spot instances - Use short-timeouts - Heartbeats 27
  • 28. Things Will Break... ©2016 Beamr Imaging Ltd. All Rights Reserved API calls may fail, therefore backoff and retry - Rate limiting - Network errors Expect the unexpected: - Decisions or Responses may be rejected - Closing a workflow execution could fail due to pending signals - An Activity Worker response may fail due to cancelled execution - Events may be aggregated, or delivered out of order - Task lists are only mostly FIFO 28
  • 29. Q&A
  • 30. Dan Julius VP R&D, Beamr dan@beamr.com
  • 32. Workflows vs. Messages ©2016 Beamr Imaging Ltd. All Rights Reserved A complex workflow requires more than just passing messages from task to task… Workflows have “state” Tasks might need to be synchronized Tasks can fail or timeout 32
  • 33. How SWF Works (maybe) ©2016 Beamr Imaging Ltd. All Rights Reserved SWF Worker A Worker B Decider task-list task-list task-list Execution history 33
  • 34. Poll The Manual Worker ©2016 Beamr Imaging Ltd. All Rights Reserved The worker process: While True: Poll an SWF task-list Send email to manual-worker The employee: When an email is received, Process task, and submit completion form Web Server Email Respond to SWF Submit Form SWFWorker Process Manual Labour 34
  • 35. Timeouts ©2016 Beamr Imaging Ltd. All Rights Reserved 35
  • 36. Timeouts ©2016 Beamr Imaging Ltd. All Rights Reserved 36
  • 37. More Advanced Topics ©2016 Beamr Imaging Ltd. All Rights Reserved Markers - Added by deciders - Simplify understanding history - “Milestones” Timers - Set by deciders - SWF will schedule a Decision-Task when timer fires Priorities - SWF will can re-order tasks based on Priority [ ... { "eventId": 153, "eventTimestamp": 1326671603.102, "eventType": "TimerFired", "TimerFiredEventAttributes"{ ... } ... }, ... ] 37 [ ... { "eventId": 153, "eventTimestamp": 1326671603.102, "eventType": "MarkerRecorded", "markerRecordedEventAttributes"{ ... } ... }, ... ]
  • 38. Some Concepts ©2016 Beamr Imaging Ltd. All Rights Reserved Worklow Activity Task State Logical Flow Activity Workers Asynchronous processing Distributed processing Scalability Domain Activity Type Activity Version Activity Timeouts Results Decider Input Data Events Workflow execution Execution History Polling workflowId + runId Workflow Starters decisions Activity Task Lambda Task Decision Task Task Lists 38