Yes, this is my problem, too.
I need an efficient way to transfer data model, but it seems that drb is
not just “transfer”.
Even if I ignore the object size thing, still, calling a drbObject’s
complex method is an issue.
DRb uses Marshal to convert objects into a stream of bytes. It then adds
a tiny wrapper (basically 4 bytes giving the length)
So if you want to see how big an object is when sent via DRb, just use
irb(main):001:0> class Test; attr_accessor :foo; end
irb(main):002:0> a = Test.new; a.foo = [“this”, “thing”]
=> [“this”, “thing”]
irb(main):003:0> b = Marshal.dump(a)
irb(main):005:0> c = Marshal.load(b)
=> #<Test:0xb7cc2994 @foo=[“this”, “thing”]>
In the above example, b contains the marshalled version of object a,
in turn contains another object (an array), which in turn contains two
strings. As you can see, this entire compound object takes 31 bytes on