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

The Future of mruby in HTTP Server - RubyKaigi ...

The Future of mruby in HTTP Server - RubyKaigi 2015

As the HTTP/2 RFC was published, implementations of HTTP/2 have been actively developed. In this session, from the standpoint of an author of an extension mechanism using mruby for typical HTTP/1.x and HTTP/2 servers like apache, nginx and H2O, I show the possibility of design using mruby in HTTP server with new special features of HTTP/2 like server push. I explain how to design the complex web service system using both HTTP/1.x and HTTP/2 servers based on the need for HTTP/2 considering the changes in the architecture of Web service systems.

MATSUMOTO Ryosuke

December 21, 2015
Tweet

More Decks by MATSUMOTO Ryosuke

Other Decks in Technology

Transcript

  1. GMO Pepabo, Inc. Principal Engineer MATSUMOTO, Ryosuke @matsumotory 2015/12/11 RubyKaigi

    2015 5IF'VUVSFPGNSVCZ JO)5514FSWFS .JEEMFXBSF$POpHVSBUJPOBT$PEF
  2. !NBUTVNPUPSZ  ."546.050 3ZPTVLF  1SJODJQBM&OHJOFFSBU(.01FQBCP *OD  8FCPQFSBUJPO EFWFMPQNFOUBOESFTFBSDI

     )BOEMFBDPNQBOZXJEFJOUFSOFUUFDIOPMPHZ  044 "DBEFNJD3FTFBSDI &OHJOFFSJOH  IUUQSFTFBSDINBUTVNPUPSKQ
  3. $POUFOUT  )551JOUSPEVDUJPO  )551DIBSBDUFSJTUJDT  4FSWFSQVTI  1SJPSJUJ[BUJPO 

    NSVCZJO)5514FSWFSEFTJHOQPMJDZ  NSVCZJO)5514FSWFS  $PODMVTJPOBOE'VUVSFSFTFBSDIQMBO
  4. )5511SPCMFNT  /PU.VMUJQMFYJOH  SFRVFTUSFTQPOTFQFS355ʢ3PVOE5SJQ5JNFʣ  )BSEUPSFBMJ[F)551QJQFMJOJOHJOQSBDUJDF  4FOENVMUJQMFSFRVFTUTXJUIPVUXBJUJOHGPSUIF DPSSFTQPOEJOHSFTQPOTFTJO355

     /FFEUPTZODISPOJ[FUIFPSEFSTPGSFRVFTUTBOE SFTQPOTFT  "TMPXSFRVFTUIB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