Click here to load reader
Upload
launchany
View
1.356
Download
0
Embed Size (px)
DESCRIPTION
Learn what Heroku is about, where it can be a good fit, and how much it costs compared to using Amazon EC2.
Citation preview
Getting Started with Heroku
Platform-as-a-Service“Provision App Environments, Not
Servers”
Common Use Cases• Launching and scaling apps without IT/server scripting• Deploying MVPs• Situational/Internal Apps• Mobile API/Backend
How It Works1. Provision Application w/ Heroku2. Heroku creates a hosted Git Repository3. Provision Services and Options (“Add-ons”)4. Configure your application using ENV vars5. Push to your application’s Git repository to Heroku
Dynos
• Dyno == 1 Process (one free Dyno per app per month)• Support Ruby, Java/JVM, Node.js, Python, others• Additional Dynos: $0.05/hour == $36/month• Each process can run up to ~15 threads• Thin with threadsafe Rails: 1 process/15 threads• Unicorn: 3 processes/45 threads• Limited by soft memory cap of 512MB per process
Database• PostgreSQL 9.1• Shared – 5GB (free) or 20GB ($15/month)• Production - $50 to $6400/month based on
storage/CPU/Cache• 1 TB max
Add-ons• Heroku Add-ons (CNAME, SSL, pg backup, etc)• Third-party (New Relic, MongoHQ, Memcached, etc)• Config and Customization often free or low cost• Some third party are free, most have tiered pricing
$ heroku addons:add ssl:endpoint
The Procfile$APP_ROOT/Procfile:
web: bundle exec rails server -p $PORT worker: bundle exec rake resque:work QUEUE=* urgentworker: bundle exec rake resque:work QUEUE=urgent
Scaling Processes$ heroku scale worker=1scaling processes... done
Viewing Processes$ heroku ps Process State Command ----------- ----------- ----------------------------- web.1 up for 6s bundle exec rails server worker.1 up for 5s bundle exec rake resque:work
Viewing Logs$ heroku logs --tail 2012-07-09 19:04:48 heroku[router] GET / dyno=web.1 2012-07-09 19:04:48 app[web.1] 66.75.123.123 - -
Cost Analysis:Production Rails App
• Rails 3.2• Background workers• PostgreSQL Relational DB• MongoDB Document-Oriented DB
Rails App• 3 processes (1 free dyno + 2 dynos)• 2 worker processes (+2 dynos)• Total cost for dynos: 4 * $36 = $144/month
App Add-ons• Custom Domain (now default) - FREE• New Relic Standard – FREE• PostgreSQL Backups – FREE • PostgreSQL w/ 400MB Cache - $50/month• SSL Endpoint - $20/month• Memcache 100MB - $20/month• MongoHQ Small - $15/month• Total cost w/ dynos: $249/month
• First year cost: $2988
AWS ComparisonOn Demand Pricing (us-west):• EC2 Small x 2 (Rails/Memcache) = $0.18/hour = $130/month• EC2 Small x 2 (Mongo+PostgreSQL) = $0.18/hour =
$130/month• EC2 + ELB Bandwidth = ~$20.00/month• Total cost: $280/month + server scripting/setup cost
• First year cost: $3660
AWS Comparison (con’t)
Reserved Pricing (us-west) 1 year term:• EC2 Small x 2 (Rails/Memcache) = $0.05/hour =
$36/month• One-time setup $195 x 2
• EC2 Small x 2 (Mongo+PostgreSQL) = $0.05/hour = $36/month• One-time setup $195 x 2
• EC2 + ELB Bandwidth = ~$20.00/month• Total cost: $780 setup + $92/month + server
scripting/setup cost
• First year cost: $1884
AWS Comparison (con’t)
Reserved Pricing (us-west) 1 year term + 3rd party DB mgmt:• EC2 Small x 2 (Rails/Memcache) = $0.05/hour =
$36/month• One-time setup $195 x 2
• MongoHQ = $49/month• Heroku PostgreSQL = $50/month• EC2 + ELB Bandwidth = ~$20.00/month• Total cost: $780 setup + $155/month + server
scripting/setup cost
• First year cost: $2640
Thank youJames Higginbotham
[email protected]@launchany