More Related Content


Intro to Erlang

  1. Intro to Erlang May 19, 2009 Ken Pratt
  2. What is Erlang? + = Open Source
  3. History Created in ’86 Open-sourced in ’98 “Programming Erlang” published in ’07 Taking off in popularity (3 more books on the way)
  4. Ruby killer? Absolutely not!
  5. The philosophy Simple language Ultra-lightweight concurrency No shared state (and no locks, no mutexes) <3 asynchronous message passing Processes should be able to run forever
  6. The language Functional Strong, dynamic typing NO shared state(!!) (and no mutable variables) Pattern matching on steroids <3 tail recursion Compiled to bytecode, runs on VM
  7. Silly code example
  8. Architecture = light-weight process with a built-in mailbox
  9. Distributed architecture = light-weight process with a built-in mailbox
  10. Concurrent programming It is VERY easy to turn procedural code into concurrent code (as long as you follow conventions) Code with race conditions either goes in a singleton process or in a transaction in Mnesia It is harder to write distributed applications, but still much, much easier than most platforms (primarily due to no shared state, no locks, no synchronization, etc...)
  11. Libraries Native and “OTP” libraries do all the concurrency heavy lifting for you Supervisor trees Mnesia distributed database Web frameworks (Nitrogen, Webmachine) JSON!
  12. So what? Who the hell would use this obscure functional crap?
  13. Highly-concurrent phone switching servers 99.9999999% uptime (~3ms down/year) Soft real-time characteristics Fault tolerant
  14. Facebook Chat backend 7+ million active chat channels at peak ~100 servers (= 700,000 channels/server) AJAX + Comet (long-polling)
  15. Amazon SimpleDB Schema-less database
  16. IM client integration ejabberd (Erlang Jabber service)
  17. Chat room polling in Campfire 283 LoC 1500 req/sec
  18. ...and many more
  19. Ruby + Erlang They can work together
  20. Katamari/Fuzed Rails server clustering Erlang bindings for Rails YAWS web server
  21. Nanite A “self-assembling cluster of Ruby daemons” Daemons can be anything small or large, including a Rails server or map/reduce tasks RabbitMQ handles the distributed stuff
  22. Erlectricity “Real” Erlang/Ruby interaction Bi-directional communication using Erlang’s binary format Erlang treats Ruby processes as “just another” Erlang process
  23. BUT “Use the right tool for the right job.” Erlang is great for distributed services... ...but Ruby is still king for expressing business logic.
  24. Where to start “Programming Erlang” by Joe Armstrong (creator of Erlang) Slides & videos online! (I’ll post the link to the mailing list) conference/SFBayAreaErlangFactory2009
  25. Erlang meetup First meetup in mid-to-late June “Intro to Erlang Programming”(?) Definitely won’t conflict with Ruby meetup Thanks!

Editor's Notes