Is drb much slower than memcached ?

I do some test, surprising to find seeming to access drb much slower than
access memcached.

If it's true, should we use more memcached directly than drb based things
(like backgrounddrb) in scale situation ?

Before the test, I can't decide whether to do(such as get/set global data
operations) in drb/backgrounddrb or just access memcached in

I have thought of that doing save(or some read) operations in
drb/backgroundrb asynchronous will improve the performance highly.

Hope for your idea, thank you.


The test:

just loop 100 times doing a simple action with drb & memcached, see how long
they will take.

ruby 1.8.4 (2006-04-14) [i386-mswin32]
Rails 1.1.6
Distributed Ruby: _dRuby_ version 2.0.4 # from ruby/lib/rub/1.8/drb/drb.rb

# RAILS_ROOT/config/enviroments/development.rb
# new drb object here to ensure just new it once at the beginning
require 'drb'
DRB_OBJ =, 'druby://localhost:9000')

# In a simple actioncontroller
class TestController < ApplicationController
  def test
    start_time =
    100.times do
      DRB_OBJ.doNothingInSide() # just invoke a simple drb function, do
nothing inside
    end_time =
    flash['tm2'] = sprintf("DRB access take (%0.9f)", end_time - start_time)
# log the duration to show in view

    start_time =
    100.times do
      Cache::put('test', {'test' => 'just test'}) # just set the memcached
through memcache-client's put method
    end_time =
    flash['tm1'] = sprintf("Memcache access take (%0.9f)", end_time -
start_time) # log the duration to show in view

# In the simple view

# run & see the results
tm1=#Memcache access take (0.546000004)
tm2=#DRB access take (3.141000032)

The running results different every time, but all show memcached much faster
than drb access.


  YEah memcached is pure C and is very fast. DRb is a bit slower for
caching. Backgroundrb has caching features but I recommend you use
memcached for scalable cache. Backgroundrb is more for the worker
classes then for caching.


Using Eventmachie and MemCache......i am on verge of phasing

I am not sure, if it is such a nice decision.but turns out pretty fast
and since i developed it....I can be little bit sure about it.

The flipside is...i use TCPSocket to pass messages to the background daemons.