66
4/20/2013 Abusing the Cloud for Fun & Profit CoderFaire Atlanta Alan Pinstein, Founder & CTO, TourBuzz http://www.tourbuzz.net http://www.showcaseIDX.com @apinstein [email protected]

Abusing the Cloud for Fun and Profit

Embed Size (px)

DESCRIPTION

How to make successful use of the cloud for your software startup. Based on 4 years of using various cloud services. Includes advice, war stories, and best practices. Presented at CoderFaire Atlanta 2013.

Citation preview

Page 1: Abusing the Cloud for Fun and Profit

4/20/2013

Abusing the Cloudfor Fun & Profit

CoderFaire Atlanta Alan Pinstein, Founder & CTO, TourBuzz

http://www.tourbuzz.nethttp://www.showcaseIDX.com

@[email protected]

Page 2: Abusing the Cloud for Fun and Profit

What is the cloud?

Page 3: Abusing the Cloud for Fun and Profit

What is the cloud?

Page 4: Abusing the Cloud for Fun and Profit

Utility Computing

✤ Bare Metal

✤ Dedicated Server

✤ VM/Shared Hosting

✤ SaaS / Software-as-a-Service

✤ PaaS / Platform-as-a-Service

?

Page 5: Abusing the Cloud for Fun and Profit

Know your place in the Stack

✤ Heroku vs EC2

Page 6: Abusing the Cloud for Fun and Profit

Know your place in the Stack

✤ Heroku vs EC2

✤ Don’t try to devops your sysadmin if you aren’t a sysadmin

Page 7: Abusing the Cloud for Fun and Profit

Know your place in the Stack

✤ Heroku vs EC2

✤ Don’t try to devops your sysadmin if you aren’t a sysadmin

✤ Move down the stack only as soon as needed

Page 8: Abusing the Cloud for Fun and Profit

Monetary Considerations

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 9: Abusing the Cloud for Fun and Profit

Monetary Considerations

✤ No up-front capital costs

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 10: Abusing the Cloud for Fun and Profit

Monetary Considerations

✤ No up-front capital costs

✤ But, more expensive cost per unit-of-work

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 11: Abusing the Cloud for Fun and Profit

Monetary Considerations

✤ No up-front capital costs

✤ But, more expensive cost per unit-of-work

✤ Matches Cost To Usage, not Capacity

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 12: Abusing the Cloud for Fun and Profit

Monetary Considerations

✤ No up-front capital costs

✤ But, more expensive cost per unit-of-work

✤ Matches Cost To Usage, not Capacity

✤ Lots of things are metered that you aren’t used to - “what gets measured gets managed”

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 13: Abusing the Cloud for Fun and Profit

Monetary Considerations

✤ No up-front capital costs

✤ But, more expensive cost per unit-of-work

✤ Matches Cost To Usage, not Capacity

✤ Lots of things are metered that you aren’t used to - “what gets measured gets managed”

✤ Potential lower TCO

http://readwrite.com/2011/01/02/how-to-save-money-by-migrating

Page 14: Abusing the Cloud for Fun and Profit

Free Tier FTW

✤ Heroku: 1 free web workerhttps://www.heroku.com/pricing

✤ Mandrill: SMTP SaaS up to 12k/mo http://mandrill.com/pricing/

✤ AWS: Free Tierhttp://aws.amazon.com/free/

Page 15: Abusing the Cloud for Fun and Profit

You cannot do this on your own.

Page 16: Abusing the Cloud for Fun and Profit

Performance Characteristics

✤ You must understand your app’s performance characteristics

Page 17: Abusing the Cloud for Fun and Profit

Performance Characteristics

✤ You must understand your app’s performance characteristics

✤ You must understand the performance characteristics of your cloud resource

Page 18: Abusing the Cloud for Fun and Profit

Performance Characteristics

✤ You must understand your app’s performance characteristics

✤ You must understand the performance characteristics of your cloud resource

✤ If they don’t match, and you have problems...

I TOLD YOU SO.

Page 19: Abusing the Cloud for Fun and Profit

AWS/EBS Volatility

http://www.stratalux.com/2012/08/09/putting-amazon’s-provisioned-iops-to-the-test/

Page 20: Abusing the Cloud for Fun and Profit

Opaque stack: performance tuning is hard

✤ Used to dedicated hardware? Get ready for shared VM performance volatility!

Page 21: Abusing the Cloud for Fun and Profit

Opaque stack: performance tuning is hard

✤ Used to dedicated hardware? Get ready for shared VM performance volatility!

✤ No idea what resource limits you’re given

Page 22: Abusing the Cloud for Fun and Profit

Opaque stack: performance tuning is hard

✤ Used to dedicated hardware? Get ready for shared VM performance volatility!

✤ No idea what resource limits you’re given

✤ Often support is hard to get or cagy about how stuff works

Page 23: Abusing the Cloud for Fun and Profit

Opaque stack: performance tuning is hard

✤ Used to dedicated hardware? Get ready for shared VM performance volatility!

✤ No idea what resource limits you’re given

✤ Often support is hard to get or cagy about how stuff works

✤ Documentation is typically not very detailed

Page 24: Abusing the Cloud for Fun and Profit

Opaque stack: performance tuning is hard

✤ Used to dedicated hardware? Get ready for shared VM performance volatility!

