Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cloud Computing for Hackers

Cloud Computing for Hackers

Presented on workshop at Universidad de Puerto Rico, Rio Piedras.

Giovanni Collazo

October 23, 2012
Tweet

More Decks by Giovanni Collazo

Other Decks in Programming

Transcript

  1. “To programmers, ‘hacker’ connotes mastery in the most literal sense:

    someone who can make a computer do what he wants—whether the computer wants to or not” - Paul Graham
  2. “It can be either a compliment or an insult. It's

    called a hack when you do something in an ugly way. But when you do something so clever that you somehow beat the system, that's also called a hack.” - Paul Graham
  3. Hardware virtualization or platform virtualization refers to the creation of

    a virtual machine that acts like a real computer with an operating system - Wikipedia
  4. XEN

  5. Load Balancer App Server App Server App Server App Server

    DB Read Slave DB Read Slave Cache Reads DB Master Writes Replication HTTP Request HTTP Response
  6. Load Balancer App Server App Server App Server App Server

    Cache DB01 HTTP Request HTTP Response DB02 DB03 Shard01 Shard10 Shard11 Shard20 Shard21 Shard30 Reads & Writes Reads & Writes
  7. Load Balancer Web Dyno Web Dyno Worker Dyno Cron Dyno

    HTTP Request HTTP Response Ruby, Python, Scala, Java, Javascript, PHP
  8. app.py import os from flask import Flask app = Flask(__name__)

    app.debug = True @app.route("/") def hello(): return 'Hello: {}'.format(os.uname()[1]) if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
  9. import os from flask import Flask app = Flask(__name__) app.debug

    = True @app.route("/") def hello(): return 'Bye: {}'.format(os.uname()[1]) if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port) app.py
  10. <!doctype html> <html> <head> <meta charset="utf-8"> <title>The List</title> </head> <body>

    <ul> {% for item in the_list %} <li>{{ item }}</li> {% endfor%} </ul> </body> </html> index.html
  11. import os import time from flask import Flask from flask

    import render_template from store import redis app = Flask(__name__) app.debug = True @app.route("/") def hello(): redis.rpush('thelist', 'Hello: {} - {}'.format(os.uname()[1], time.time())) the_list = redis.lrange('thelist', 0, -1) return render_template('index.html', the_list=the_list) if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port) app.py
  12. Q&A