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
Trusterd: HTTP/2 Web Server scripting with mruby
Search
MATSUMOTO Ryosuke
PRO
January 28, 2015
Technology
3
790
Trusterd: HTTP/2 Web Server scripting with mruby
mrubyで振る舞いを記述可能な高速に動作するHTTP/2 Webサーバ
MATSUMOTO Ryosuke
PRO
January 28, 2015
Tweet
Share
More Decks by MATSUMOTO Ryosuke
See All by MATSUMOTO Ryosuke
エンジニアのキャリアパスはどう描く? まつもとりーさんと考える後悔しないキャリア選択
matsumoto_r
PRO
4
650
まつもとりーのこれまでとCOGNANOのこれから
matsumoto_r
PRO
0
240
2022年の研究所の評価制度振り返りと今後
matsumoto_r
PRO
0
620
VUCAワールドから紐解く組織や評価制度の変遷と再設計
matsumoto_r
PRO
9
25k
コンテナの研究開発から学ぶLinuxの要素技術
matsumoto_r
PRO
2
1.4k
開発者体験をさらに向上させる 事業と研究との連携
matsumoto_r
PRO
2
2.1k
企業研究の価値と事業との連携
matsumoto_r
PRO
0
1.2k
誇りを持って研究していくために
matsumoto_r
PRO
1
1.4k
インフラの企業研究の価値とこれから
matsumoto_r
PRO
7
19k
Other Decks in Technology
See All in Technology
Discovering AI Models
picardparis
4
3.9k
『GRANBLUE FANTASY Relink』キャラクターの魅力を支えるリグ・シミュレーション制作事例
cygames
0
140
技術的負債解消の取り組みと専門チームのお話
bengo4com
0
340
LLVM/ASMを使った有限体の高速実装
herumi
0
120
とあるOSSを継続可能にするための取り組みについて / OSS Refactoring Process
bun913
1
210
LINEヤフーのフロントエンド組織・体制の紹介
lycorp_recruit_jp
1
1.2k
JTCや セキュリティチェックリストが夢の跡
nikinusu
1
740
PdMはどのように全てのスピードを上げられるか ~ 非連続進化のための具体的な取り組み ~
sansantech
PRO
4
1.3k
不動産tech Product Night#2_AIことはじめ_GA橋本
takehikohashimoto
0
190
フルカイテン株式会社 採用資料
fullkaiten
0
32k
実務における脅威モデリングを考えよう
nikinusu
0
680
watsonx.ai Dojo 環境準備について
oniak3ibm
PRO
0
340
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.6k
Infographics Made Easy
chrislema
239
18k
KATA
mclloyd
27
13k
What the flash - Photography Introduction
edds
67
11k
Build your cross-platform service in a week with App Engine
jlugia
228
18k
Optimizing for Happiness
mojombo
375
69k
Writing Fast Ruby
sferik
623
60k
Designing with Data
zakiwarfel
98
5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
190
16k
Producing Creativity
orderedlist
PRO
340
39k
Building an army of robots
kneath
302
42k
Why Our Code Smells
bkeepers
PRO
334
56k
Transcript
5SVTUFSE NSVCZͰৼΔ͍Λهड़Մೳͳ ߴʹಈ࡞͢Δ)5518FCαʔό দຊ྄հ
࣍ • 5SVTUFSEͷಛ • 3VCZΛద༻ͨ͠Օॴ • 3VCZΛ׆༻ͨ͜͠ͱʹΑΔޮՌ • ࣾձʹٴ΅͢Өڹ 第7回フクオカRuby大賞
本審査 2
5SVTUFSEͷಛ 第7回フクオカRuby大賞 本審査 3
5SVTUFSE • )5518FCαʔό • 3VCZͰઃఆ͕ॻ͚Δ • 3VCZͰػೳ֦ுͰ͖Δ • αʔόػೳΛΞϓϦʹࠐΈՄೳ •
ඇৗʹߴʹಈ࡞͢Δ 第7回フクオカRuby大賞 本審査 4
ߴʢ݄ݱࡏʣ HTTP/2 Server \ size of content 6 bytes 4,096
bytes ngh)pd(single thread) 148,841 73,812 ngh)pd(mul= thread) 347,152 104,244 =ny-‐ngh)pd(single thread) 190,223 82,047 trusterd(single thread) 204,769 92,068 trusterd(mul= process) 509,059 134,542 H2O(single thread) 216,453 112,356 H2O(mul= thread) 379,623 146,343 第7回フクオカRuby大賞 本審査 5 HTTP/1 Server \ size of content 6 bytes 4,096 bytes nginx(single thread) 21,708 22,366 nginx(mul= process) 67,349 56,203 ࢀߟɿಉڥͷ)551ͷ݁Ռɹ ※ https://github.com/matsumoto-r/trusterd#benchmarks
։ൃͷܦҢ • աڈʹNPE@NSVCZOHY@NSVCZΛ։ൃ – ߴɾলϝϞϦʹ8FCαʔόΛػೳ֦ு – 3VCZͰ͋ΔఔৼΔ͍Λهड़Մೳ – ಈతͳઃఆɾ֦ுΛ3VCZͰهड़Մೳ •
NPE@NSVCZOHY@NSVCZͷଥڠ – ੑೳ͕"QBDIFOHJOYʹґଘ – ઃఆͷ֦ு࣮͕Ϟδϡʔϧ༷ʹґଘ – ݁ہຊମͷઃఆ͔ΒಀΕΒΕͳ͍ɾࠞࡏ 第7回フクオカRuby大賞 本審査 6
͔Β࡞Ζ͏ • ޙΛݟӽͯ͠ • Ͳ͏ͤͳΒ)5518FCαʔό • શͯͷઃఆ֦ுΛ3VCZͰॻ͚Δ • NSVCZʹ࠷దԽ͞Εͨ8FCαʔό •
ػೳͷͱଞΞϓϦͷࠐΈ 第7回フクオカRuby大賞 本審査 7
3VCZΛద༻ͨ͠Օॴ 第7回フクオカRuby大賞 本審査 8
5SVTUFSE • )5518FCαʔό • 3VCZͰઃఆ͕ॻ͚Δ • 3VCZͰػೳ֦ுͰ͖Δ • αʔόػೳΛΞϓϦʹࠐΈՄೳ •
ඇৗʹߴʹಈ࡞͢Δ 第7回フクオカRuby大賞 本審査 9
3VCZͰઃఆ͕ॻ͚Δ 第7回フクオカRuby大賞 本審査 10 root_dir = "/usr/local/trusterd" s = HTTP2::Server.new({
:port => 8080, :document_root => “#{root_dir}/htdocs”, :server_name => “Trusterd/0.0.1”, :tls => false, :worker => “auto”, }) s.run
3VCZͰػೳ֦ுͰ͖Δ 第7回フクオカRuby大賞 本審査 11 s.set_map_to_strage_cb { if s.r.uri == ”/”
s.r.filename = "#{root_dir}/index.html” end if s.r.uri =~ /^.*\.rb$/ s.enable_mruby fi } s.set_content_cb { s.r.rputs "hello trusterd world from cb” }
3VCZͰػೳ֦ுͰ͖Δ 第7回フクオカRuby大賞 本審査 12 f = File.open "#{root_dir}/logs/access.log", "a" s.set_logging_cb
{ f.write "client_ip:'#{s.conn.client_ip}' date:'#{s.r.date}' status:#{s.r.status} content_length:#{s.r.content_length} uri:'#{s.r.uri}' filename:'#{s.r.filename}' user_agent:'#{s.r.user_agent}'\n" } s.set_access_check_cb { s.r.set_status 403 if deny }
3VCZͰػೳ֦ுͰ͖Δ 第7回フクオカRuby大賞 本審査 13 s.set_map_to_strage_cb { # Experiment: reverse proxy
# client <=HTTP/2=> trusterd <=HTTP/1=> Upstream if s.r.uri == /^/upstream(¥/.*)/ s.upstream_uri = $1 s.upstream = “http://127.0.0.1:8081” end }
αʔόػೳΛΞϓϦʹࠐΈ • NSVCZIUUQͱͯ͠Մೳ • NSVCZܦ༝ͰࠐΈՄೳ • ϛυϧΣΞΞϓϦͰ)551௨৴ • NSVCZͷࡌΔσόΠεͰ)551௨৴ 第7回フクオカRuby大賞
本審査 14
3VCZΛ׆༻ͨ͜͠ͱʹΑΔޮՌ 第7回フクオカRuby大賞 本審査 15
ߴ͍ϨϕϧͰੜ࢈ੑͱੑೳͷཱ྆ • ैདྷͷಠࣗઃఆॻ͖ʹ͔ͬͨ͘ – ੩తͳઃఆʹͳΓ͕ͪ – ಠࣗ%4-͍ʹ͍͘ – ࠓޙͷ8FCαʔϏεͷߴԽʹ͍͚ͳ͍ • NSVCZͰ౷Ұతʹಈతͳઃఆهड़ – )551ΛΞϓϦσόΠεʹࠐΊΔ – ຊମ$ݴޠͰ࣮͓ͯ͠Γඇৗʹߴ
– ઃఆͷ3VCZԽ͕࣮͍͢͠ɾअຐ͠ͳ͍ 第7回フクオカRuby大賞 本審査 16
ࣾձʹٴ΅͢Өڹ 第7回フクオカRuby大賞 本審査 17
NSVCZͰઃఆΛॻ͘ΞϓϦͷීٴ • ߴ͔ͭ3VCZʹΑΔಈతͳઃఆ – 8FCܥΤϯδχΞ͕ѻ͍͍͢ – ։ൃऀӡ༻ऀͲ͜Ͱ3VCZΛֶΔ – 3VCZNSVCZͷීٴʹߩݙ • )551ϓϩτίϧΛ༰қʹར༻Մೳ – $ΞϓϦσόΠεʹػೳࠐΈ – ϓϩτίϧ)551ͰઃఆNSVCZ
– )551ͷීٴʹߩݙ 第7回フクオカRuby大賞 本審査 18