Amazon SWF and Gordon

33
Amazon SWF Ruby User Group Berlin Peritor GmbH

description

Presentation about Amazon SWF and the Gordon Ruby framework by Jonathan Weiss at the Ruby Yser Group Berlin on May 3rd 2012.

Transcript of Amazon SWF and Gordon

Page 1: Amazon SWF and Gordon

Amazon SWF Ruby User Group Berlin

Peritor GmbH

Page 2: Amazon SWF and Gordon

EC2 & Eucalyptus Cluster Management

§  Automatic Configuration

§  Self Healing Clusters

§  Auto Scaling Clusters

§  One Click Deployment

§  One Click Cluster Cloning

§  Monitoring & Alerting

§  Logs & Accounting

§  Firewalls & Backups

§  Access & Rights Management

2

Page 3: Amazon SWF and Gordon

Architecture

3

DB

Web���App

Page 4: Amazon SWF and Gordon

Architecture

4

DB

Web���App

EC2

S3

Euca

Page 5: Amazon SWF and Gordon

Architecture

5

DB

Web���App

EC2

S3

Euca

Agent

RabbitMQ

Page 6: Amazon SWF and Gordon

RabbitMQ

6

Page 7: Amazon SWF and Gordon

RabbitMQ

7 http://www.heavensend-design.com/happy/

Page 8: Amazon SWF and Gordon

Agent/Queue Requirements

§ Scalability We manage thousands of instances

§ Availability & Reliability We need to be available even if an AWS region fails

8

Page 9: Amazon SWF and Gordon

DJ?

9

Page 10: Amazon SWF and Gordon

Resque?

10

Page 11: Amazon SWF and Gordon

Hmmmmm….

11

Page 12: Amazon SWF and Gordon

12

Page 13: Amazon SWF and Gordon

SWF: Simple Workflow Service

From http://aws.amazon.com/swf/

§ Maintains application state

§ Tracks workflow executions and logs their progress

§ Holds and dispatches tasks

§ Controls which tasks each of your application hosts will be assigned to execute

13

Page 14: Amazon SWF and Gordon

SWF: Simple Workflow Service

“Workflows as a Service”

§ Hosted

§ Scalable § Consistent (uses DynamoDB for state)

14

Page 15: Amazon SWF and Gordon

SWF: Pricing

§ $0.0001 per workflow execution

§ Until a Workflow Execution completes: $0.000005 per workflow execution for every 24-hours

§ $0.000005 per retained workflow execution per day

+ traffic

15

Page 16: Amazon SWF and Gordon

SWF: Workflow

16

Start ���Instance

Observe���Start

Send Init JSON

Cleanup

Activity 1 Activity 2 Activity 3

Activity 4

Page 17: Amazon SWF and Gordon

SWF: Architecture

17 http://docs.amazonwebservices.com/amazonswf/latest/developerguide/swf-welcome.html?r=8856

Page 18: Amazon SWF and Gordon

SWF: Decider

§  Implements workflow logic

§ Gets history of events

§ Decides what to do next: §  Call next activity

§  Abort workflow

§  Re-schedule

§  …

18

Page 19: Amazon SWF and Gordon

SWF: Worker

§  Implements activity logic

§ Gets input for current activity

§ Processes activity: §  Complete

§  Fail

§  Timeout

§  Heartbeat

19

Page 20: Amazon SWF and Gordon

Separate Task Order/Graph From Task Implementation

20

Worker Decider

Page 21: Amazon SWF and Gordon

21

Page 22: Amazon SWF and Gordon

Gordon

Ruby framework to use SWF

§ Syntactic sugar for creation of deciders and activities

§ Daemons for processing tasks

§ Unicorn-style master/child handling of processes

22

Page 23: Amazon SWF and Gordon

Gordon: Decider

23

Page 24: Amazon SWF and Gordon

Gordon: Decider

24

Page 25: Amazon SWF and Gordon

Gordon: Activity

25

Page 26: Amazon SWF and Gordon

Gordon: Start Workflow

26

Page 27: Amazon SWF and Gordon

Gordon: Processing

27

Page 28: Amazon SWF and Gordon

Gordon: Processing

28

Page 29: Amazon SWF and Gordon

Gordon: config.decider.yml

29

Page 30: Amazon SWF and Gordon

DEMO

30

Page 31: Amazon SWF and Gordon

Available soon at http://github.com/scalarium/gordon

Under Apache 2 license

31

Page 32: Amazon SWF and Gordon

SWF: Simple Workflow Service

Many nice features

§ Retention period

§ Task lists

§ Timeouts §  Event history

§ Abort/cancel/re-schedule

§ Delay

§ Mark & count

§  ...

32

Page 33: Amazon SWF and Gordon

We’re Hiring!

DevOps

§  Scalarium operations

§  Write and maintain Chef cookbooks

§  Improve and scale backend

§  Security

§  Help us support more OSs

§  Vagrant integration

33

Ruby Developers

§  Rails frontend

§  Ruby backend / agents

§  Chef

§  Scaling evented agents

§  API

§  Command line tools

§  EC2, S3, SWF, SQS, …

[email protected]