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

DRb - Distributed Ruby

DRb - Distributed Ruby

a short introduction to Drb (without Rinda). Given at the Bangalore Ruby meetup on 18th May, 2013.

Deepak Kannan

May 18, 2013
Tweet

More Decks by Deepak Kannan

Other Decks in Technology

Transcript

  1. DRb D i s t r i b u t

    e d R u b y 1 Monday, 20 May 13
  2. What is DRb Distributed objects like Cobra and Java’s RMI

    No IDL or ceremony to use Magic happening under the covers 2 Monday, 20 May 13
  3. Simple server require 'drb/drb' $SAFE = 1 # disable eval

    and friends SERVER_URI = "druby://127.0.0.1:8000" # simple class class TimeServer def get_current_time; Time.now; end end # bind to a port DRb.start_service(SERVER_URI, TimeServer.new) puts "listening on #{SERVER_URI}" DRb.thread.join 3 Monday, 20 May 13
  4. Client require 'drb/drb' require 'pp' SERVER_URI = "druby://127.0.0.1:8000" timeserver =

    DRbObject.new_with_uri(SERVER_URI) pp timeserver #<DRb::DRbObject @uri= ..> puts timeserver.get_current_time 4 Monday, 20 May 13
  5. What we saw service discovery is done through urls PORO

    - Server is a Plain old Ruby class A Stub is created Data is marshalled across It is a sync RPC call. not async by default 5 Monday, 20 May 13
  6. What Next We were returning a standard ruby class. What

    about a custom class ? Let us try returning a object - what can go wrong ? 6 Monday, 20 May 13
  7. Skipped topics Rinda ACL for DRb Ruby safe levels DRb

    over SSL GC and DRb 8 Monday, 20 May 13
  8. Usecase (not all of them are practical) For building RPC

    apis For building a distributed logging service. has the semantics of a method call A deployment bot. A daemon which is running on all nodes of a cluster listening for commands A background job worker map-reduce using Rinda. eg. starfish 9 Monday, 20 May 13