Erlang u praksi

78d85ea26770975ea8c497d7bd722d55?s=47 Saša Jurić
November 24, 2012

Erlang u praksi

WebCamp Zagreb, 2012

78d85ea26770975ea8c497d7bd722d55?s=128

Saša Jurić

November 24, 2012
Tweet

Transcript

  1. Erlang u praksi sasa.juric@minus5.hr

  2. Korisnici

  3. Platforma • jezik • framework (OTP) • runtime

  4. Konkurentnost spawn(...)

  5. Konkurentnost scheduler spawn(...)

  6. Konkurentnost scheduler CPU scheduler CPU scheduler CPU scheduler CPU spawn(...)

  7. Komunikacija P1 poruka P2 P2 = spawn(...), P2 ! Poruka

    receive Poruka1 -> ... Poruka2 -> ... ... end
  8. Komunikacija P1 poruka odgovor P2 P2 ! {self(), ...}, receive

    ... receive {Sender, ...} -> ... Sender ! Response end
  9. Stanje A = 5, A = A + 1

  10. Stanje S f(Stanje) -> Poruka = receive ... end, NovoStanje

    = f2(Poruka, Stanje), f(NovoStanje).
  11. Stanje {set, ...} {get, ...} P S f(Stanje) -> Poruka

    = receive ... end, NovoStanje = f2(Poruka, Stanje), f(NovoStanje).
  12. Actor model actor actor actor actor actor actor

  13. Supervisor S W

  14. Supervisor W S S S W W W S W

    W W W
  15. Http server http_server request_1 request_n request response response

  16. Http server http_server stanje request_1 request_n request response response

  17. Push server korisnik_1 korisnik_2 korisnik_n kanal_2 kanal_1 podaci podaci

  18. Push server <= 3000 paralelnih korisnika ≈ 30 kanala >

    2000 requesta u sekundi
  19. Erlang • actor model • supervisor • distribuiranost • mnesia

    • hot code swapping • interoperabilnost • alati
  20. Primjena • server • skalabilnost • dinamički requesti

  21. 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