Skip to content
Remote Objects for Ruby -- Production-quality transparent RPC library for Ruby
C Ruby Shell
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


RO4R 1.0 - Remote Objects for Ruby (1.8, 1.9, 2.x+)


1. Supported Ruby Versions
2. How to see it work
3. Benchmarks
4. Programming notes

Supported Ruby versions:

    Supports all Ruby versions from 1.8 above out of the box, in any
    combination of client and server versions.

How to see it work:

  - Check out the files:

    git clone git://

  - In one terminal, start an example server (it exports one Ruby Hash
    variable and provides main loop):

    cd RO4R
    ruby -I. examples/srv.rb

  - In another terminal, start an example client (it attaches to the
    shared Hash, iterates a counter 10000 times, and then prints the
    benchmark statistics and the contents of the Hash):

    cd RO4R
    ruby -I. examples/cli.rb
    0.390000   0.390000   0.780000 (  1.451144)
    {:counter=>9999, 1=>A, 2=>#<A:0xb7741e38>}

    First line is the benchmark output, showing user, system, total
    and real times. (That's benchmark for the 10,000 iterations that
    the example client does).

    Second line are the contents of the shared Hash object. In it you see
    the :counter that was created on the client side, and two keys that
    were initialized by the example server.

    (When the client program does its job and disconnects, on the server
    side you will see a message you can ignore:
      #<NoMethodError: undefined method `length' for nil:NilClass>)

 - You can open another terminal and run the example client under irb -r,
   which will do its thing and leave you with an IRB shell, from which
   you can query and modify $r yourself:

   cd RO4R
   irb -I. -r examples/cli.rb
   > $r[:counter]
   > $r[:test_value]= 717
   #-> 717

   On the server side, we've initialized an example method 'm' that returns
   1, and that you can test:

   > $r[2].m
   #-> 1

 - And you can open a final terminal in which you can query all we've done
   so far:

   cd RO4R
   irb -I. -r examples/cli.rb
   > $r
   {:counter=>9999, 1=>A, 2=>#<A:0xb7745e34>, :test_value=>717}

Benchmarks (10,000 RPC invocations):

 October 2015, i7-4790K CPU @ 4.00GHz on Linux 4.2.0-040200-lowlatency

  Server   Client     Stats
   2.2.3     2.2.3     0.196000   0.076000   0.272000 (  0.481286)

 Older Benchmarks from 2008:

  Server   Client     Stats
   1.9.2     1.9.2     0.390000   0.390000   0.780000 (  1.451144)
   1.9.2     1.8.7     1.000000   0.280000   1.280000 (  2.009202)
   1.8.7     1.9.2     0.520000   0.300000   0.820000 (  1.914454)
   1.8.7     1.8.7     0.960000   0.260000   1.220000 (  2.472942)

Programming notes:

  Shared classes:

    Generally, you will share instances of classes that are known to
    both the server and the clients.

    But it is also possible to share objects that clients know nothing

    Included in the distribution is rmarshal/, a modification of
    Ruby marshaller that you need to compile and 'require' into
    your Ruby app, on the server side (the one that exports the object).
    (The rmarshal.c is currently a version working with Ruby 1.8).

    Do that and the clients will transparently be able to use the remote
    object even though they don't know its Class.

  Method return values:

    When writing methods, you usually don't care about unused return
    values because Ruby simply discards them. On methods that will be
    invoked remotely, RO4R will pass the return value back to the client,
    so pay attention to exit a method with an explicit 'nil' if its return
    value is not needed. This is cleaner and can also save you from errors
    if the (unnecessary) return value would be a weird object that Ruby
    marshaller can't serialize and pass back to the client.

  Code stability:

    RO4R has been in production use with Ruby 1.9 and the standard Ruby
    marshaller since 2007.


 - rmarshall for Ruby 1.9, 2.x
 - more examples from our production use

Something went wrong with that request. Please try again.