Erlang: What, Why and How COSI Lightning talk by: Jacob Torrey
What is Erlang? A programming language created by Ericsson for telephony switches. Many concurrent processes Must have high uptime It's been around for quite a while, but is just now getting popular Buzzwords: Functional, Distributed, Highly- concurrent Used by: Facebook, CouchDB, ejabberd... Similar to: Prolog, Haskell...
Why Erlang? It has a VERY lightweight process system (think 2 million per CPU) with: No locking or shared memory – No nightmares Pure message passing – Can pass any data in messages Processes can be on remote machines Erlang VM can take advantage of new hardware without program changes Multi-core and multi-processor Near linear speed up with less than 16 cores!
Ok, so How? Erlang requires a VM (http://www.erlang.org) Windows, OSX, *NIX Run erl in the command prompt 1> 1. 1 2> A = 1. B = A + 1. 2
Show me the money!... or code double(Num) → Num * 2. doubleList(ListNum) → F = fun(F) → double(A) end, lists:map(F, ListNum). OR rpc:pmap({?MODULE, double}, [], ListNum).
What is the advantage Since you can fork and forget about processes, you can conceptualize problems like in the real world. No race conditions or other nasties Erlang will take advantage of multi-cores without your help Distributed for hardware failover Functional paradigm, so it rocks! ;)
Erlang + COSI = <3 OSP – My project to abstract away server boilerplate code to allow for the simple development of server daemons requiring just the server logic. Distributed data store for redundance and load balancing Simple management console Standard XML servlet format
Fin Ideas taken from: Devon Smith's Code4Lib Erlang talk http://www.code4lib.org http://www.archive.org/details/code4lib.conf.2 008.lightningtalk.Erlang