Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
mrubyによるWebサーバ機能の拡張
Search
MATSUMOTO Ryosuke
PRO
February 01, 2014
Research
0
780
mrubyによるWebサーバ機能の拡張
Ruby東京プレゼンテーション2014テクニカルトーク前半
MATSUMOTO Ryosuke
PRO
February 01, 2014
Tweet
Share
More Decks by MATSUMOTO Ryosuke
See All by MATSUMOTO Ryosuke
問いを起点に、社会と共鳴する知を育む場へ
matsumoto_r
PRO
0
740
さくらインターネット研究所 アップデート2025年
matsumoto_r
PRO
0
800
リモートワークにおけるパッシブ疲労
matsumoto_r
PRO
6
5.4k
エンジニアのキャリアパスはどう描く? まつもとりーさんと考える後悔しないキャリア選択
matsumoto_r
PRO
10
2.3k
まつもとりーのこれまでとCOGNANOのこれから
matsumoto_r
PRO
0
330
2022年の研究所の評価制度振り返りと今後
matsumoto_r
PRO
0
820
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
自動運転におけるデータ駆動型AIに対する安全性の考え方 / Safety Engineering for Data-Driven AI in Autonomous Driving Systems
ishikawafyu
0
110
snlp2025_prevent_llm_spikes
takase
0
420
AIグラフィックデザインの進化:断片から統合(One Piece)へ / From Fragment to One Piece: A Survey on AI-Driven Graphic Design
shunk031
0
580
SREはサイバネティクスの夢をみるか? / Do SREs Dream of Cybernetics?
yuukit
3
260
Sat2City:3D City Generation from A Single Satellite Image with Cascaded Latent Diffusion
satai
4
400
AlphaEarth Foundations: An embedding field model for accurate and efficient global mapping from sparse label data
satai
3
590
機械学習と数理最適化の融合 (MOAI) による革新
mickey_kubo
1
450
情報技術の社会実装に向けた応用と課題:ニュースメディアの事例から / appmech-jsce 2025
upura
0
280
Community Driveプロジェクト(CDPJ)の中間報告
smartfukushilab1
0
110
高畑鬼界ヶ島と重文・称名寺本薬師如来像の来歴を追って/kikaigashima
kochizufan
0
110
Stealing LUKS Keys via TPM and UUID Spoofing in 10 Minutes - BSides 2025
anykeyshik
0
170
論文紹介:Not All Tokens Are What You Need for Pretraining
kosuken
1
220
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
84
A Tale of Four Properties
chriscoyier
162
23k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
200
Crafting Experiences
bethany
0
22
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
30 Presentation Tips
portentint
PRO
1
170
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Are puppies a ranking factor?
jonoalderson
0
2.4k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
170
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
210
Building the Perfect Custom Keyboard
takai
1
660
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
92
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