what every programmer should know about distributed systems

Post on 12-May-2015

1.779 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

It's time to talk about distributed systems: what are they, why you should be writing one, and what to look for while doing so. We'll cover the basics, understand some of the technology behind it - like REST, MQ with AMQP, ZeroMQ, etc - and discuss things we're doing at Heroku to avoid the pitfalls of a distributed architecture.

TRANSCRIPT

What Every Programmer Should

Know About Distributed Systems

Friday, November 11, 11

What Every Programmer Could

Possibly Want To Know About Me

Friday, November 11, 11

Friday, November 11, 11

Friday, November 11, 11

Friday, November 11, 11

Friday, November 11, 11

What Every Programmer Should

Know About Distributed Systems

Friday, November 11, 11

IDefinition

Friday, November 11, 11

A distributed system consists of multiple autonomous applications that interact with each other to achieve a common goal.

Friday, November 11, 11

Photo by Matt Gibson

IICode Granularity

Friday, November 11, 11

print "Converting Celsius or Fahrenheit? "option = gets[0,1].downcasecase optionwhen "c" print "Convert C: " celsius = gets.to_i fahrenheit = celsius * 9/5 + 32 puts "#{celsius}C = #{fahrenheit}F"when "f" print "Convert F: " fahrenheit = gets.to_i celsius = (fahrenheit - 32) * 5/9 puts "#{fahrenheit}F = #{celsius}C"end

Friday, November 11, 11

def main convert(pick_unit)end

def pick_unit print "Convert Celsius ou Fahrenheit? " gets[0,1].downcaseend

def convert(unit) case unit when "c": convert_celsius when "f": convert_fahrenheit endend

...

Friday, November 11, 11

Ideal Granularity

Somewhere in between

Friday, November 11, 11

Units & OO

• Methods

• Classes

• Packages

Friday, November 11, 11

Units & Languages

• Ruby

• Java

• PHP

# sinatra.rbmodule Sinatra class Application ... class Event ... module Streaming class FileStreamer ...

Friday, November 11, 11

Units & Languages

• Ruby

• Java

• PHP$ javac Sinatra.javasinatra.java:5: class Application is public, should bedeclared in a file named Application.java

Friday, November 11, 11

Units & Languages

• Ruby

• Java

• PHP

Friday, November 11, 11

Units & Architecture

• Applications

Friday, November 11, 11

From Google Maps

IIIThe Evolution of Óbidos

Friday, November 11, 11

Friday, November 11, 11

Heroku

• Instance management

• Billing & invoices

• Process orchestration

• Public API

Friday, November 11, 11

Heroku

• Instance management

• Billing & invoices

• Process orchestration

• Public API

Friday, November 11, 11

Heroku

• Instance management

• Billing & invoices

• Process orchestration

• Public API

Friday, November 11, 11

Heroku

• Instance management

• Billing & invoices

• Process orchestration

• Public API

Friday, November 11, 11

IVDeveloping the Medium

Friday, November 11, 11

Problem:

?

Friday, November 11, 11

Share the Database

Friday, November 11, 11

Share the DatabaseDO NOT

Friday, November 11, 11

REST

RestClient.get "host/users/1" get "/users/:id" do |id| user = User.find(id) user.to_jsonend

Friday, November 11, 11

MQ

AMQP.start(:host => "1.2.3.4") do q = MQ.new.queue("user.created") q.publish(:email => "pedro@heroku.com")end

AMQP.start(:host => "1.2.3.4") do q = MQ.new.queue("user.created") q.subscribe do |msg| ... endend

Friday, November 11, 11

VChallenges

Friday, November 11, 11

Challenges

• Versioning

• Testing

• Authentication

• Development environment

• Visual consistency

• Deploying

Friday, November 11, 11

Summary

1. Definition

2. Code Granularity

3. The Evolution of Óbidos

4. Developing the Medium

5. Challenges

Friday, November 11, 11

Thank you!

pedro@heroku.com

http://pedro.heroku.com

@ped

Friday, November 11, 11

top related