Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Web API サーバーとしての Elixir の可能性

Naoya Ito
August 28, 2015

Web API サーバーとしての Elixir の可能性

API Meetup Tokyo #9 での発表資料です

Naoya Ito

August 28, 2015
Tweet

More Decks by Naoya Ito

Other Decks in Technology

Transcript

  1. 1SPT$POT •  1SPT –  ҆શ •  ϦΫΤετ͝ͱʹϝϞϦۭؒ෼཭㱺Ϋϥογϡͯ͠΋ ଞʹӨڹ͠ͳ͍ –  ϓϩάϥϛϯάϞσϧ͕୯७

    ಉظͰ0,  –  ϚϧνίΞ •  $POT –  εέʔϥϏϦςΟʹ೉ •  ϝϞϦେ㱺࠷େϓϩηε਺ಉ࣌ฒߦ਺্ݶ •  04ϓϩηεεϨουͷίϯςΩετεΠον
  2. ࣌ؒ A B A C D B ・・・ select()  /

     epoll()   ίϯςΩετ εΠον ΠϕϯτۦಈϞσϧʹΑΔฒߦॲཧ ྫ&WFOU.BDIJOF /PEFKT 
  3. 1SPT$POT •  1SPT –  εέʔϥϏϦςΟ ߴ͍ฒߦॲཧੑೳ  •  ϝϞϦϑοτϓϦϯτখ͍͞ • 

    ಉ࣌઀ଓ਺͕૿͑ͯ΋εέʔϧ •  $POT –  ଱ো֐ੑʹ೉ •  མͪΔͱ͖͸શ෦མͪΔ •  ϝϞϦϦʔΫ͜Θ͍ –  ϓϩάϥϛϯάϞσϧ͕΍΍ෳࡶ˞/PEFKTͩͱͦΕ΄ͲͰ΋ͳ͍  –  ϚϧνίΞ$16Λ࢖͍ͮΒ͍
  4. &SMBOHͷ࣮ߦ؀ڥ •  #&". &SMBOH7.  – ܰྔϓϩηεŋŋŋ࣮ߦίϯςΩετ •  খ͍͞ϫʔυɺىಈʹdϚΠΫϩඵ – ฒߦॲཧੑೳ͕ߴ͍ • 

    7.͕ܰྔϓϩηεΛεέδϡʔϦϯά –  7.εϨουຖʹϥϯΩϡʔ –  ཪଆͰ͸ඇಉظεϨουϓʔϧ ref:  h+p://www.erlang-­‐factory.com/upload/presenta=ons/708/HitchhikersTouroEheBEAM.pdf
  5. &SMBOHͷϝϞϦϞσϧ •  QFS1SPDFTT($ –  ϓϩηεຖʹ($ •  άϩʔόϧ($ͩͱશମʹӨڹ͢Δ •  ϓϩηε෼཭ – 

    4IBSFE/PUIJOH –  ϓϩηε)FBQ •  ($͸ܰྔϓϩηεຖʹ૸ΒͤɺཁΒͳ͘ͳͬͨΒഇغ ؆ ୯Ͱޮ཰͕Α͍  ҆ఆͨ͠Ԡ౴ੑೳ ߴ͍଱ো֐ੑ
  6. &MJYJS •  &SMBOH7.ͷ্Ͱಈ͘ݴޠ –  &SMBOH7.ͷڧΈ ฒߦॲཧੑೳɺ଱ো֐ੑ Λͦͷ··ʹɺγϯ λοΫεΛೃછΈ΍͘͢ •  KPTFWBMJN&SMBOHͰݟͨ͜ͱ͸ΈΜͳؾʹೖ͚ͬͨͲɺݟͳ͔ͬͨ͜ͱ

    ͸ΈΜͳݏ͍ –  &SMBOHͱ૬ޓޓ׵ –  051΋΋ͪΖΜ͋ΔΑ •  Ϟμϯͳύοέʔδ؅ཧγεςϜɺ-B[ZίϨΫγϣϯ 4USFBN ɺ ϓϩτίϧͳͲͷ௥Ճཁૉ •  ৄ͘͠͸ –  IUUQTTQFBLFSEFDLDPNOBPZBFMJYJSHPTIBPKJF
  7. ϕϯνϚʔΫ ref:  h+p://www.li+lelines.com/blog/2014/07/08/elixir-­‐vs-­‐ruby-­‐showdown-­‐phoenix-­‐vs-­‐rails/ $  ./wrk  -­‐t12  -­‐c800  -­‐d180S  -­‐-­‐timeout  2000

     "http://tranquil-­‐brushlands-­‐6459.herokuapp.com/showdown"   Running  3m  test  @  http://tranquil-­‐brushlands-­‐6459.herokuapp.com/showdown      12  threads  and  800  connections      Thread  Stats      Avg            Stdev          Max      +/-­‐  Stdev          Latency      318.52ms    139.92ms      1.39s        82.03%          Req/Sec      224.42          57.23      368.00          68.50%      484444  requests  in  3.00m,  0.99GB  read      Socket  errors:  connect  0,  read  9,  write  0,  timeout  0   Requests/sec:      2691.03   Transfer/sec:            5.65MB $  ./wrk  -­‐t12  -­‐c800  -­‐d180S  -­‐-­‐timeout  2000  "http://dry-­‐ocean-­‐9525.herokuapp.com/showdown"   Running  3m  test  @  http://dry-­‐ocean-­‐9525.herokuapp.com/showdown      12  threads  and  800  connections        Thread  Stats      Avg            Stdev          Max      +/-­‐  Stdev          Latency          3.07s          2.06s        8.36s        70.39%          Req/Sec        24.65            9.97        63.00          67.10%      54256  requests  in  3.00m,  122.50MB  read      Socket  errors:  connect  0,  read  1,  write  0,  timeout  0   Requests/sec:        301.36   Transfer/sec:        696.77KB Phoenix Rails  w/  Puma ॾ৚݅͋ΔͷͰߟ࡯͸ࣗݾ੹೚Ͱɻ 1IPFOJY͕ൺֱͯ͠଎͍ͷ͸ؒҧ ͍ͳͦ͞͏ 
  8. ྑ͍͜ͱ͹͔Γݴ͍·͕ͨ͠ŋŋŋ •  ฒߦੑೳ͕ߴ͍ɺԠ౴ੑೳ͕ྑ͍ͱ͸ݴ͕ͬͨʮܭࢉ͕ ଎͍ʯͱ͸ݴͬͯͳ͍ –  1IPFOJYελοΫ͸3BJMTΑΓ͸଎͍ɺ͚Ͳ΋ –  ಈతܕ෇͚ݴޠͰ͢͠ –  ˞ҰԠ)J1&ʹ͢Δͱ଎͘͸ͳΔ΋Α͏

    •  ؔ਺ܕݴޠͱͯ͠͸ͦ͜·ͰߴػೳͰ͸ͳ͍ •  ݸਓతͳ࿩ େن໛ӡ༻ͯ͠ͳ͍ͷͰ$POTΛޠΔʹ ஌ݟ଍Γͳ͍ •  &MJYJSྲྀߦΔ͔͸·ͩະ஌਺ –  ϓϩμΫγϣϯ౤ೖࣄྫ͸·ͩ͜Ε͔Β
  9. ׬