Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Solid Ground

Solid Ground

Empex, 2017

Saša Jurić

May 20, 2017
Tweet

More Decks by Saša Jurić

Other Decks in Programming

Transcript

  1. pattern matching OTP metaprogramming mix Distillery the pipe operator Cowboy

    Plug Phoenix Ecto functional programming community GenStage Credo ExUnit Combine Poolboy Nerves
  2. LFE Erlang OTP BEAM Elixir Phoenix GenStage Ecto Plug magic

    source magic beneficiaries Cowboy Poolboy
  3. thread 1 thread n long running task long running task

    blocked cooperative scheduler …
  4. thread 1 thread n long running task long running task

    BEAM scheduler … not blocked :-)
  5. mref = Process.monitor(pid) send(pid, :please_stop) receive do {:DOWN, ^mref, :process,

    ^pid, _reason} -> :ok after :timer.seconds(5) -> Process.exit(pid, :kill) receive do {:DOWN, ^mref, :process, ^pid, _reason} -> :ok end end
  6. task = Task.async(fn -> ... end) case Task.yield(task, :timer.seconds(5)) do

    {:ok, result} -> do_something(result) nil -> Task.shutdown(task, :brutal_kill) end
  7. supervisor foundations frequent context switching activities as runtime citizens observable

    process termination stoppable processes shared-nothing concurrency
  8. Scales of Justice image taken from clipartfox.com How Erlang does

    scheduling http://jlouisramblings.blogspot.hr/2013/01/how-erlang-does-scheduling.html Erlang scheduler details https://hamidreza-s.github.io/erlang/scheduling/real-time/preemptive/migration/ 2016/02/09/erlang-scheduler-details.html The BEAM book https://github.com/happi/theBeamBook BEAM wisdoms http://beam-wisdoms.clau.se/en/latest/ Web based observer https://github.com/shinyscorpion/wobserver Recon http://ferd.github.io/recon/ Erlang performance lab http://www.erlang.pl/