J
Jim Freeze
Ok, I'm stumped. I have a simple drb example, and it is
taking about 1 minute to get the value of an array with
two items in it.
% cat simple-server.rb
require 'drb'
def start_daemon
if (child_pid = fork)
File.open(__FILE__+".pid", "w") { |f| f.puts child_pid }
exit
end
Process.setsid
end
start_daemon
class MyClass
def files
%w(test1 test2)
end
end
DRb.start_service nil, MyClass.new
puts DRb.uri
File.open(__FILE__+".uri", "w") { |f| f.puts DRb.uri }
puts "Server started"
DRb.thread.join
% cat simple-client.rb
require 'drb'
DRb.start_service
server = File.read("simple-server.rb.uri").strip
puts "Connecting to #{server}"
begin
robj = DRbObject.new nil, server
p robj
p robj.object_id
p robj.files
rescue DRb:RbConnError => err
puts "No response from server"
puts err
end
% ruby simple-server.rb
druby://cheetah.local:49506
Server started
% ruby simple-client.rb
Connecting to druby://cheetah.local:49506
#<DRb:RbObject:0xb257c @ref=nil, @uri="druby://cheetah.local:49506">
365246
["test1", "test2"]
The last line takes about a minute to be printed.
taking about 1 minute to get the value of an array with
two items in it.
% cat simple-server.rb
require 'drb'
def start_daemon
if (child_pid = fork)
File.open(__FILE__+".pid", "w") { |f| f.puts child_pid }
exit
end
Process.setsid
end
start_daemon
class MyClass
def files
%w(test1 test2)
end
end
DRb.start_service nil, MyClass.new
puts DRb.uri
File.open(__FILE__+".uri", "w") { |f| f.puts DRb.uri }
puts "Server started"
DRb.thread.join
% cat simple-client.rb
require 'drb'
DRb.start_service
server = File.read("simple-server.rb.uri").strip
puts "Connecting to #{server}"
begin
robj = DRbObject.new nil, server
p robj
p robj.object_id
p robj.files
rescue DRb:RbConnError => err
puts "No response from server"
puts err
end
% ruby simple-server.rb
druby://cheetah.local:49506
Server started
% ruby simple-client.rb
Connecting to druby://cheetah.local:49506
#<DRb:RbObject:0xb257c @ref=nil, @uri="druby://cheetah.local:49506">
365246
["test1", "test2"]
The last line takes about a minute to be printed.