+ All Categories
Home > Technology > Scaling Rails Applications In The Cloud

Scaling Rails Applications In The Cloud

Date post: 22-Oct-2014
Category:
View: 6,384 times
Download: 1 times
Share this document with a friend
Description:
Mike Subelsky from OtherInbox.com describes how OtherInbox uses cloud computing to scale their Ruby on Rails application.
Popular Tags:
59
Scaling Rails Applications in the Cloud The hashtag for this talk is: #SX09-573 100 new users in < 2 hours
Transcript
Page 1: Scaling Rails Applications In The Cloud

Scaling Rails Applications in the Cloud

The hashtag for this talk is: #SX09-573

100 new users in < 2 hours

Page 2: Scaling Rails Applications In The Cloud

The

Inev

itabl

e M

ass A

dopt

ion

of O

ur P

rodu

ct

The Inexorable March of Time

Me, Josh, and a

few other people

Friends & Family

Private Beta

Public Beta

Techcrunch50

A Typical Case Study

4

8

32

Page 3: Scaling Rails Applications In The Cloud

I’m Mike Subelsky@subelsky / @otherinbox

Page 4: Scaling Rails Applications In The Cloud

What is Cloud Computing?

Page 5: Scaling Rails Applications In The Cloud

Solving problems across a flexible grid

of nodes

Page 6: Scaling Rails Applications In The Cloud

...which you consume as a utility

Page 7: Scaling Rails Applications In The Cloud

The nodes areelastic

Page 8: Scaling Rails Applications In The Cloud

The nodes areloosely coupled

Permanent Storage

Computing

Instance

Computing

Instance

Computing

Instance

Computing

Instance

Tasking System

Page 9: Scaling Rails Applications In The Cloud

The nodes aredistributed

Page 10: Scaling Rails Applications In The Cloud

The nodes areephemeral

Page 11: Scaling Rails Applications In The Cloud

The nodes aredisposable

Page 12: Scaling Rails Applications In The Cloud

What are the benefits?

Page 13: Scaling Rails Applications In The Cloud

Lower costGreater efficiencyGreater flexibility

Page 14: Scaling Rails Applications In The Cloud

You want flexibility

Page 15: Scaling Rails Applications In The Cloud

Hea

dy, V

iral

, Asy

mpt

omto

tic G

row

th o

f Use

rbas

e

The Blink of an Eye

Me, Josh, and a

few other people

Friends & Family

Private Beta

Public Beta

Techcrunch50

My Cloud Grows With Me!

4

8

32

Page 16: Scaling Rails Applications In The Cloud

What are the costs?

Page 17: Scaling Rails Applications In The Cloud

Some loss of controlPotential for lock-inGreater complexity

Page 18: Scaling Rails Applications In The Cloud

You chose a languagethat sublimates

complexity

Page 19: Scaling Rails Applications In The Cloud

Ruby Shines Here

RightAWS

aws-S3

ActiveSupport

Hpricot

Ruby/EventMachine

memcache-client

Page 20: Scaling Rails Applications In The Cloud
Page 21: Scaling Rails Applications In The Cloud

CapistranoChef

RubberPoolParty

ScalrRoll Your Own

Page 22: Scaling Rails Applications In The Cloud

What do you needto get started?

Page 23: Scaling Rails Applications In The Cloud

Permanent Storage

Computing

Instance

Computing

Instance

Computing

Instance

Computing

Instance

Tasking System

Bonus: Non-RDBMS

Page 24: Scaling Rails Applications In The Cloud

Our SkySMTP Sync

WebWorkers

StagingStaging

StagingStaging

StagingStaging

StagingStaging

StagingStaging

StagingExperiment

Master DBProcessing

Page 25: Scaling Rails Applications In The Cloud

Web Cloud

Apache HAProxy

Mongrels & Memcached

Mongrels & Memcached

Mongrels & Memcached

Master DB

JSON

HTML

Atom

S3

Message Bodies

SQS

Mailbox Export Requests,Domain Registration

Page 26: Scaling Rails Applications In The Cloud

