Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Running Erlang OTP applications as Daemons on Ubuntu Servers

Posted by Jim Morris on Sun Sep 19 17:26:42 -0700 2010

Recently I needed to deploy an Erlang OTP application to a production server, and was surprised at the lack of official documentation on how to do that. My requirements are to have the application run on system startup, and if the application crashes to have it automatically be restarted, some optional requirements are to have rotated logs and to get email notifications if the application does crash.

Erlang itself has several layers of supervision to keep its processes running, however on occasion the VM itself may crash, if it runs out of memory for instance. I would want the entire appliction to be restarted in that case.

... Show more ...

Posted in Erlang  |  Tags erlang,OTP,daemon  |  2 comments

Using Cucumber to test Erlang Servers

Posted by Jim Morris on Sat May 02 00:09:36 -0700 2009


I've been using cucumber to do all my integration testing. Usually testing over the wire to a live system, regardless of what the target system is written in (Ruby Rails, Merb, Java etc).

... Show more ...

Posted in Erlang,Cucumber  |  Tags erlang,cucumber,bdd  |  8 comments

Dealing with a TCP packet with a little endian header in Erlang gen_tcp

Posted by Jim Morris on Mon Apr 13 01:11:57 -0700 2009

In Erlang they have a very neat way of reading TCP packets that have a header that specifies how big the following packet is. So long as you send that header as a big-endian integer, you can use the built-in mechanism. Then gen_tcp, takes care of making sure the entire packet is read before passing it onto you.

Here is an example of a simple server getting packets from a client using some simple binary protocol... For instance sending this binary packet,

... Show more ...

Posted in Erlang  |  Tags erlang,gen_tcp  |  3 comments

Using Erlang with JInterface

Posted by Jim Morris on Sun Apr 12 16:56:50 -0700 2009


I recently undertook a project to rewrite a voice conference server I wrote over 10 years ago. This server was written in C++ running on a Windows Server (originally NT and then win2k). The reason it was written for win2k was to use I/O Completion Ports which were not (and still are not) available on Linux.

Solaris has an equivalent AIO feature but not quite the same. I/O Completion Ports make very efficient use of multiple CPU's, and the conference server had to be very fast and handle a large number of concurrent connections.

... Show more ...

Posted in Erlang  |  Tags erlang,jinterface  |  5 comments