Clouds against the Floods (RubyConfBR2011)

95
Leonardo Borges Clouds against the floods or how RoR saved the day in Australia Monday, 7 November 2011

Transcript of Clouds against the Floods (RubyConfBR2011)

Page 1: Clouds against the Floods (RubyConfBR2011)

Leonardo Borges

Clouds against the floodsor how RoR saved the day in Australia

Monday, 7 November 2011

Page 2: Clouds against the Floods (RubyConfBR2011)

self slide• ThoughtWorker in Sydney, Australia• Programming languages enthusiast• Blogger - leonardoborges.com• Twitter blabbermouth @leonardo_borges• Seldom OSS contributor - github.com/leonardoborges

Monday, 7 November 2011

Page 3: Clouds against the Floods (RubyConfBR2011)

self slide• ThoughtWorker in Sydney, Australia• Programming languages enthusiast• Blogger - leonardoborges.com• Twitter blabbermouth @leonardo_borges• Seldom OSS contributor - github.com/leonardoborges

...and also • Heavy Metal guitarist • Singer• Overall adrenaline junkie

Monday, 7 November 2011

Page 4: Clouds against the Floods (RubyConfBR2011)

Let’s step back for a sec...

Monday, 7 November 2011

Page 5: Clouds against the Floods (RubyConfBR2011)

Heroku, an overview

Monday, 7 November 2011

Page 6: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts

Monday, 7 November 2011

Page 7: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts • PaaS

Monday, 7 November 2011

Page 8: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts • PaaS• Git based deployment cycle

Monday, 7 November 2011

Page 9: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts • PaaS• Git based deployment cycle• Dynos (web processes)

Monday, 7 November 2011

Page 10: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts • PaaS• Git based deployment cycle• Dynos (web processes)• Workers (background processes)

Monday, 7 November 2011

Page 11: Clouds against the Floods (RubyConfBR2011)

Heroku, an overviewBasic concepts • PaaS• Git based deployment cycle• Dynos (web processes)• Workers (background processes)• Cron

Monday, 7 November 2011

Page 12: Clouds against the Floods (RubyConfBR2011)

Simplistic view of a web requestrequest

routing

dyno

Monday, 7 November 2011

Page 13: Clouds against the Floods (RubyConfBR2011)

Simplistic view of a web requestrequest

routing

dynodynodynodyno dynodynodyno

dynodynodynodyno dynodynodyno

Monday, 7 November 2011

Page 14: Clouds against the Floods (RubyConfBR2011)

A typical setup

Monday, 7 November 2011

Page 15: Clouds against the Floods (RubyConfBR2011)

A typical setupEnvironments

Monday, 7 November 2011

Page 16: Clouds against the Floods (RubyConfBR2011)

A typical setupEnvironments • staging, showcase and production

Monday, 7 November 2011

Page 17: Clouds against the Floods (RubyConfBR2011)

A typical setupEnvironments • staging, showcase and production

Environments

Monday, 7 November 2011

Page 18: Clouds against the Floods (RubyConfBR2011)

A typical setupEnvironments • staging, showcase and production

Environments • staging, showcase and production

Monday, 7 November 2011

Page 19: Clouds against the Floods (RubyConfBR2011)

A typical setupEnvironments • staging, showcase and production

Environments • staging, showcase and production

Branching strategy• develop• master (tagged release candidates)

Monday, 7 November 2011

Page 20: Clouds against the Floods (RubyConfBR2011)

But before you get too excited...

Monday, 7 November 2011

Page 21: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

Monday, 7 November 2011

Page 22: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system

Monday, 7 November 2011

Page 23: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system• 30 seconds cap on http requests

Monday, 7 November 2011

Page 24: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system• 30 seconds cap on http requests• The console hijacks the web processes

Monday, 7 November 2011

Page 25: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system• 30 seconds cap on http requests• The console hijacks the web processes• Processes limited to 300MB 512MB of RAM

Monday, 7 November 2011

Page 26: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system• 30 seconds cap on http requests• The console hijacks the web processes• Processes limited to 300MB 512MB of RAM• Busted IP based SSL solution

Monday, 7 November 2011

Page 27: Clouds against the Floods (RubyConfBR2011)

Catches & restrictions

• Read-only file system• 30 seconds cap on http requests• The console hijacks the web processes• Processes limited to 300MB 512MB of RAM• Busted IP based SSL solution• ... and for Australia, latency

Monday, 7 November 2011

Page 28: Clouds against the Floods (RubyConfBR2011)

Troubleshooting

Monday, 7 November 2011

Page 29: Clouds against the Floods (RubyConfBR2011)

Troubleshooting• NewRelic: essencial to spot bottlenecks• database• external services - paypal, memcached• application

• Heroku logs

Monday, 7 November 2011

Page 30: Clouds against the Floods (RubyConfBR2011)

Performance

Monday, 7 November 2011

