[erlang-questions] Using the OTP 'rpc' service (rex) under high load, was: Re: Load balancing/multiplexing rpc calls amongst Erlang Nodes

Scott Lystig Fritchie fritchie@REDACTED
Fri Oct 26 08:50:39 CEST 2012


Bengt Kleberg <bengt.kleberg@REDACTED> wrote:

bk> My use case is to start a gen_server on the remote node. I need the
bk> Pid returned in {ok, Pid} from gen_server:start/3 (actually a
bk> start_link/3 would be preferable).  Will erlang:spawn/4 return that
bk> Pid, as does rpc:call/4, or another pid?

Hi, Bengt.  The public API of gen_server doesn't mention such a service,
as you've noticed.  After poking around the internals of R15B02's
gen.erl, there doesn't appear to be a private method, either.

But I think you could steal a little bit of private code from gen:do_spawn()
then modify it to use a version of proc_lib that will do a spawn & link
on a remote node, e.g., any of the spawn() or spawn_link() flavors where
a Node argument is the first argument.

-Scott



More information about the erlang-questions mailing list