Abusing the Cloud for Fun and Profit

Preview:

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

4/20/2013

Abusing the Cloudfor Fun & Profit

CoderFaire Atlanta Alan Pinstein, Founder & CTO, TourBuzz

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

@apinsteinapinstein@mac.com

What is the cloud?

What is the cloud?

Utility Computing

✤ Bare Metal

✤ Dedicated Server

✤ VM/Shared Hosting

✤ SaaS / Software-as-a-Service

✤ PaaS / Platform-as-a-Service

?

Know your place in the Stack

✤ Heroku vs EC2

Know your place in the Stack

✤ Heroku vs EC2

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

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

Monetary Considerations

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

Monetary Considerations

✤ No up-front capital costs

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

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

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

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

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

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/

You cannot do this on your own.

Performance Characteristics

✤ You must understand your app’s performance characteristics

Performance Characteristics

✤ You must understand your app’s performance characteristics

✤ You must understand the performance characteristics of your cloud resource

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.

AWS/EBS Volatility

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

Opaque stack: performance tuning is hard

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

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

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

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

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

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

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

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

Should it AutoScale?

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

✤ Cost

Should it AutoScale?

✤ Volatile load (minutes/hours/days)

✤ Volatile load (months/years)

✤ Scaling up vs Scaling down

✤ Cost

✤ Performance

Will it AutoScale?

Will it AutoScale?

✤ Decouple independent processes

Will it AutoScale?

✤ Decouple independent processes

✤ Inter-app communication must be robust

Design for Failure, and Nothing will Fail.

Using the Cloud Successfully means Changing the way you build apps

Using the Cloud Successfully means Changing the way you build apps

✤ Automate everything. You will start from scratch frequently.

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.

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.

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

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 **

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.

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

Tales from the cloud...

Arg.

x1000

Arg.

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

x1000

Arg.

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

✤ Debugging real problems with vendors is hard.

x1000

Arg.

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

✤ Debugging real problems with vendors is hard.

✤ We had to revert.

x1000

WTF.

$ heroku ps:scale workers=20

WTF.

$ heroku ps:scale workers=20

WTF.

$ heroku ps:scale workers=20

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

WTF.

$ heroku ps:scale workers=20

$ heroku ps:scale workers=10

#fail

WTF!

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

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

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.

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....

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

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

✤ Expectations - from your team and vendors

Plan your trip in the cloud

✤ “Design for failure, and nothing will fail”

✤ Choose vendors carefully

✤ Expectations - from your team and vendors

✤ Architecture

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

We are hiring!

Q & AAlan Pinstein

@apinsteinapinstein@mac.com

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