Slashdot Mirror


Tutorial On Building Robust Servers In Erlang

mvw writes "Wanna go beyond Java, Perl, or Python? Joe Armstrong has published a nice tutorial on implementing robust servers in the functional concurrent Erlang language. Here is the link."

8 of 19 comments (clear)

  1. Why Erlang? by StressedEd · · Score: 2, Insightful
    Does anyone have a (one line) compelling reason why Erlang is preferable to (say Perl, Java or even good ol' C(*))?

    Cynically I look at this and think "great, another programming language that allows me to print "hello world" in a more obtuse manner".

    I'm quite happy to be put straight on this, from any hardend Erlang users.

    (*) Ok, ignoring the point of buffer overflows, etc.

    --
    Be nice to people on the way up. You will meet them again on your way down!
    1. Re:Why Erlang? by Anonymous Coward · · Score: 2, Informative

      Erlang has great concurrency. It can handle thousands of multiple processes

    2. Re:Why Erlang? by whee · · Score: 3, Informative
      Well, besides the obvious concurrency advantage (need 200000 processes? no problem!), there's things like hot swapping of code, behaviors for common design patterns (servers, event handling, supervisors), bundled database written in Erlang, and other things like that.

      Writing a robust program in Erlang is extremely simple by using supervisors and following design principles like these. For example, my Erlang IRC bot is near impossible to completely crash. If the server connection dies, there's a supervisor that'll keep trying to get it back up; All the while the other processes of the bot have no idea there's no connection -- they don't need to know. If I've written a faulty module and the code misbehaves, only that single process is affected. If possible, a process that has crashed will be automatically restarted and operations resume as if nothing had happened.

      Hot-swapping of code allows me to debug the bot without restarting it. If I discover a bug in the irc parsing routines, I simply fix it in the code, recompile, and reload the offending module -- while the bot is running. The new code replaces the old, and it just works.

      There's plenty more, but I would suggest checking Erlang's website and reading the FAQ and examples. Oh, and here's a nifty benchmark :)

    3. Re:Why Erlang? by whee · · Score: 3, Insightful
      Hmmm.. I like the idea behind the "supervision tree". Why is that not possible to implement in other languages?
      It may or may not be possible to implement, but chances are something like it isn't distributed with the language. The supervisor structure distributed with Erlang is well-tested, robust, and quite usable.
      Is that similar to the implementation of concurrency in Ada?
      I'm not familiar with concurrency in Ada. In Erlang, processes are extremely lightweight and communicate via message passing. The processes themselves are done in the runtime, so there are no limits imposed by the OS (besides system resources, of course). With a shared heap, even the memory requirements are extremely low (compared to Java or C, for instance).
  2. WTF is Erlang? by Anonymous Coward · · Score: 3, Informative
    The FAQ says:

    Erlang is a general-purpose programming language and runtime environment. Erlang has built-in support for concurrency, distribution and fault tolerance. Erlang is used in several large telecommunication systems from Ericsson.

    1. Re:WTF is Erlang? by foote · · Score: 2, Informative

      Erlang is a dynamically typed concurrent functional programming language for large industrial real-time systems. Features of Erlang include...

  3. hmm by hfastedge · · Score: 3, Informative

    although i have just learned about erlang. i went to the trusty computer language shootout, and behold, it covered erlang!

    http://www.bagley.org/~doug/shootout/lang/erlang/

    This doesnt mean much as far more qualitative arguments exist. You can also browse over the code. :-)

    --

    -- -- --

    Help my mini cause: My journal

  4. Erlang pong by Anonymous Coward · · Score: 2, Informative

    As part of a class assignment I once had to create a distributed pong game in Erlang. I like the language and I think it will be appropriate for what they are talking about.