SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
What Every Programmer Should Know About Distributed Systems
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.
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.
9.
A distributed system
consists of multiple
autonomous applications
that interact with each other to
achieve a common goal.
Friday, November 11, 11
10.
II
Code Granularity
Photo by Matt Gibson
Friday, November 11, 11
11.
print "Converting Celsius or Fahrenheit? "
option = gets[0,1].downcase
case option
when "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
12.
def main
convert(pick_unit)
end
def pick_unit
print "Convert Celsius ou Fahrenheit? "
gets[0,1].downcase
end
def convert(unit)
case unit
when "c": convert_celsius
when "f": convert_fahrenheit
end
end
...
Friday, November 11, 11
13.
Ideal Granularity
Somewhere in between
Friday, November 11, 11
14.
Units & OO
• Methods
• Classes
• Packages
Friday, November 11, 11
15.
Units & Languages
• Ruby # sinatra.rb
module Sinatra
• Java class Application
...
• PHP class Event
...
module Streaming
class FileStreamer
...
Friday, November 11, 11
16.
Units & Languages
• Ruby
• Java
• PHP $ javac Sinatra.java
sinatra.java:5: class Application is public, should be
declared in a file named Application.java
Friday, November 11, 11
17.
Units & Languages
• Ruby
• Java
• PHP
Friday, November 11, 11
18.
Units & Architecture
• Applications
Friday, November 11, 11
19.
III
The Evolution of Óbidos
From Google Maps
Friday, November 11, 11
28.
OT
O NShare the Database
D
Friday, November 11, 11
29.
REST
RestClient.get "host/users/1" get "/users/:id" do |id|
user = User.find(id)
user.to_json
end
Friday, November 11, 11
30.
MQ
AMQP.start(:host => "1.2.3.4") do AMQP.start(:host => "1.2.3.4") do
q = MQ.new.queue("user.created") q = MQ.new.queue("user.created")
q.publish(:email => "pedro@heroku.com") q.subscribe do |msg|
end ...
end
end
Friday, November 11, 11