[erlang-questions] Confused about the "rex" server

Alexander Lamb <>
Mon May 12 10:16:14 CEST 2008


Thanks a lot!

Gradually getting the picture (and will have tons of questions for the  
class and conference in London:-)

So, until my app needs to do hundreds of thousands of calls, rex will  
be perfect. It also simplifies things on the server part. No more  
spawning of processes. Simply expose functions. Since the spawning of  
processes is handled by the rpc server.

Alex

Le 12 mai 08 à 09:58, Raimo Niskanen a écrit :

> On Fri, May 09, 2008 at 05:29:46PM +0200, Alexander Lamb wrote:
>> Hello list,
>>
>> I am a bit confused about references of what is called "rex server".
>>
>> I wrote a module with exported functions. I need to call these
>> functions from a JInterface. So as I discovered in the documentation,
>> I create a node and a mailbox (I will have several mailboxes in
>> separate threads).
>> However, what I understood from a previous reply from Raimo, is  
>> that a
>> rpc is actually a message send with some particular way of giving the
>> parameters. In this message send, there is a reference to "rex". What
>> does that actually mean? I didn't find the documentation related to
>> this.
>
> I am afraid the source code is the documentation in this case...
>
> "rex" is the registered name of the Remote EXecution server
> aka RPC server on every erlang node. It is part of the
> Kernel application.
>
> The Kernel application client code in the 'rpc' module
> makes gen_server calls to that registered name. But there
> is an alternative to gen_server calls that e.g C and
> Java nodes use, and that is to send a message
> {self(),{call,Mod,Fun,Args,Gleader}} to the registered
> name "rex" on your desired node, and then wait for
> a reply message {rex,Reply}.
>
>>
>> Now, on the receiving side, how do things happen?
>
> Read the source code for the 'rpc' module, function handle_call/3
> clause ({call,...}, ...):
> The RPC server spawns a worker process for each
> RPC call, and waits for it to return a reply that
> the RPC server in its turn returns to the caller.
>
> The worker proceess protects the RPC server from
> odd things that may happen in the applied RPC function,
> and frees the RPC server so serve new calls before
> the previous is complete.
>
>>
>> Do I need to spawn a process for each call received? Or does "rex"
>> handle this for me? Or would it be better to send messages instead of
>> calling functions?
>
> You can always customize a server. But if you only
> want to call existing functions remotely, and you are
> happy with the rather heavy footed and safe way
> the RPC server does its calls, use it!
>
>>
>> Alex
>> --
>> Alexander Lamb
>> Founding Associate
>> RODANOTECH Sàrl
>>
>> 4 ch. de la Tour de Champel
>> 1206 Geneva
>> Switzerland
>>
>> Tel:  022 347 77 37
>> Fax: 022 347 77 38
>>
>> http://www.rodanotech.ch
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>
> -- 
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>




More information about the erlang-questions mailing list