Staging & Experiments

Page 27: Scaling Rails Applications In The Cloud

Sync Cloud

Page 28: Scaling Rails Applications In The Cloud

Autoscaling

Page 29: Scaling Rails Applications In The Cloud

SMTP Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

Page 30: Scaling Rails Applications In The Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

US-EAST-1C

US-EAST-1B

Loose Coupling Is How I Sleep At Night

Page 31: Scaling Rails Applications In The Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

US-EAST-1C

US-EAST-1B

X XX

Loose Coupling Is How I Sleep At Night

Page 32: Scaling Rails Applications In The Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

US-EAST-1C

US-EAST-1B

XX

Loose Coupling Is How I Sleep At Night

Page 33: Scaling Rails Applications In The Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

US-EAST-1C

US-EAST-1B

XX

Loose Coupling Is How I Sleep At Night

Page 34: Scaling Rails Applications In The Cloud

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

MailSenderPostfix

S3

MailParserMailReceiver

SQS

S3 File

name to

Parse

Raw Mbox File

Tasking

Raw

Mbo

x Fi

le

Master DB

US-EAST-1C

US-EAST-1B

XX

Loose Coupling Is How I Sleep At Night

Page 35: Scaling Rails Applications In The Cloud

Loose Coupling Is How I Sleep At Night

Page 36: Scaling Rails Applications In The Cloud

What It Looks Like

Page 37: Scaling Rails Applications In The Cloud

Processing Cloud

Message Created

MessageParsing QueueMessageClassfier Queue

AnyFeatureWeWant Queue

ActiveRecord callb

acks push

S3 filename

MessageParser

MessageClassifier

AnyFeatureWorker

Tasks

Page 38: Scaling Rails Applications In The Cloud

• MessageExporter

• DailyUpdateSender

• RegistrationWorker

• BackupWorker

Workers

Page 39: Scaling Rails Applications In The Cloud

The Database Is aSingle Point of

Failure

Page 40: Scaling Rails Applications In The Cloud

Master DB

EBS VolumeHourly

Snapshots

WeeklyDumps

Expensive Queries Memcached

How We Cope

Page 41: Scaling Rails Applications In The Cloud

A Dark ButIllustrative Talewith QuickTime

Page 42: Scaling Rails Applications In The Cloud
Page 43: Scaling Rails Applications In The Cloud
Page 44: Scaling Rails Applications In The Cloud
Page 45: Scaling Rails Applications In The Cloud
Page 46: Scaling Rails Applications In The Cloud

Manual Stuff

mkdir /volmount /vol /dev/sdj

sudo god start mysqld

Page 47: Scaling Rails Applications In The Cloud

Manual Stuff

change database.yml by hand (yuck)

queue mail to redeliver

Page 48: Scaling Rails Applications In The Cloud

(Wasted)Troubleshooting:

15 mins

Page 49: Scaling Rails Applications In The Cloud

Provisioning new database:

15 mins

Page 50: Scaling Rails Applications In The Cloud

If there was a next time...

Page 51: Scaling Rails Applications In The Cloud

< 10 minutes

(standard programmeroptimism applies)

Page 52: Scaling Rails Applications In The Cloud

Replication? Sharding?

Page 53: Scaling Rails Applications In The Cloud

Key-Value?Columns?

Page 54: Scaling Rails Applications In The Cloud

Logging

Logging gem

Good ol’ fashion tail

Splunk

Page 55: Scaling Rails Applications In The Cloud

Monitoring

Hoptoad

New RelicAlertra

Dash

Zenoss

RightScale

Slow query log

Page 57: Scaling Rails Applications In The Cloud

Join our team

• Ruby on Rails Developer• Ruby on Rails Intern• Product Manager

Open Positions• Smart, fun people• Startup environment• Cutting edge tech• Competitive pay• Stock options

Upgrade your job

We pay $1,000 for successful referrals!

Page 58: Scaling Rails Applications In The Cloud

rate.sxsw.com

Page 59: Scaling Rails Applications In The Cloud

Thankyou!


Recommended