Page 31: Clouds against the Floods (RubyConfBR2011)

Performance• ORMs are dumb

Monday, 7 November 2011

Page 32: Clouds against the Floods (RubyConfBR2011)

Performance• ORMs are dumb• Offload stats from main DB

Monday, 7 November 2011

Page 33: Clouds against the Floods (RubyConfBR2011)

Performance• ORMs are dumb• Offload stats from main DB• Cache everything but not until you really need it

Monday, 7 November 2011

Page 34: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon Cedar

Monday, 7 November 2011

Page 35: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta)

Monday, 7 November 2011

Page 36: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile

Monday, 7 November 2011

Page 37: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes

Monday, 7 November 2011

Page 38: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes• Node.js/Clojure/Java/Python...

Monday, 7 November 2011

Page 39: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes• Node.js/Clojure/Java/Python...• New HTTP stack

Monday, 7 November 2011

Page 40: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes• Node.js/Clojure/Java/Python...• New HTTP stack• The foreman gem

Monday, 7 November 2011

Page 41: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes• Node.js/Clojure/Java/Python...• New HTTP stack• The foreman gem• Strive for purism

Monday, 7 November 2011

Page 42: Clouds against the Floods (RubyConfBR2011)

The new Heroku:Celadon CedarNew features (most in public beta) • The procfile• One-off processes• Node.js/Clojure/Java/Python...• New HTTP stack• The foreman gem• Strive for purism• In the horizon (no ETA) : multi-region availability

Monday, 7 November 2011

Page 43: Clouds against the Floods (RubyConfBR2011)

The Procfile

Monday, 7 November 2011

Page 44: Clouds against the Floods (RubyConfBR2011)

The ProcfileRun anything

Monday, 7 November 2011

Page 45: Clouds against the Floods (RubyConfBR2011)

The ProcfileRun anything

Rails

web: bundle exec rails server -p $PORTworker: bundle exec rake jobs:work

Node.js

web: node web.js

Clojure

web: lein run -m demo.web

Monday, 7 November 2011

Page 46: Clouds against the Floods (RubyConfBR2011)

Multi-Region Availability

Monday, 7 November 2011

Page 47: Clouds against the Floods (RubyConfBR2011)

Multi-Region Availability• Not here yet...

Monday, 7 November 2011

Page 48: Clouds against the Floods (RubyConfBR2011)

Multi-Region Availability• Not here yet...

• DIY cloud availability

Monday, 7 November 2011

Page 49: Clouds against the Floods (RubyConfBR2011)

Back in late 2010

Monday, 7 November 2011

Page 50: Clouds against the Floods (RubyConfBR2011)

Back in late 2010

• 75% of Queensland under water

Monday, 7 November 2011

Page 51: Clouds against the Floods (RubyConfBR2011)

Back in late 2010

• 75% of Queensland under water

• 35 dead / 9 missing

Monday, 7 November 2011

Page 52: Clouds against the Floods (RubyConfBR2011)

Back in late 2010

• 75% of Queensland under water

• 35 dead / 9 missing

• A$ 30 billion in damages

Monday, 7 November 2011

Page 53: Clouds against the Floods (RubyConfBR2011)

Appeal to the people

Monday, 7 November 2011

Page 54: Clouds against the Floods (RubyConfBR2011)

Appeal to the people

• QLD Government to run a telethon on Channel Nine

Monday, 7 November 2011

Page 55: Clouds against the Floods (RubyConfBR2011)

Appeal to the people

• QLD Government to run a telethon on Channel Nine

• Dry run of existing system showed problems

Monday, 7 November 2011

Page 56: Clouds against the Floods (RubyConfBR2011)

Appeal to the people

• QLD Government to run a telethon on Channel Nine

• Dry run of existing system showed problems

• Backup plan?

Monday, 7 November 2011

Page 57: Clouds against the Floods (RubyConfBR2011)

We can help!

Monday, 7 November 2011

Page 58: Clouds against the Floods (RubyConfBR2011)

We can help!

• ThoughtWorks offered help

Monday, 7 November 2011

Page 59: Clouds against the Floods (RubyConfBR2011)

We can help!

• ThoughtWorks offered help

• We were at the beach

Monday, 7 November 2011

Page 60: Clouds against the Floods (RubyConfBR2011)

We can help!

• ThoughtWorks offered help

• We were at the beach

• and had 48hs to deliver!

Monday, 7 November 2011

Page 61: Clouds against the Floods (RubyConfBR2011)

We can help!

• ThoughtWorks offered help

• We were at the beach

• and had 48hs to deliver!

Monday, 7 November 2011

Page 62: Clouds against the Floods (RubyConfBR2011)

What?!

Monday, 7 November 2011

Page 63: Clouds against the Floods (RubyConfBR2011)

What?!

• Payment gateway integration

Monday, 7 November 2011

Page 64: Clouds against the Floods (RubyConfBR2011)

