Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Erlang u praksi
Saša Jurić
November 24, 2012
Programming
1
210
Erlang u praksi
WebCamp Zagreb, 2012
Saša Jurić
November 24, 2012
Tweet
Share
More Decks by Saša Jurić
See All by Saša Jurić
sasajuric
0
120
sasajuric
3
380
sasajuric
3
510
sasajuric
2
220
sasajuric
16
990
sasajuric
2
550
sasajuric
0
92
sasajuric
3
740
sasajuric
1
160
Other Decks in Programming
See All in Programming
sullis
0
120
akatsukinewgrad
0
210
line_developers_tw2
0
760
nauleyco
0
210
viteinfinite
0
210
akatsukinewgrad
0
210
dictoss
0
170
kyoheig3
0
440
malvinstn
1
650
itosho525
0
150
hr01
0
1.6k
line_developers_tw
1
490
Featured
See All Featured
smashingmag
229
18k
stephaniewalter
260
11k
shlominoach
176
7.4k
skipperchong
7
670
matthewcrist
73
7.5k
chriscoyier
499
130k
andyhume
62
3.4k
paulrobertlloyd
71
3.6k
garrettdimon
287
110k
mza
80
4.1k
aarron
258
36k
ddemaree
274
31k
Transcript
Erlang u praksi sasa.juric@minus5.hr
Korisnici
Platforma • jezik • framework (OTP) • runtime
Konkurentnost spawn(...)
Konkurentnost scheduler spawn(...)
Konkurentnost scheduler CPU scheduler CPU scheduler CPU scheduler CPU spawn(...)
Komunikacija P1 poruka P2 P2 = spawn(...), P2 ! Poruka
receive Poruka1 -> ... Poruka2 -> ... ... end
Komunikacija P1 poruka odgovor P2 P2 ! {self(), ...}, receive
... receive {Sender, ...} -> ... Sender ! Response end
Stanje A = 5, A = A + 1
Stanje S f(Stanje) -> Poruka = receive ... end, NovoStanje
= f2(Poruka, Stanje), f(NovoStanje).
Stanje {set, ...} {get, ...} P S f(Stanje) -> Poruka
= receive ... end, NovoStanje = f2(Poruka, Stanje), f(NovoStanje).
Actor model actor actor actor actor actor actor
Supervisor S W
Supervisor W S S S W W W S W
W W W
Http server http_server request_1 request_n request response response
Http server http_server stanje request_1 request_n request response response
Push server korisnik_1 korisnik_2 korisnik_n kanal_2 kanal_1 podaci podaci
Push server <= 3000 paralelnih korisnika ≈ 30 kanala >
2000 requesta u sekundi
Erlang • actor model • supervisor • distribuiranost • mnesia
• hot code swapping • interoperabilnost • alati
Primjena • server • skalabilnost • dinamički requesti
Linkovi • Why Erlang? • Programming Erlang • Learn You
Some Erlang for Great Good! • Erlang and OTP in Action • A History of Erlang • erlang.org • Erlang Programming Group