Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Erlang applications for the cloud

I'm working on a socket server that'll be deployed to AWS and so far we have the basic OTP application set up following a structure similarly to the sample project in Erlang in Practice, but we wanted to avoid having a global message router because that's not going to scale well.

Having looked through the OTP design guide on Distributed Applications and the corresponding chapters (Distribunomicon and Distributed OTP) in Learn You Some Erlang it seems the built-in distributed application mechanism is geared towards on-premise solutions where you have known hostnames and IPs and the cluster configuration is determined ahead of time, whereas in our intended setup the application will need to scale dynamically up and down and the IP addresses of the nodes will be random.

Sorry that's a bit of a long-winded build up, my question is whether there are design guidelines for distributed Erlang applications that are deployed to the cloud and need to deal with all the dynamic scaling?

Thanks,

like image 906
theburningmonk Avatar asked Aug 20 '14 10:08

theburningmonk


2 Answers

There are a few possible approaches:

  • In Erlang and OTP in Action, one method presented is to use one or two central nodes with known domains or IPs, and have all the other nodes connect to this one to discover each other
  • Applications like https://github.com/heroku/redgrid/tree/logplex require having a central redis node where all Erlang nodes register themselves instead, and do membership management
  • Third party services like Zookeeper and whatnot to do something similar
  • Whatever else people may recommend

Note that unless you're going to need to protect your communication, either by switching the distribution protocol to use SSL, or by using AWS security groups and whatnot to restrict who can access your network.

like image 162
I GIVE TERRIBLE ADVICE Avatar answered Nov 01 '22 20:11

I GIVE TERRIBLE ADVICE


I'm just learning Erlang so can't offer any practical advice of my own but it sounds like your situation might require a "Resource Discovery" type of approach as i've read about in Erlang & OTP in Action.

Erlware also have an application to help with this: https://github.com/erlware/resource_discovery

like image 42
Ryan W Gough Avatar answered Nov 01 '22 20:11

Ryan W Gough