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

「ElixirがリアルタイムWebに強い」 というのは本当か?

mururu
April 01, 2017

「ElixirがリアルタイムWebに強い」 というのは本当か?

Elixir Conf Japan 2017

mururu

April 01, 2017
Tweet

More Decks by mururu

Other Decks in Technology

Transcript

  1. ܰྔϓϩηε • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά •

    Shared nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά 1 spawn fn -> 1 + 2 end spawn fn -> loop() end spawn dead
  2. ܰྔϓϩηε • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά •

    Shared nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά 1 1 1 045ISFBE 045ISFBE
  3. ܰྔϓϩηε • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά •

    Shared nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά 1 309 words
  4. • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά • Shared

    nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά ܰྔϓϩηε 1 1 receive do {:get, key, caller} -> send caller, find(key) end
  5. ܰྔϓϩηε • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά •

    Shared nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά 1 1 Copy
  6. ܰྔϓϩηε • N:MεϨουϞσϧ • minimum 309 words • ϝοηʔδύογϯά •

    Shared nothing • ܰྔϓϩηε͝ͱͷGC • ϓϦΤϯϓςΟϒͳεέʔδϡʔϦϯά 1 1 045ISFBE resume stopped
  7. Phoenix.Socket defmodule HelloPhoenix.UserSocket do use Phoenix.Socket channel "room:*", HelloPhoenix.RoomChannel def

    connect(_params, socket) do {:ok, socket} end def id(_socket), do: nil end ग़య: http://www.phoenixframework.org/docs/channels
  8. Phoenix.Channel defmodule HelloPhoenix.RoomChannel do use Phoenix.Channel def join("room:lobby", _message, socket)

    do {:ok, socket} end def join("room:" <> _private_room_id, _params, _socket) do {:error, %{reason: "unauthorized"}} end def handle_in("new_msg", %{"body" => body}, socket) do broadcast! socket, "new_msg", %{body: body} {:noreply, socket} end end ग़య: http://www.phoenixframework.org/docs/channels
  9. $MJFOU gen_tcp, ranch, cowboy Phoenix.Socket ->
 Phoenix.Transports.WebSocket Phoenix.Channel -> Phoenix.Channel.Server

    Phoenix.PubSub.PG2 $MJFOU gen_tcp, ranch, cowboy Phoenix.Socket ->
 Phoenix.Transports.WebSocket Phoenix.Channel -> Phoenix.Channel.Server x topics x topics