[erlang-questions] High payload messages between nodes

Dominic Williams mail@REDACTED
Tue Oct 23 13:24:43 CEST 2012


Hi Robert,

Le 23 oct. 2012 à 04:28, Roberto Ostinelli a écrit :

> Dear list,
> 
> I'm building a 2-tier architecture where:
> 	• the 1st tier is dedicated to keeping open socket connections to the outside clients, and then sends anything it receives from TCP to the 2nd tier
> 	• the 2nd tier receives all TCP data from the 1st tier and does the real job
> The reason why I'm doing this is because in case of crashes in the main application (2nd tier), then the outside connections will still be alive, hence avoiding the horrible peak of clients trying to reconnect all at once.
> 
> My main issue is that, afaik, sending big messages between nodes is actually a performance killer. If we set up this 2-tier architecture, then every stanza that gets received from the 1st tier will have to be resent internally to another node.
> 
> So, while the 1st tier gets this from individual sockets, the message passing between nodes gets done on a single TCP connection between nodes. I'm just afraid this is actually bad design and can lead to problems.
> 
> Therefore: are there alternatives to this? A custom Erlang transport? A pool of sockets?

One alternative would be not to use a 2-tier architecture, at least not in the sense of having specialised Erlang nodes. Have all nodes do both kinds of work (connections and main application). You can still keep a 2-tier design, with a connection layer and a working layer. With Erlang the main application can crash (in a given node) without bringing down the whole node, so the connections will stay up. And if you're afraid of an entire node (VM or even OS) going down, then it's better if remaining nodes can continue doing everything (connections and main applications) rather than being left with only one of the tiers (which can't do anything useful by itself). And that way your large payload can stay inside one node.

Regards,
Dominic Williams
http://dominicwilliams.net



More information about the erlang-questions mailing list