Advisor at Grooves Inc. • Visiting Researcher at GMO Pepabo, Inc. • Ph.D of Informatics, Kyoto University • My interests: Operation technology, Internet foundation technology, System programming, Highly integrated multi-tenant architecture, Hosting service, Cloud platform, C, mruby, Rust • Engineering => Technology <= Research 2 Ryosuke Matsumoto @matsumotory
service, Cloud platform service • Operation technology for middleware written by C • Apache, nginx, dovecot, postfix, sendmail, bind, proftp… • want to write operation tools for middleware using perl • want to write extension module for middleware • each middleware dependency • Apache module, nginx module, dovecot plugin…. 7 I’m a former web operation engineer
pmilter (milter server) • Trusterd HTTP/2 Web Server • h2o_mruby (Initial implementation with v1.4) • Other system tools: rcon, capcon, pfds, virtualing, ab-mruby • developed the greatest number of mrbgem in mgem-list • also received Ph.D. of informatics 13 My developed middleware with mruby
code • limit Ruby methods by mruby • Dynamically control middleware by session parameters • cooperate with microservices • record a session data and utilize the data • implement Service Mesh functions • HTTP(S)ɾTCP/UDP stream 14 Why embed mruby into middleware
(non-blocking operation) • usability, operation/development technology • Strategy for multi-process/multi-threading • focus on performance like non-blocking in this presentation 15 How embed mruby into middleware
in single process/thread (C10k) • want to use multi cpu core sufficiently • process blocking operation in non-blocking mode • File I/O, Network I/O, sleep… • monitor I/O state and notify status change like epoll() • generally implement suitable event loop for middleware 17 Non-blocking middleware
generally • Bottleneck of performance when accepting multiple requests simultaneously • Other responses are delayed in proportion to the time of processing of mruby blocking 18 Non-blocking middleware with mruby
mruby processing until the blocking method is completed • using Fiber of mruby 3.return to event loop of nginx from mruby VM • monitor non-blocking function on nginx 4.nginx process other requests…. 5.resume mruby processing by callback func in event loop 24 Non-blocking middleware nginx with mruby
the response time on a app server from 1 ms to 50 ms, benchmark the number of simultaneous connections with 100 and measure request/s 2. Fix the response time on the app server to 10 ms, change the number of simultaneous connections from 1 to 100, and measure request/s • We compared the performance of blocking http client and non- blocking http client under these conditions. 25 ngx_mruby blocking vs non-blocking
would be very happy if Japanese and Russian engineers could communicate more • Why / How embed mruby into middleware like nginx • connect services dynamically and programmably • blocking/non-blocking • Happy hacking nginx + mruby (ngx_mruby) ! • https://github.com/matsumotory/ngx_mruby 32 Conclusions