Just one data point - ejabberd *does* have a built-in facility for hot code loading, but to my knowledge you can't use it to upgrade the entire system at one go (eg, from 2.1.5 to 2.1.9, which I'm trying to do), just individual modules. That said, for the latter purpose it works just fine. The point about packaging is valid though - at least on Ubuntu, for example, the upgrade for ejabberd restarts the VM.<div>
<br></div><div>dan<br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 6:34 PM, Sam Bobroff <span dir="ltr"><<a href="mailto:sam@m5net.com">sam@m5net.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 18 October 2011 08:14, Gerry Weaver <<a href="mailto:gerryw@compvia.com">gerryw@compvia.com</a>> wrote:<br>
> Hello All,<br>
><br>
> I am new to Erlang and I'm trying to make the case to continue learning this language. I have read all of the books available and seen several presentations on the language. I am interested in Erlang primarily for the distributed and fault tolerant features it offers. However, I have some reservations about how useful this really is. For example, if you have a network server and the listener process fails, how do you recover? It seems that the fault tolerance is only applicable in the VM context. This is, in my mind equivalent to any other application process. If I have a network server written in C, I can have a watchdog process to kill and/or restart it in the event of failure. The C based approach actually seems more robust. In this scenario, how would one restart the Erlang VM? It has been my experience that network servers most often fail due to OS or hardware limits rather than<br>

> bugs in the code (at least for thoroughly tested production ready code). When you factor in the amount of baggage that comes with Erlang, or any other VM based language, it's difficult to justify. Now there is also the rapid development aspect, but I'm finding that at least for now, the time savings is being eaten up by looking for documentation. I understand that this situation will improve over time, but the various posts I've seen from folks with more experience seem to indicate that this will take quite a while. I like the language (except the , ; . thing). You can do some pretty cool things with it, but when I got over that initial gee whiz, I had some trouble seeing a real world production use case. I'm not trying to be critical, I just figure I must have missed something along the way. Any perspectives or advice on this would be greatly appreciated.<br>

><br>
><br>
> Thanks,<br>
> -G<br>
<br>
</div></div>Hi Gerry,<br>
<br>
I agree with most of the (great) follow up posts to your initial<br>
question: Erlang, in the right situation, is a powerful and very<br>
useful language and platform. Personally I also really enjoy using it<br>
because it's a language that is relaxing to program in: things are<br>
generally sensible and it rarely bites you in the ass (contrast to<br>
C++... *CHOMP* *CHOMP* *CHOMP*).<br>
<br>
However when you start using Erlang you'll eventually need to build a<br>
package of some kind, deploy it and then manage the service or program<br>
while it runs on the OS. This is not so well handled.<br>
<br>
It's also interesting that no-one has mentioned Erlang's ability to<br>
upgrade code while the system is running ("hot code loading"). In<br>
theory this is a great feature that is very hard to get in other<br>
languages. Ericsson has used it to deliver amazing up-times but I've<br>
never seen it used anywhere else. Ever. Not in yaws, not ejabberd or<br>
rabbitMQ (someone please correct me if I'm wrong). The reason seems to<br>
be that it's both tricky to actually do, just because when you get to<br>
the details it really is a hard thing to do, but it's also tied into<br>
the way you build and release packages and upgrades which brings me to<br>
my next point.<br>
<br>
Packaging: There is no standard packaging method for Erlang (there are<br>
several good community projects like rebar but none are standard).<br>
There seems to be, or to have been, some standard system because the<br>
OTP documentation mentions it but the documentation is incomplete or<br>
missing and the functions don't really seem to hang together or do<br>
what you need them to do. See make_tar, create_release,<br>
release_handler etc. Apparently some updates are coming (at least to<br>
the documentation) soon, which is good news but at the moment this is<br>
a big pain in the ass for anyone who wants to deploy any code. Every<br>
package I've seen either uses a community project or rolls their own.<br>
<br>
Unix service integration: The VM process itself (at least on Unix) is<br>
not well behaved and causes problems for system administrators and<br>
monitoring programs.<br>
<br>
* The VM process detaches from the console immediately with a<br>
successful exit code, even if it's unable to start your Erlang<br>
applications or if it's going to crash right away. This means that<br>
when you deploy it, you have to tell your administrators to run the<br>
start script and then manually read some log file and try to see if<br>
it's running successfully or if it even began to start up. It's<br>
impossible to deliver any messages to the console during startup in<br>
detached mode so even obvious things like a missing config file have<br>
to be discovered by digging through a log file.<br>
<br>
* The VM has no support for writing a PID file and it forks when<br>
detaching so it's hard (or impossible) to externally monitor or stop.<br>
The heart watchdog (see below) makes this even worse. If multiple<br>
Erlang VMs are run on the same machine it can be hard to tell them<br>
apart, especially if they are crashing or broken somehow... and that's<br>
when it matters!<br>
<br>
* If you use the built-in heart program to restart a crashed or hung<br>
VM process you can get into the situation where you can't (easily)<br>
stop a VM that's crashing on start-up. If you kill heart then the VM<br>
restarts it, if you kill the VM then heart restarts it. This might be<br>
OK on an embedded machine but it does not make a Unix admin happy when<br>
a service needs to be stopped right away.<br>
<br>
* All these problems make package upgrades (e.g. via RPM or deb)<br>
rather unsafe: it's not easy to determine which services to stop, its<br>
hard to stop them and be sure they've stopped. When restarting you<br>
can't know if it's started! Gah! Rather than just "rpm --upgrade" you<br>
will always have a sequence of manual steps and checks in order to<br>
perform an upgrade.<br>
<br>
* The log file written by the VM has a weird rotation strategy that<br>
makes it difficult to see which file is the actual current log file.<br>
This makes the start up issues worse; I suspect that most projects<br>
replace the logging code.<br>
<br>
In short, I've found that code running IN the VM is very reliable and<br>
easy to manage (the OTP supervisor system is great) but managing the<br>
OS VM process is hard and error prone.<br>
<br>
If you're not using Erlang as a service then things aren't so bad but<br>
you're still hit by some weirdness: the program "erl" takes command<br>
line parameters in a non standard (non-gnu anyway!) way and because of<br>
this either your program will also have to do that (and so you'll end<br>
up having to explain that to every user of the program) or you'll have<br>
to write some wrapper just to tidy them up.<br>
<font color="#888888"><br>
Sam.<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>