[erlang-questions] OTP Design

Anchise Inzaghi erlang@REDACTED
Thu Aug 18 20:01:00 CEST 2011


 I am quite new to erlang and now on the first step to my first 
 application in our actual production environment. I surely want to make 
 use of the OTP framework. I have played a bit with it, read the 
 documentation and Joe Armstrong's book. I am still unsure about the 
 design. I hope you can help me out and give me some precious input.

 The setup is the following:

 1 DB-Server somewhere in the internet,
 1 Comm-Server in our local LAN with static public IP and static LAN IP,
 n Comm-Slaves in our local LAN with static LAN IPs and each with a 
 number of different devices attached.

 Comm-Server and Comm-Slaves suffer from frequent blackouts and power 
 surges, so they fall down and reboot quite a lot.
 The LAN is stable, the internet connection (of our LAN, not of the 
 DB-Server) is the worst connection you can possibly imagine.

 Each Comm-Salve has one process for each of its comm devices attached 
 which receive data from these devices. When it receives data I want them 
 to pass this data to the Comm-Server, the Comm-Server then writes them 
 to the persistence layer (postgres), does some preprocessing and then 
 sends it to the central DB-Server. If there is no internet connection, 
 it should wait until he sees the DB-Server again and send the buffered 
 data then.

 The DB-Server, Comm-Server and Comm-Salves I imagined would be of the 
 behaviout gen_server. The Comm-Server starts up with an ini-File 
 indicating which Node on which Slave controlles which devices, and start 
 up the corresponding Comm-Slaves on the indicated nodes, passing them 
 the information of which devices to controll.
 The Comm-Server will also have some interface for adding and removing 
 devices (i.e. processes receiving data from devices).

 If a Comm-Slave process dies, I need to restart it one-on-one. I 
 thought about a supervisor on the Comm-Server to supervise all the 
 Salves and here comes my first problem:

 **As I read the documentation, there is no way to start_link a process 
 on a different node, or am I missing something?**
 **What supervision strategy would you suggest?**

 I also dived a bit into distributed application docu, but I have the 
 impression that it is more aimed at Takeover and Failover mechanisms. I 
 fear, these won't help me much, as each slave can only run on the 
 machine where its actual hardware device is connected.

 **Please prove me wrong and show me the way how to use ditributed 
 app?**

 I will be thankful for any indications how to sensefully use OTP with 
 this setup.

 Thanks a lot in advance.

 Anchise Inzaghi



More information about the erlang-questions mailing list