Cloudcamp Athens 2011 Presenting Heroku
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Cloudcamp Athens 2011 Presenting Heroku

on

  • 4,612 views

 

Statistics

Views

Total Views
4,612
Views on SlideShare
3,488
Embed Views
1,124

Actions

Likes
0
Downloads
3
Comments
0

8 Embeds 1,124

http://www.savvas.me 1110
http://a0.twimg.com 7
http://webcache.googleusercontent.com 2
http://us-w1.rockmelt.com 1
http://us-w1.rockmelt.com 1
http://translate.yandex.net 1
http://www.linkedin.com 1
http://translate.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Cloudcamp Athens 2011 Presenting Heroku Presentation Transcript

  • 1. Heroku The platform for your next awesome app. 1Monday, October 3, 11
  • 2. In a nutshell Platform as Service Ruby on Rails & lately NodeJS, Java, Clojure on top of AWS. Founded 2007 - Bought in 2010 from Salesforce ($212M) 194.000 apps NOW. ~30% from mobile applications. RESTful services. Special deal with Facebook for FB app hosting. Jul 2011, Matz (Yukihiro Matsumoto) joined heroku as Chief Architect, Ruby [1] Remember: MRI stands for Matz’s Ruby Interpreter CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 2Monday, October 3, 11
  • 3. Summary - Index Infrastructure Deploying Hardware - Parking. Git - Rollback - Migrating. Network Interface Scaling Routing Mesh = Magic Easier than ever. Database Monitoring Postgresql, NoSQL solutions Logging - Exception Tracking Process Model & Dyno Zooming in the heart of Heroku Effective Cloud Hosting Stacks & Frameworks Taking advantage of Pricing / process model Add ons AutoScale web processes A sweet surprise AutoScale background jobs CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 3Monday, October 3, 11
  • 4. Infrastructure Build atop of Amazon Web Services Cedar Stack: on High Memory Double Extra Large Instances [2] 35 GB Ram 13 EC2 Compute Units. maybe ~ 120 Dynos per Instance Database on EC2 - EB storage mhhh (see April’s outage incident) CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 4Monday, October 3, 11
  • 5. Infrastructure Not in Cedar Stack CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 5Monday, October 3, 11
  • 6. Network Interface DNS Seems to be 6 nginx reverse proxies + any dedicated IP/proxy ($100 / month) (proxy.heroku.com) Routing Mesh Routing software written in Erlang. (seems to have some secret sauce) If no live dyno is found for this app’s route, a new dyno is spawned. HTTP Caching < Stack Cedar: Varnish Reverse Proxy Caching via HTTP headers, HTTP 1.0 compatible. >= Cedar: No Reverse Proxy Caching, HTTP 1.1 Compatible, Routes directly to dynos: Non-blocking servers (Goliath / EventMaching) - Long Polling CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 6Monday, October 3, 11
  • 7. Heroku Dyno A dyno is a single (isolated) process of any type, running on the Heroku platform Mongrel, Thin, Delayed Job, Resque, Workers... Dyno Manifold manages the resources. Any number of dynos / application w/ the latest code compiled and deployed. Crashed dynos are closed and restarted automatically. Dynos are isolated: LXC & Chroot for isolated user space / resources / filesystem. [4] 512 Mb Ram. Cost per Dyno (dyno-hour) 1 Dyno for Free. $ 0.05 / hour = $ 35 / month / dyno --- 6 minutes = 0.1 dyno-hour = $ 0.005 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 7Monday, October 3, 11
  • 8. Dyno’s Process Model of Cedar Dyno Manifold does the Process Management Starts / Stops / Restarts / Idles the processes / Sets config Vars / Applies Code Releases All the possible Process Types (servers, workers,..) are described in a procfile. Procfile is a file on the root of your app and describes any needed process that you want to run (and scale) web: bundle exec rails server -p $PORT worker: bundle exec rake jobs:work scraper: bundle exec ruby scraper.rb Foreman is a ruby Gem handling profiles for the Development Environment. Scale Preview $ heroku scale web=3 worker=2 scraper=2 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 8Monday, October 3, 11
  • 9. Database - SQL solutions. PostgreSQL Shared database PostgreSQL 8.3 - Dedicated database uses PostgreSQL 9. Continues Backups [3] Storing on EBS volumes of AmazonWS (“With this information in hand, well be taking a hard look on how to reduce our dependence on EBS”) [3] External Connections are NOT allowed Goodies Backups - psqldump Database Sync with TAPS Is currently a DaaS for Heroku - encouraging polyglot CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 9Monday, October 3, 11
  • 10. Database - noSQL solutions DaaS is (maybe) the future of complex web applications Heroku Supports encourages the polyglot concept Redis for your Ad Service / counters etc. Hadoop for your big data tables S3 for your Assets Memcache for transient data such as Sessions CouchDB for data that need to be replicated (your separate mobile app database) Neo4j for your super clever recommendation engine Currently most of theses DaaS offer an add-on for HEROKU. CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 10Monday, October 3, 11
  • 11. Stacks & Frameworks Zooming in Cedar Stack OS: Ubuntu Server 10.04 (Lucid Lynx) - Ruby: MRI 1.9.2 - Bundler: 1.1pre5 - Node.js: 0.4.7 - NPM: 1.0.6 - JVM: OpenJDK 6 Migration between stacks is allowed >> heroku stack:migrate bamboo-mri-1.9.2 Rails 3, NodeJs, JAVA & Spring, Python (private beta), Clojure CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 11Monday, October 3, 11
  • 12. Add ons Services Implement Heroku’s Add-ons API for automate provisioning MYSQL_URL=mysql://user:pass@mysqlhost.net/database Dyno Manifold will Restart all the running Dynos, including the new ENV variables. CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 12Monday, October 3, 11
  • 13. Deploying. Based on Git. Heroku is a git remote for your code. $ git remote add heroku git@heroku.com:myapp.git When receiving a push (git push heroku master) starts the deployment process bundle install Remove unused files, including the .git directory, anything in log and tmp, .gem files in the bundled gems directory, and anything specified in .slugignore. Write the environment into the slug. (The slug is rebuilt any time a config var or add-on is changed) Package into the final slug archive. Slug Size Matters: Larger Slug == slower distribution < 30 MB CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 13Monday, October 3, 11
  • 14. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line $ heroku scale web=3 worker=2 scraper=2 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 14Monday, October 3, 11
  • 15. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line Web Interface CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 15Monday, October 3, 11
  • 16. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line Web Interface Ruby Script (wait for it...) CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 16Monday, October 3, 11
  • 17. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line $ heroku scale web=3 worker=2 scraper=2 Web Interface Ruby Script (wait for it...) Mobile App (Nazumi App) CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 17Monday, October 3, 11
  • 18. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line $ heroku scale web=3 worker=2 scraper=2 Web Interface Ruby Script (wait for it...) Mobile App (Nazumi App) CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 18Monday, October 3, 11
  • 19. Scaling Concept: More Dynos = Better Concurrency Unlimited Number of Dynos / Application. Command Line Web Interface Ruby Script (wait for it...) Mobile App (Nazumi App) Database Scaling Ika: $800/month, 50 connections, 7.5 GB of RAM, 4 compute units PostgreSQL 9 Baku: $3200/month, 128 connections, 34 GB of RAM, 13 cu Mecha: $6400/month, 256 connections, 68 GB of RAM, 26 cu Amazon RDS addon NoSQL solutions CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 19Monday, October 3, 11
  • 20. Monitoring Heroku Logs heroku logs everything NginX - Routing Mesh - Every Dyno (web, worker, custom) $ heroku logs --tail $ heroku logs --source heroku --ps router $ heroku logs -s app -p worker.1 $ heroku logs --ps postgres Only for dedicated Database Add-ons New Relic Airbrake (HopToad) StillAlive CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 20Monday, October 3, 11
  • 21. Heroku Billing Model 100% Based on it’s process model Dynos are billed per second at a rate of 0.05$ / hour First Dyno is FREE (Watch out: single Dyno Idling Policy can cause delays) Add-ons are billed per second. Databases are billed per hour. 1 web server + 1 worker + Shared Database (20GB) = 1x36 + 1x36 + 15 = 87$ /month CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 21Monday, October 3, 11
  • 22. Heroku can be even more elastic Dyno #1 1 Dyno #2 Large Dyno #3 Elastic Dyno #4 Dyno #5 Dyno #6 ~ Dyno #7 Dyno #8 4.7 GB Dyno #9 ram Dyno #10 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 22Monday, October 3, 11
  • 23. Heroku can be even more elastic Dyno #1 1 Dyno #2 Large Dyno #3 Elastic Dyno #4 Dyno #5 Dyno #6 ~ Dyno #7 Dyno #8 4.7 GB Dyno #9 ram Dyno #10 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 23Monday, October 3, 11
  • 24. Heroku can be even more elastic Dyno #1 1 Dyno #2 Large Dyno #3 Elastic Dyno #4 Dyno #5 Dyno #6 ~ Dyno #7 Dyno #8 4.7 GB Dyno #9 ram Dyno #10 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 24Monday, October 3, 11
  • 25. Heroku can be even more elastic Dyno #1 1 Dynos => $ 0.5/h 10 Dyno #2 Large 1 LARGE => $ 0.35/h Dyno #3 Elastic HEROKU = 42% more expensive Dyno #4 Dyno #5 Dyno #6 ~ Dyno #7 Dyno #8 4.7 GB Dyno #9 ram Dyno #10 CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 25Monday, October 3, 11
  • 26. Heroku can be even more elastic Dyno #1 110 Dynos => $ 0.5/h Dyno #2 Large 1 LARGE => $ 0.35/h Dyno #3 Elastic Dyno #4 HEROKU = 42% more expensive Dyno #5 Dyno #6 ~ Dyno #7 Dyno #8 4.7 GB 0.33*1/2+0.33*1/5+0.33*1 = 56% dynamic Dyno #9 ram Dyno #10 usage 10 DYNAMIC Dynos => $ 0.28/h 1 LARGE => $ 0.35/h HEROKU = 25% cheaper CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 26Monday, October 3, 11
  • 27. Use Heroku because: It’s free You can have a look at almost everything without spending a penny. It’s fast Rapid prototyping meets heroku It support open source solutions Scaling needs can show up any day You are better developer than administrator CloudCamp.org/Athens | 2011 | Savvas Georgiou | presenting Heroku 27Monday, October 3, 11
  • 28. Code For dynamic Dyno management 28Monday, October 3, 11
  • 29. Thank you Savvas Georgiou @savvasgeorgiou contact@savvas.me http://savvas.me 29Monday, October 3, 11
  • 30. Reference [1] http://blog.heroku.com/archives/2011/7/12/matz_joins_heroku/ [2] http://cedar-versions.herokuapp.com/evil [3] https://status.heroku.com/incident/151 [4] http://devcenter.heroku.com/articles/dyno-isolation [5[ http://devcenter.heroku.com/articles/process-model [6] http://blog.heroku.com/archives/2010/7/20/nosql/ [7] https://addons.heroku.com/provider/resources/technical/how/provision/3 [8] http://blog.heroku.com/archives/2010/7/20/nosql/ 30Monday, October 3, 11