Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
mrubyによるWebサーバ機能の拡張
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
MATSUMOTO Ryosuke
PRO
February 01, 2014
Research
790
0
Share
mrubyによるWebサーバ機能の拡張
Ruby東京プレゼンテーション2014テクニカルトーク前半
MATSUMOTO Ryosuke
PRO
February 01, 2014
More Decks by MATSUMOTO Ryosuke
See All by MATSUMOTO Ryosuke
問いを起点に、社会と共鳴する知を育む場へ
matsumoto_r
PRO
0
820
さくらインターネット研究所 アップデート2025年
matsumoto_r
PRO
0
890
リモートワークにおけるパッシブ疲労
matsumoto_r
PRO
6
5.5k
エンジニアのキャリアパスはどう描く? まつもとりーさんと考える後悔しないキャリア選択
matsumoto_r
PRO
10
2.4k
まつもとりーのこれまでとCOGNANOのこれから
matsumoto_r
PRO
0
370
2022年の研究所の評価制度振り返りと今後
matsumoto_r
PRO
0
890
VUCAワールドから紐解く組織や評価制度の変遷と再設計
matsumoto_r
PRO
9
26k
コンテナの研究開発から学ぶLinuxの要素技術
matsumoto_r
PRO
2
1.6k
開発者体験をさらに向上させる 事業と研究との連携
matsumoto_r
PRO
2
2.5k
Other Decks in Research
See All in Research
The Landscape of Agentic Reinforcement Learning for LLMs: A Survey
shunk031
4
900
ScoreMatchingRiesz for Automatic Debiased Machine Learning and Policy Path Estimation with an Application to Japanese Monetary Policy Evaluation
masakat0
0
260
正規分布と最適化について
koide3
0
150
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
510
明日から使える!研究効率化ツール入門
matsui_528
12
6.8k
CyberAgent AI Lab研修 / Social Implementation Anti-Patterns in AI Lab
chck
6
4.3k
Thirty Years of Progress in Speech Synthesis: A Personal Perspective on the Past, Present, and Future
ktokuda
0
210
Any-Optical-Model: A Universal Foundation Model for Optical Remote Sensing
satai
3
590
Unified Audio Source Separation (Defense Slides)
kohei_1979
1
590
羽田新ルート運用6年の検証
1manken
0
140
R&Dチームを起ち上げる
shibuiwilliam
1
240
AIスーパーコンピュータにおけるLLM学習処理性能の計測と可観測性 / AI Supercomputer LLM Benchmarking and Observability
yuukit
1
850
Featured
See All Featured
BBQ
matthewcrist
89
10k
Building Applications with DynamoDB
mza
96
7k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
230
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
130
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
Building an army of robots
kneath
306
46k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
780
Transcript
mrubyによるWebサーバ機能の拡張 京都大学 松本 亮介 (技術者として)
自己紹介 • 松本亮介 – Twitter @matsumotory • 所属 – 京都大学
大学院 情報学研究科 岡部研究室 – 博士課程 D2 • 専門分野 – OS・Middlewareのセキュリティ・リソース管理・運 用技術改善・パフォーマンス・大規模対応 – http://research.matsumoto-r.jp/ 2 Ruby東京プレゼンテーション2014
Webサーバの機能拡張の分類 1. 動的コンテンツの高速処理を主な目的 • レスポンス生成をいかに効率よくするか • CGIはforkのコストが大きい • サーバプロセスが直接スクリプトを解釈 •
アプリケーションサーバの登場 2. レスポンス生成以外の内部処理が主な目的 • Webサーバそのものの振る舞いを定義 • 軽量な処理が求められる(アクセス制御等) • この目的に特化したオーバーヘッドの少ない仕組み • mruby使うには最適では? ⇒ mod_mruby開発 3 Ruby東京プレゼンテーション2014
mod_mrubyの良い点 4 • Apache2.0から2.4の最新版で動く • ApacheモジュールをRubyで書ける • オーバーヘッドが少ない • 設定が簡単
• ngx_mrubyでも同じような記述で書ける • 機能追加や改善要望を出しやすい 松本亮介,岡部 寿男, mod_mruby: スクリプト言語で高速かつ省メモリに拡張可能なWebサーバの機能拡張 支援機構, 情報処理学会第6回インターネットと運用技術シンポジウム, 2013年12月. 優秀論文賞受賞 Ruby東京プレゼンテーション2014
Apache httpd 設定例 # コンパイル方式: コードの変更可 <Location /mruby-test> mrubyHandlerMiddle /path/to/test.rb
</Location> # キャッシュ方式: コード変更不可だが高速に動作 <Location /mruby-test-cache> mrubyHandlerMiddle /path/to/test.rb cache </Location> Ruby東京プレゼンテーション2014 5
nginx 設定例 # コンパイル方式: コードの変更可 Location /mruby-test { mruby_contenx_handler /path/to/test.rb;
} # キャッシュ方式: コード変更不可だが高速に動作 Location /mruby-test-cache { mruby_contenx_handler /path/to/test.rb cache; } Ruby東京プレゼンテーション2014 6
Reverse Proxy by mod_mruby Ruby東京プレゼンテーション2014 7
BasicAuth with Redis by mod_mruby Ruby東京プレゼンテーション2014 8
リソース制御として応用 r = Apache::Request.new if r.user == “matsumoto_r” cpu =
Cgroup::CPU.new “cpu_group” # CPUを10%に制御したい場合 cpu.cfs_quota_us = 10000 cpu.create cpu.attach end 松本亮介, 岡部寿男, リクエスト単位で仮想的にコンピュータリソースを分離するWebサーバのリソース制御 アーキテクチャ, 情報処理学会研究報告 Vol.2013-IOT-23, No.4, 2013年9月. 学生奨励賞受賞 Ruby東京プレゼンテーション2014 9
まとめ • レスポンス生成処理以外の内部処理を目的 • mrubyによってオーバーヘッドを低減 • Rubyで複数のWebサーバの振る舞いを記述 • Webサービスの各種サーバの連携に最適 •
Web以外のサーバソフトウェアにも応用可能 – メールサーバ、ファイルサーバ… 10 Ruby東京プレゼンテーション2014