✤ No idea what resource limits you’re given

✤ Often support is hard to get or cagy about how stuff works

✤ Documentation is typically not very detailed

✤ See: RapGenius v Heroku

Page 25: Abusing the Cloud for Fun and Profit

✤ September 18th:Dedicated (Xen) to AWS/EC2

✤ December 10th: m1.xlarge > c1.medium

✤ March 3rd:Offload image processing to autoscaling Heroku app

Page 26: Abusing the Cloud for Fun and Profit

Should it AutoScale?

Page 27: Abusing the Cloud for Fun and Profit

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

Page 28: Abusing the Cloud for Fun and Profit

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

Page 29: Abusing the Cloud for Fun and Profit

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

Page 30: Abusing the Cloud for Fun and Profit

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

✤ Cost

Page 31: Abusing the Cloud for Fun and Profit

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

✤ Cost

✤ Performance

Page 32: Abusing the Cloud for Fun and Profit

Will it AutoScale?

Page 33: Abusing the Cloud for Fun and Profit

Will it AutoScale?

✤ Decouple independent processes

Page 34: Abusing the Cloud for Fun and Profit

Will it AutoScale?

✤ Decouple independent processes

✤ Inter-app communication must be robust

Design for Failure, and Nothing will Fail.

Page 35: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

Page 36: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.

Page 37: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.

Page 38: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.✤ DEVOPS is sustainable, but requires expertise.

Page 39: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.✤ DEVOPS is sustainable, but requires expertise.✤ Programmable infrastructure

Page 40: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.✤ DEVOPS is sustainable, but requires expertise.✤ Programmable infrastructure

✤ Not just for the data center (vagrant) ** go to Nic’s talk later today **

Page 41: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.✤ DEVOPS is sustainable, but requires expertise.✤ Programmable infrastructure

✤ Not just for the data center (vagrant) ** go to Nic’s talk later today **

✤ Automation is FREEDOM.

Page 42: Abusing the Cloud for Fun and Profit

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.✤ DBA, sysadmin. Implies people doing manual work.✤ DEVOPS is sustainable, but requires expertise.✤ Programmable infrastructure

✤ Not just for the data center (vagrant) ** go to Nic’s talk later today **

✤ Automation is FREEDOM.✤ From vendor lock-in, employee turnover,

cost of starting from scratch

Page 43: Abusing the Cloud for Fun and Profit

Tales from the cloud...

Page 44: Abusing the Cloud for Fun and Profit

Arg.

x1000

Page 45: Abusing the Cloud for Fun and Profit

Arg.

✤ CDN --> many reports of serving partial content.

x1000

Page 46: Abusing the Cloud for Fun and Profit

Arg.

✤ CDN --> many reports of serving partial content.

✤ Debugging real problems with vendors is hard.

x1000

Page 47: Abusing the Cloud for Fun and Profit

Arg.

✤ CDN --> many reports of serving partial content.

✤ Debugging real problems with vendors is hard.

✤ We had to revert.

x1000

Page 48: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

Page 49: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

Page 50: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

Page 51: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

Page 52: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

Page 53: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

Page 54: Abusing the Cloud for Fun and Profit

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

#fail

Page 55: Abusing the Cloud for Fun and Profit

WTF!

# mac laptop~ $ time cat /dev/random | head -c 10000K > /dev/nullreal 1.03suser 0.00ssys 1.01s

Page 56: Abusing the Cloud for Fun and Profit

WTF!

# heroku~ $ time cat /dev/random | head -c 100 > /dev/nullreal 0m8.430suser 0m0.020ssys 0m0.000s

# mac laptop~ $ time cat /dev/random | head -c 10000K > /dev/nullreal 1.03suser 0.00ssys 1.01s

Page 57: Abusing the Cloud for Fun and Profit

WTF!

# heroku~ $ time cat /dev/random | head -c 100 > /dev/nullreal 0m8.430suser 0m0.020ssys 0m0.000s

# mac laptop~ $ time cat /dev/random | head -c 10000K > /dev/nullreal 1.03suser 0.00ssys 1.01s

✤ Heroku has very little entropy

✤ Caused sleep & usleep to be “lazy”; use nanosleep instead.

Page 58: Abusing the Cloud for Fun and Profit

WTF?!

$ s3cmd put file.jpg s3://mybucket/file.jpg=> 200 OK

$ curl http://mybucket/file.jpg=> 404 file not found

$ sleep 5 && curl http://mybucket/file.jpg=> 200 OK

Eventually consistent....

Page 59: Abusing the Cloud for Fun and Profit

Stuff that went right

✤ Increased application performance

✤ Sleep better at night

✤ Save a lot of money

✤ Clear path for scaling as we grow that should avoid hair-on-fire emergencies

✤ FREEDOM: options and flexibility

Page 60: Abusing the Cloud for Fun and Profit

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

Page 61: Abusing the Cloud for Fun and Profit

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

Page 62: Abusing the Cloud for Fun and Profit

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

✤ Expectations - from your team and vendors

Page 63: Abusing the Cloud for Fun and Profit

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

✤ Expectations - from your team and vendors

✤ Architecture

Page 64: Abusing the Cloud for Fun and Profit

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

✤ Expectations - from your team and vendors

✤ Architecture

✤ Contingency plans

Page 65: Abusing the Cloud for Fun and Profit

We are hiring!