tags:

views:

204

answers:

3

Just started reading the OTP chapter on the great Erlang book by Francesco Cesarini. Are most Erlang applications such as MochiWeb, Riak, RabbitMQ, Zotonic, ejabberd and CouchDB OTP applications?

+2  A: 

MochiWeb follows basic OTP Design Principles: it utilizes supervisor(3) behaviour to restart crashed processes (module mochiweb_sup.erl), and gen_server(3) behaviour. However it implements many routines to process data, such as ones found in mochinum.erl for faster floating point numbers serialization and mochijson[2].erl to process JSON etc.

The bad thing with mochiweb (I made it clear why here) IMHO is that it uses questionable and officially undocumented (since 2003!) technique of modules parameterizing (module mochiweb_request.erl, notice -module(mochiweb_request, [Socket, Method, RawPath, Version, Headers]). in the head of the file). The same applies to another Erlang HTTP-library misultin (misultin_req.erl).

Correct me if I'm wrong.

Yasir Arsanukaev
Parametrized modules are now documented. I still don't like them, but they're official stuff now.
I GIVE TERRIBLE ADVICE
+2  A: 

CouchDB had lot of problems with that but the newest sources published by Cloudant show CouchDB in rebar, so it must be otp compliant.

Riak - the same, on rebar (btw. the same devs rebar and riak). Btw2. it is very nicely written app, good place to learn good practices.

Zotonic source code looks like mess a little bit. I can see there 'application' etc. but directory structure do not look like any proper OTP node. Btw. even Licence is not added on the top of all modules :?

ejabberd is full of sups and apps, but it has also some interesting;) design choices, so maybe do not learn Erlang on this example.

+2  A: 

The Hibari database app is definitely OTP-based. The server is broken into several OTP apps, including a small one for managing config and logging (gmt), a big one for the server itself (gdss), a small one for native Erlang clients (gdss_client), and separate OTP apps for each of the server-side protocol handlers (e.g. JSON-RPC, UBF, EBF/BERT).

Sometimes a picture is worth at least a few hundred words. I've got some screen captures from the Erlang "appmon" (application monitor) app that shows the supervisor-and-worker process tree. Sorry, the protocol handler apps aren't shown in image #01, but they would be if I had had them running when I captured the image.

The link is here: OTP 'appmon' screen shots

-Scott

Scott Lystig Fritchie