What?!

• Payment gateway integration

• Donation receipts by email (thousands of them)

Monday, 7 November 2011

Page 65: Clouds against the Floods (RubyConfBR2011)

What?!

• Payment gateway integration

• Donation receipts by email (thousands of them)

• Ability to scale based on load

Monday, 7 November 2011

Page 66: Clouds against the Floods (RubyConfBR2011)

What?!

• Payment gateway integration

• Donation receipts by email (thousands of them)

• Ability to scale based on load

user

app

paymentgateway DB mail

gateway

varnish

Monday, 7 November 2011

Page 67: Clouds against the Floods (RubyConfBR2011)

Challenges

Monday, 7 November 2011

Page 68: Clouds against the Floods (RubyConfBR2011)

Challenges

• SSQ’s infra-structure was a no go

Monday, 7 November 2011

Page 69: Clouds against the Floods (RubyConfBR2011)

Challenges

• SSQ’s infra-structure was a no go

• Had to come up with a solution for email sending as well

Monday, 7 November 2011

Page 70: Clouds against the Floods (RubyConfBR2011)

Challenges

• SSQ’s infra-structure was a no go

• Had to come up with a solution for email sending as well

• Skepticism

Monday, 7 November 2011

Page 71: Clouds against the Floods (RubyConfBR2011)

Choices

Monday, 7 November 2011

Page 72: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS

Monday, 7 November 2011

Page 73: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

Monday, 7 November 2011

Page 74: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku

Monday, 7 November 2011

Page 75: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops

Monday, 7 November 2011

Page 76: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push

Monday, 7 November 2011

Page 77: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push- Focus on your app

Monday, 7 November 2011

Page 78: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push- Focus on your app- Dozens of add-ons out of the box

Monday, 7 November 2011

Page 79: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push- Focus on your app- Dozens of add-ons out of the box- $0.00 upfront cost

Monday, 7 November 2011

Page 80: Clouds against the Floods (RubyConfBR2011)

Choices

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push- Focus on your app- Dozens of add-ons out of the box- $0.00 upfront cost

• AWS- Cheaper but require ops

• Heroku- PaaS - no/less ops- As simple as a git push- Focus on your app- Dozens of add-ons out of the box- $0.00 upfront cost

Monday, 7 November 2011

Page 81: Clouds against the Floods (RubyConfBR2011)

Ben Barnard, Phillip Calçado and myself

One last ingredient...

Monday, 7 November 2011

Page 82: Clouds against the Floods (RubyConfBR2011)

Ben Barnard, Phillip Calçado and myself

One last ingredient...

An awesome team, committed and having fun on a weekend :)

Monday, 7 November 2011

Page 83: Clouds against the Floods (RubyConfBR2011)

The telethon

Monday, 7 November 2011

Page 84: Clouds against the Floods (RubyConfBR2011)

The telethon

• Live on channel 9 for 2 hours

Monday, 7 November 2011

Page 85: Clouds against the Floods (RubyConfBR2011)

The telethon

• Live on channel 9 for 2 hours

• SSQ’s app went down at the very start

Monday, 7 November 2011

Page 86: Clouds against the Floods (RubyConfBR2011)

The telethon

• Live on channel 9 for 2 hours

• SSQ’s app went down at the very start

• The “backup” plan was now the main app

Monday, 7 November 2011

Page 87: Clouds against the Floods (RubyConfBR2011)

What we achieved

Monday, 7 November 2011

Page 88: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

Monday, 7 November 2011

Page 89: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

• Developed a production ready donation app using Ruby on Rails

Monday, 7 November 2011

Page 90: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

• Developed a production ready donation app using Ruby on Rails

• Leveraged PaaS to get ops out of the way

Monday, 7 November 2011

Page 91: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

• Developed a production ready donation app using Ruby on Rails

• Leveraged PaaS to get ops out of the way

• Generated over A$ 2 million in donations during the telethon

Monday, 7 November 2011

Page 92: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

• Developed a production ready donation app using Ruby on Rails

• Leveraged PaaS to get ops out of the way

• Generated over A$ 2 million in donations during the telethon

• And over A$ 38 million since then

Monday, 7 November 2011

Page 93: Clouds against the Floods (RubyConfBR2011)

What we achievedDespite all skepticism we...

• Developed a production ready donation app using Ruby on Rails

• Leveraged PaaS to get ops out of the way

• Generated over A$ 2 million in donations during the telethon

• And over A$ 38 million since then

...all in a 48 hour effort Monday, 7 November 2011

Page 94: Clouds against the Floods (RubyConfBR2011)

Anyone still thinks ‘the cloud’ isn’t for serious stuff?

Monday, 7 November 2011

Page 95: Clouds against the Floods (RubyConfBR2011)

Thanks for listening!Questions?

@leonardo_borges www.leonardoborges.com

Leonardo Borges

Monday, 7 November 2011