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
800
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
mrubyによるWebサーバ機能の拡張
Ruby東京プレゼンテーション2014テクニカルトーク前半
MATSUMOTO Ryosuke
PRO
February 01, 2014
More Decks by MATSUMOTO Ryosuke
See All by MATSUMOTO Ryosuke
問いを起点に、社会と共鳴する知を育む場へ
matsumoto_r
PRO
0
890
さくらインターネット研究所 アップデート2025年
matsumoto_r
PRO
0
950
リモートワークにおけるパッシブ疲労
matsumoto_r
PRO
6
5.5k
エンジニアのキャリアパスはどう描く? まつもとりーさんと考える後悔しないキャリア選択
matsumoto_r
PRO
10
2.5k
まつもとりーのこれまでとCOGNANOのこれから
matsumoto_r
PRO
0
390
2022年の研究所の評価制度振り返りと今後
matsumoto_r
PRO
0
920
VUCAワールドから紐解く組織や評価制度の変遷と再設計
matsumoto_r
PRO
9
27k
コンテナの研究開発から学ぶLinuxの要素技術
matsumoto_r
PRO
2
1.6k
開発者体験をさらに向上させる 事業と研究との連携
matsumoto_r
PRO
2
2.6k
Other Decks in Research
See All in Research
シングルチャネルマルチトーカー音声認識の進展
ryomasumura
0
210
Visual SLAM未来予測 / Future Prediction in Visual SLAM
koide3
1
880
LLM Compute Infrastructure Overview
karakurist
2
1.6k
SAKURAONE:An Open Ethernet-based AI HPC System And Its Observed Workload Dynamicsin a Single-Tenant LLM Development Environment
yuukit
1
530
長時間動画QAにおけるマルチエージェント推論 ・SVAgent: Storyline-Guided Long Video Understanding via Cross-Modal Multi-Agent Collaboration
murakawatakuya
1
180
Cross-Media Human-Information Interaction
signer
PRO
0
170
AY 2026 Guide to Academic Writing Using Generative AI - Workshop
ks91
PRO
0
150
Research Engineerという仕事 / Research Engineering: Bridging Research and Business
chck
1
260
NLP colloquium: AI Safety Survey
kanekomasahiro
0
970
【Zozo Research 技術共有会】三次元領域の現在と展望
mickey_0226
3
560
Cross-Media Information Spaces and Architectures
signer
PRO
0
330
GLIM とMegaParticles:正規分布近似の限界とタイトカップリング&パーティクルフィルタの進展 / GLIM and MegaParticles : Progress of the distribution representation in SLAM
koide3
0
700
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
1
520
Embracing the Ebb and Flow
colly
88
5.1k
HDC tutorial
michielstock
2
790
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
A Tale of Four Properties
chriscoyier
163
24k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Mobile First: as difficult as doing things right
swwweet
225
10k
Mind Mapping
helmedeiros
PRO
1
320
Everyday Curiosity
cassininazir
0
280
Code Reviewing Like a Champion
maltzj
528
40k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
270
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