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

OpenRestyについて

 OpenRestyについて

OpenRestyについて

newapplesho

February 01, 2018
Tweet

More Decks by newapplesho

Other Decks in Programming

Transcript

  1. S h o Yo s h i d a (

    @ n e w a p p l e s h o ) O p e n R e s t y Λ ༻ ͍ͯ ΠέΠέ ͳ α ʔ Ϗ ε Λ ࡞ Δ ํ ๏ 2 0 1 8 / 0 2 / 0 1
  2. ४ උ Ͱ ͖ ͯ ͍ ͳ ͍Ͱ ͢ ɾ

    ɾ ɾ ͢Έ·ͤΜɻௐࢠͷΓ·ͨ͠ɻ
  3. O p e n R e s t y ͱ

    ͸ • lua-nginx-moduleͳͲɺศརͳϞδϡʔϧΛ௥Ճͨ͠nginxΛ؆୯ʹϏϧυ Ͱ͖ΔΑ͏ʹͯ͘͠ΕΔϓϩμΫτ • ngx_luaΛ͸͡Ίͱ͢ΔCͰॻ͔Ε֤ͨछαʔυύʔςΟϞδϡʔϧͱ ngx_luaͷAPIΛར༻ͨ͠restyϞδϡʔϧɺLua/LuaJITͰߏ੒
  4. L u a - n g i n x -

    m o d u l e • https://github.com/openresty/lua-nginx-module • https://www.nginx.com/resources/wiki/modules/lua/
  5. N g i n x Ͱ l u a ࢖

    ͑Δ ͱ Կ ͕ ͍ ͍ ͷ ʁ • ϛυϧ΢ΣΞʹೝূɺϧʔςΟϯάɺΞΫηε੍ޚͳͲΛ೚ͤΒΕΔ • ໾ׂͷ෼ղͨ͠Πϯϑϥߏ੒ɺαʔϏεઃܭ͕ՄೳʹͳΔ͸ͣ • ཁ͢Δʹϛυϧ΢ΣΞΛ΋ͬͱ׆༻Ͱ͖Δ
  6. O p e n R e s t y Λ

    ࢖ ͬ ͨ Π ϯ ϑ ϥ ߏ ੒ ྫ HTTP server OpenResty Application Server ೝূ ϧʔςΟϯά ۀ຿ϩδοΫA ۀ຿ϩδοΫB ۀ຿ϩδοΫC ೝূ ϧʔςΟϯά ۀ຿ϩδοΫA ۀ຿ϩδοΫC ۀ຿ϩδοΫB
  7. ϛ υϧ ΢ Σ Ξ Λ ڧ ͘ ͢ Δ

    ྑ ͞ • HTTP headerͷՃ޻ͳͲ͸OpenRestyʹ·͔ͤΒΕΔ • OpenResty഑Լͷαʔόʔ͸ಛఆͷۀ຿ϩδοΫ͚ͩʹઐ೦Ͱ͖Δ • APIίʔϧʹԠͨ͡ॲཧͳͲ΋هड़Ͱ͖ɺϚΠΫϩαʔϏεԽ͠΍͘͢ͳΔ
  8. A P I α ʔ Ϗ εΠ ϯ ϑ ϥ

    ߏ ੒ ֓ ཁ API Clientʹରͯ͠಺෦ɼ֎෦ͷϧʔςΟϯάΛߦ͏αʔόʔʢAPIϧʔςΟϯάαʔόʔʣΛલ ஈʹ͸഑ஔΛߦ͏ɻ֎෦API΁ͷΞΫηεͷࡍʹ͸ɺAPIϧʔςΟϯάαʔόʔ͕APIΞΫηεೝ ূΛߦ͍ɺAPI Server΁઀ଓΛ͢Δɻ
  9. A P I όʔ δϣ ϯ ௥ Ճ ࣌ ͷ

    ߏ ੒ API όʔδϣϯ௥Ճͷࡍʹ͸ɺAPIϧʔςΟϯάαʔόʔɺద੾ͳAPI Server΁઀ଓΛ͢Δ Α͏ʹ੍ޚ͢Δ