[erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes

50 views
Skip to first unread message

Joshua Muzaaya

unread,
Nov 9, 2012, 12:20:18 AM11/9/12
to erlang-q...@erlang.org

I have a setup in which two nodes are going to be communicating a lot. On Node A, there are going to be thousands of processes, which are meant to access services on Node B. There is going to be a massive load of requests and responses across the two nodes. The two Nodes, will be running on two different servers, each on its own hardware server.

I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message to a registered gen_server on Node B. Let me explain each option.

HTTP/1.1

Suppose that on Node A, i have an HTTP Client like Ibrowse, and on Node B, i have a web server like Yaws-1.95, the web server being able to handle unlimited connections, the operating system settings tweaked to allow yaws to handle all connections. And then make my processes on Node A to communicate using HTTP. In this case each method call, would mean a single HTTP request and a reply. I believe there is an overhead here, but we are evaluating options here. The erlang Built in mechanism called webtool, may be built for this kind of purpose.

rpc:call/4

I could simply make direct rpc calls from Node A to Node B. I am not very sure how the underlying rpc mechanism works , but i think that when two erlang nodes connect via net_adm:ping/1, the created connection is not closed but all rpc calls use this pipe to transmit requests and pass responses. Please correct me on this one.

Sending a Message from Node A to Node B

I could make my processes on Node A to just send message to a registered process, or a group of processes on Node B. This too seems a clean option.

Q1. Which of the above options would you recommend and why, for an application in which two erlang nodes are going to have enormous communications between them all the time. Imagine a messaging system, in which two erlang nodes are the routers :) ?

Q2. Which of the above methods is cleaner, less problematic and is more fault tolerant (i mean here that, the method should NOT have single point of failure, that could lead to all processes on Node A blind) ?

Q3. The mechanism of your choice: how would you make it even more fault tolerant, or redundant?

Assumptions: The Nodes are always alive and will never go down, the network connection between the nodes will always be available and non-congested (dedicated to the two nodes only) , the operating system have allocated maximum resources to these two nodes.

Thank you for your evaluations





Loïc Hoguin

unread,
Nov 14, 2012, 9:07:04 AM11/14/12
to Joshua Muzaaya, erlang-q...@erlang.org
Not HTTP, you don't want to have the overhead of the request and headers
etc. if you are going to need them to communicate a lot. Plus your
setting makes a lot of sense for distribution.

Apart from that, benchmark! :)

On 11/09/2012 06:20 AM, Joshua Muzaaya wrote:
>
> I have a setup in which two nodes are going to be communicating a lot.
> On Node A, there are going to be thousands of processes, which are meant
> to access services on Node B. There is going to be a massive load of
> requests and responses across the two nodes. The two Nodes, will be
> running on two different servers, each on its own hardware server.
>
> I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message
> to a registered gen_server on Node B. Let me explain each option.
>
> *HTTP/1.1*
>
> Suppose that on Node A, i have an HTTP Client like |Ibrowse|, and on
> Node B, i have a web server like |Yaws-1.95|, the web server being able
> to handle unlimited connections, the operating system settings tweaked
> to allow yaws to handle all connections. And then make my processes on
> Node A to communicate using HTTP. In this case each method call, would
> mean a single HTTP request and a reply. I believe there is an overhead
> here, but we are evaluating options here. The erlang Built in mechanism
> called |webtool|, may be built for this kind of purpose.
>
> *rpc:call/4*
>
> I could simply make direct rpc calls from Node A to Node B. I am not
> very sure how the underlying rpc mechanism works , but i think that when
> two erlang nodes connect via |net_adm:ping/1|, the created connection is
> not closed but all rpc calls use this pipe to transmit requests and pass
> responses. Please correct me on this one.
>
> *Sending a Message from Node A to Node B *
>
> I could make my processes on Node A to just send message to a registered
> process, or a group of processes on Node B. This too seems a clean option.
>
> *Q1.* Which of the above options would you recommend and why, for an
> application in which two erlang nodes are going to have enormous
> communications between them all the time. Imagine a messaging system, in
> which two erlang nodes are the routers :) ?
>
> *Q2.* Which of the above methods is cleaner, less problematic and is
> more fault tolerant (i mean here that, the method should NOT have single
> point of failure, that could lead to all processes on Node A blind) ?
>
> *Q3.* The mechanism of your choice: how would you make it even more
> fault tolerant, or redundant?
>
> *Assumptions: * The Nodes are always alive and will never go down, the
> network connection between the nodes will always be available and
> non-congested (dedicated to the two nodes only) , the operating system
> have allocated maximum resources to these two nodes.
>
> Thank you for your evaluations
>
>
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>


--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Konstantin Tcepliaev

unread,
Nov 14, 2012, 10:14:35 AM11/14/12
to Joshua Muzaaya, erlang-q...@erlang.org
Hi,
 
A1: Using rpc:call/4 is definitely a worst choice, as it uses a call to {Name, Node} with extra overhead and single registered process. HTTP implies lots of overhead too. I'd go with {Name, Node} ! Msg.
A2-3: Suggested in A1 method can be improved by some (not so) clever usage of erlang:monitor/2 and message passing, so that your sending node knows whether remote registered process is alive or not, and behaves accordingly.
 
Regards,
--
Konstantin 
09.11.2012, 09:20, "Joshua Muzaaya" <josh...@gmail.com>:
,

Joshua Muzaaya

unread,
Nov 14, 2012, 11:21:20 AM11/14/12
to Konstantin Tcepliaev, erlang-q...@erlang.org
thank you so much for this feedback
--
*Muzaaya Joshua
Systems Engineer
+256774115170*
*"Through it all, i have learned to trust in Jesus. To depend upon His Word"
*



Chandru

unread,
Nov 15, 2012, 12:16:16 AM11/15/12
to Konstantin Tcepliaev, Joshua Muzaaya, erlang-q...@erlang.org
While the message passing or RPC (which is really just message passing under the hood) approach will work, you have to be make sure you build in some overload control on the client side. Otherwise the client can easily overwhelm the server process with messages, and kill the server node. The receiving side has no built in control for overload protection.

With HTTP, you can get that by letting your HTTP client do the throttling. That said, it does come with a processing overhead.

cheers
Chandru

Joshua Muzaaya

unread,
Nov 15, 2012, 12:41:13 AM11/15/12
to Chandru, erlang-q...@erlang.org, Ulf Wiger
How do i handle over load protection on the server side ? please follow the question in detail here: http://stackoverflow.com/q/13376213/431620
Reply all
Reply to author
Forward
0 new messages