Más contenido relacionado La actualidad más candente (20) Similar a Erlang Lightning Talk (20) Erlang Lightning Talk4. hello_mod:say_hello().
1. $
erl
2. Erlang
R14B04
(erts-‐5.8.5)
[source]
[64-‐bit]
[smp:4:4]
[rq:4]
[async-‐threads:0]
[hipe]
[kernel-‐poll:false]
3. Eshell
V5.8.5
(abort
with
^G)
4. 1>
c(hello_mod).
5. {ok,hello_mod}
6. 2>
hello_mod:say_hello().
7. Hello
8. ok
9. 3>
6. fact_mod:fact(4).
1. $
erl
2. Erlang
R14B04
(erts-‐5.8.5)
[source]
[64-‐bit]
[smp:4:4]
[rq:4]
[async-‐threads:0]
[hipe]
[kernel-‐poll:false]
3. Eshell
V5.8.5
(abort
with
^G)
4. 1>
c(fact_mod).
5. {ok,fact_mod}
6. 2>
fact_mod:fact(4).
7. 24
8. 3>
7. qsort_mod.erl
1. -‐module(qsort_mod).
2. -‐export([qsort/1]).
3. qsort([])
-‐>
4.
[];
5. qsort([H
|
T])
-‐>
6.
qsort([
X
||
X
<-‐
T,
X
<
H
])
++
7.
[H]
++
8.
qsort([
X
||
X
<-‐
T,
X
>=
H
]).
8. qsort_mod:qsort([3,
2,
1,
6,
4,
5]).
1. $
erl
2. Erlang
R14B04
(erts-‐5.8.5)
[source]
[64-‐bit]
[smp:4:4]
[rq:4]
[async-‐threads:0]
[hipe]
[kernel-‐poll:false]
3. Eshell
V5.8.5
(abort
with
^G)
4. 1>
c(qsort_mod).
5. {ok,qsort_mod}
6. 2>
qsort:qsort([3,
2,
1,
6,
4,
5]).
7. [1,2,3,4,5,6]
8. 3>
9. History
§ 1986
-‐
Joe
Armstong
(Ericsson)
§ Prolog
§ 1988
-‐
Ericsson
AXD301
ATM
telco
switch
§ 1
million
lines
of
Erlang
§ 99.9999999
§ 1995
-‐
Open
Telecom
Plalorm
§ 1998
-‐
Open
source
§ 2011
-‐
Release
14B03
11. Programming
Language
§ General-‐purpose
§ Funcponal
§ Like
LISP,
Haskell
§ Garbage-‐collected
§ Dynamic
typing
§ Single
assignment
§ Erlang
runpme
system
§ STDLIB
12. Features
§ Massive
concurrency
and
message
passing
§ Actor
model
§ Sos-‐real-‐pme
§ Thousands
of
processes
under
single
VM
§ Short
GC
pauses
§ Distributed
§ Erlang
nodes
§ Fault-‐tolerant
§ 99.9999999%
§ Powerful
error
handling
§ Supervisors
§ Recovery
from
errors
§ Non-‐stop
systems
§ Hot
code
swapping
in
producpon
13. Data
types
§ Atoms
§ open,
close,
`empty
§ Integers
§ Floats
§ Tuples
§ {price,
12.34}
§ Lists
§ [1,
2,
3,
4]
§ PIDs
15. Actors:Message
Passing
§ Send
message
(client
process)
§ ServerProcessId
!
Message.
§ Receiving
a
message
(server
process)
§ receive
pa2ern2
-‐>
…;
pa2ern2
-‐>
…
end.
16. Erlang
VM
§ Thousands
of
processes
under
single
VM
§ Lightweight
processes
§ Garbage
collecpon
per
process
§ BEAM
files
§ Napve
code
compiler
17. Anywhere
§ OS
/
Hardware
independent
§ UNIX/Linux
§ Windows
§ Mac
§ Embedded
§ Android
19. OTP
Design
Principles
§ Supervision
trees
§ Supervisors
§ Workers
§ Behaviours
§ gen_server
§ The
server
in
client-‐server
§ fsm_server
§ Finite
state
machines
§ gen_event
§ Event
handling
§ Applicapons
§ Applicapon
§ Releases
21. Web
Development
§ Web
Servers
§ Inets
§ Build-‐in
§ Yaws
§ 80,000
concurrent
connecpons
(2002)
§ MochiWeb
§ Lightweight
HTTP
§ Web
Frameworks
§ ErlyWeb
§ MVC
for
Yaws
§ Erlang
Web
§ MVC
for
Yaws
and
Inets
§ Nitrogen
§ An
event-‐driven
2.0
framework
(cometd)
22. Wri2en
in
Erlang
§ Apache
CouchDB
§ Document-‐oriented
database
(replicapon)
§ RabbitMQ
§ Message-‐oriented
middleware
§ Riak
§ NoSQL
database
(ring)
§ Ejabberd
§ XMPP
applicapon
server
23. Development
Tools
§ IDEs
§ Eclipse
§ Emacs
+
Distel
§ Vim
§ Tools
§ MOEBIUS
§ CI
Server
§ rebar
§ Build
and
packaging
tool
24. Erlang
in
Producpon
§ Ericsson
AXD301
telco
switch
§ 160
GB/s
§ 1
million
lines
of
Erlang
§ Hundreds
of
programmers
§ 99.9
999
999%
reliability
§ GPRS
§ GSM
cell
telco
network
§ Facebook
Chat
§ 800+
million
messages
/
day
§ GitHub
§ Goldman
Sachs
???
§ High-‐frequency
trading
§ Deutsche
Bank