A bunch of personal views about the main characteristics of Erlang, including myths and rumors.
A quick overview about what has lately been improved in the three areas.
5. The Bad (Un)Suitability
Erlang is not a silver bullet
Number Crunching
Text/String Processing
XML and SOAP based Web Services
“All can be done given time and money” - Ferenc Holzhauser
5/22
6. The Bad Learning Curve
Design: Processes VS Objects
I Technical knowledge required
I Domain knowledge is harder to map
Functional Programming
I Awesome (if you’ve felt the imperative pain)
I Risk of callback hell
6/22
7. The Bad What has improved
Learn You Some Erlang
Erlang Solutions Webinars
Erlang OTP in Action
Designing for Scalability with
Erlang OTP
7/22
12. The Ugly (lack of) Typesystem
Erlang
myfold(F, Acc, []) - Acc;
myfold(F, Acc, [H|T]) - myfold(F, F(H,Acc), T).
myfold(fun(X) - X + 1 end, 0, [1, 2, 3]).
% Error on runtime!!
Ocaml
let rec myfold f acc = function
| [] - Acc
| h::t - myfold f (f h acc) t
# val myfold:(’a -’b-’b)-’b-’a list-’b=fun
myfold (fun x - x+1) 0 [1;2;3]
# Compilation error!! (could have used (+))
10/22
13. The Ugly What has improved
Elixir: a new language for the Erlang VM
def myfun(what ’some’) do
IO.puts Doing #{what}
l = [1, 2, 3]
List.foldl l, 0, (1 + 2)
end
11/22
14. The Ugly What has improved
Elixir: a new language for the Erlang VM
def myfun(what ’some’) do
IO.puts Doing #{what}
l = [1, 2, 3]
List.foldl l, 0, (1 + 2)
end
I Direct mixing of Erlang and Elixir code
I Ruby-like syntax
I Adoption?
11/22
15. The Ugly What has improved
Dialyzer: Static type analyzer for Erlang code
-type opt()::{what, string()}.
-spec my_fun([opt()]) - pos_integer().
12/22
16. The Ugly What has improved
Dialyzer: Static type analyzer for Erlang code
-type opt()::{what, string()}.
-spec my_fun([opt()]) - pos_integer().
I Improved error catching
I Improved error reporting
I Ideally, all the code you use should be typed
I Still no support for ETS and debugger match_specs
I Dialyxir for Elixir projects
12/22
18. The Good Less Code
Functional = re-usability
OTP framework: structure and patterns
In code assertions / Let it crash
ok = file:write_file(MyFile, Hello!)
Bit syntax
?IP_VERSION:4, HLen:4, SrvcType:8,
TotLen:16, ID:16, Flgs:3, FragOff:13,
TTL:8, Proto:8, HdrChkSum:16, SrcIP:32,
DestIP:32, RestDgram/binary = IpPkg
14/22
19. The Good Less Engineers
High engineering level
I Not trivial to learn
I Usually not the 1st language
The WhatsApp example:
I 450M users
I 25 Engineers building client Apps
I 6 Erlang Engineers building the server
I 75M users / Erlang Engineer
15/22
20. The Good Highly Available
Availability1 of Erlang based telephone switches in late
1980s
AXD301 reported 9.99999999%
(nine nines) availability
0.6 seconds per 20 years
1Joe Armstrong: http://pragprog.com/articles/erlang
16/22
21. The Good Highly Available
Supervision trees provide automatic recovery
No downtime system upgrades
1. Create appup
2. Generate relup
3. Deploy relup
4. Instruct target system to upgrade itself
17/22
22. The Good Scalable
Light Parallel processes
I Quick to create: 660K processes/sec
I 300 words / standard process (2.4KB)
I No shared memory 2
I 1 process per: user session, HTTP call. . .
Well known bottlenecks
I gen_server serialization
I Long lived NIFs
I Disk I/O
2almost
18/22
23. The Good The community
Erlang Mailing List
Erlang Central LIVE chat
Erlang Camp
Erlang Factory (San Francisco)
Erlang User Conference (Stockholm)
Erlang Factory Lite: Berlin, Moscow,
NY, Paris, Chicago. . .
19/22
24. The Good What has improved
Forced wake up (+sfwi) for schedulers
ETS concurrency
enif_schedule_nif/0 for partitioned NIF invocation
Scalability on multicore (RELEASE)
And a ton of awesome applications:
I Nifty
I Cowboy
I Concuerror
I Piqi
I . . . and, of course. . .
20/22