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
Haconiwa - mrubyによるLinuxコンテナランタイム / haconiwa-fu...
Search
KONDO Uchio
March 01, 2017
Technology
3
7.2k
Haconiwa - mrubyによるLinuxコンテナランタイム / haconiwa-fukuoka-ruby-award-presentation-2017
福岡Ruby大賞本審査資料 @ 2017/03/01
KONDO Uchio
March 01, 2017
Tweet
Share
More Decks by KONDO Uchio
See All by KONDO Uchio
大規模レガシーテストを 倒すための CI基盤の作り方 / #CICD2023
udzura
5
2.3k
Ruby x BPF in Action / RubyKaigi 2022
udzura
0
200
Narrative of Ruby & Rust
udzura
0
180
開発者生産性指標の可視化 / pepabo-four-keys
udzura
3
1.6k
Talk of RBS
udzura
0
400
Re: みなさん最近どうですか? / FGN tech meetup in 2021
udzura
0
710
Dockerとやわらかい仮想化 - ProSec-IT/SECKUN 2021 edition -
udzura
2
680
Device access filtering in cgroup v2
udzura
1
780
"Story of Rucy" on RubyKaigi takeout 2021
udzura
0
730
Other Decks in Technology
See All in Technology
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
Wantedly での Datadog 活用事例
bgpat
1
430
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
AIのコンプラは何故しんどい?
shujisado
1
190
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
160
MLOps の現場から
asei
6
630
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
26
11k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Site-Speed That Sticks
csswizardry
2
190
BBQ
matthewcrist
85
9.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building Applications with DynamoDB
mza
91
6.1k
Thoughts on Productivity
jonyablonski
67
4.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Agile that works and the tools we love
rasmusluckow
328
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Speed Design
sergeychernyshev
25
670
Transcript
Haconiwa mrubyʹΑΔॊೈ͔ͭಈతͳɺOSSͷLinuxίϯςφϥϯλΠϜ Presentation by Uchio Kondo
ൃදऀʹ͍ͭͯ • ۙ౻͏͓ͪ / GMOϖύϘٕज़ج൫νʔϜ ϓϦϯγύϧ • ग़౦ࡾՏɺݱࡏԬࢢࡏॅ • ίϛϡχςΟ:
Fukuoka.rb ·ͨɺRailsGirls Fukuoka #1 ΦʔΨφΠβʔ • RubyKaigi 2016 Speaker
ΞδΣϯμ 1. ιϑτΣΞͷ֓ཁ 2. औΓΈͷಈػͳͲ 3. ιϑτΣΞͷಛɾ༏Ґੑ 4. ࣮ͱࠓޙʹ͍ͭͯ 5.
ࢀߟࢿྉ
ιϑτΣΞͷ֓ཁ
Haconiwaͱʁ • LinuxίϯςφͷϥϯλΠϜͰ͋Δ • Linuxίϯςφͱ...LinuxͷΧʔωϧͷ༷ʑͳػೳΛ༻͍ ͯಠཱͨ͠ҰछͷԾڥΛ࡞Δٕज़ • ϥϯλΠϜͱ...ͦͷԾڥΛ࡞͠ɺ্ཱͪ͛ɺϥΠ ϑαΠΫϧΛཧ͢ΔιϑτΣΞ
HaconiwaͲ͏͍͏ϥϯλΠϜ͔ • LinuxίϯςφϥϯλΠϜʹɺޙड़͢Δ௨Γઌߦ࣮͕ ͍͔ͭ͘ଘࡏ͢ΔʢLXC, Docker, rkt, ...ʣɻ • HaconiwaɺLinuxίϯςφϥϯλΠϜͷதͰɺ Ruby(mruby)ͷεΫϦϓτʹΑͬͯConfiguration
as Code Λ࣮ݱ͢Δ ʢॊೈͳઃఆͷهड़ɺϑοΫͷهड़ͳͲʣ
औΓΈͷಈػ
ݩʑͷಈػ • ͍ΘΏΔSaaSαʔϏε(*)ͷ։ൃɾӡ༻ͷܦݧ্ɺ෦Ͱ ར༻͍ͯ͠ΔίϯςφϥϯλΠϜ࣮ʹෆΛײ͡ɺࣗ ͷඞཁͱ͢ΔػೳΛ࣮ͨ͠ͷΛ࡞ͬͨɻ • ϗεςΟϯάܥαʔϏεͷதͰ͏ͷ͕ͦͦͷಈػ • RubyKaigi 2016ͷCFPʹԠื͠ɺ௨աͨ͜͠ͱ͖͔ͬ
͚ͷҰͭ (*) http://sqale.jp/
։ൃͷաఔͰͷؾ͖ͮ • Πϯλʔωοτ͕େ͍ʹීٴ͠ɺΣϒαΠτͷΞΫηεٸ ૿ͳͲʹର͢ΔॊೈͳαʔόϦιʔεͷίϯτϩʔϧ͕՝ͱ ͳ͍ͬͯΔɻ • KubernetesͳͲͷ͋Δ௨ΓɺίϯςφԾԽٕज़ʹ͓ ͚Δٕज़ֵ৽ʹظ͕͋Δ • ͦ͏͍ͬͨഎܠΛ౿·͑ɺΑΓ൚༻తͳίϯςφϥϯλΠϜʹ
͘͢։ൃΛଓ͚͍ͯΔ
Rubyͷ࠾༻ಈػ • ։ൃͷॳ͔ΒɺʮॊೈͰϓϩάϥϚϒϧʯͳ͜ͱΛఆ • PaaS෦ͰͷϦιʔεׂΓͯɺΞΫηεٸ૿࣌ͷϦιʔ εͷߜΓࠐΈɺFastContainer(*)ͳͲ৽ΞʔΩςΫνϟ ͷରԠ • ͦ͏͍ͬͨతʹRubyඇৗʹ͍͍ͯΔ (*)
http://hb.matsumoto-r.jp/entry/2016/11/11/234915
RubyͷϝϦοτ ͦͷ1 • ෦DSLͱͷ૬ੑͷྑ͞ ίϯςφهड़ݴޠɺઃఆͱϓϩάϥϜͷͪΐ͏Ͳதؒ • namespace/cgroup/capabilityͳͲͷࢦఆʹઃఆ • ίϯςφىಈ࣌ͷಉظ/ඇಈػͷϑοΫɺγάφϧϋϯυϥ ʹϓϩάϥϜ
• Rubyͷจ๏Ͱ͋Εɺ෦DSLͱͯ͠౷Ұతʹهड़Մೳ
RubyͷϝϦοτ ͦͷ2 • mrubyΈࠐΈʹ͍ͨɺચ࿅͞ΕͨCͷAPIΛ࣮͍ͯ͠ Δɻͦͷ෭࢈ͱͯ͠ɺCݴޠΛܦ༝ͨ͠γεςϜίʔϧͷόΠ ϯσΟϯά͕ඇৗʹॻ͖͘͢ͳ͍ͬͯΔ • ·ͨɺΞΫηε͢ΔͨΊͷίʔυྔCͱͯ͠খ͘͞ࡁΉ • ࣮ͱͯ͠ɺ༷ʑͳmruby
gemΛ࡞ࡁΈ: ɹcgroup, capability, linux namespace, seccomp...
ιϑτΣΞͷ ಛɾ༏Ґੑ
طଘ࣮ʹൺͨ༏Ґੑ - ॊೈੑ • ྫ͑Dockerͱൺͯ: • DockerԾڥͱͯ͠ͷಠཱੑΛॏࢹͨ݁͠Ռɺີ݁߹ͷ ίϯςφͰ͋Δ • ҰํͰHaconiwaɺඞཁͳίϯϙʔωϯτΛΈ߹Θͤɺঢ়
گʹԠͯ͡ແޮԽ͢Δ͜ͱ͑͞Ͱ͖·͢ɻྫ͑ىಈ࣌ͷΦʔ όϔουͷݮͳͲɺΑΓଟ͘ͷ༻్ʹίϯςφΛར༻Ͱ͖Δ
طଘ࣮ʹൺͨ༏Ґੑ - ಈతͳੑ࣭ • ྫ͑LXCͱൺͯ: • LXCAPIΛ࣋ͪɺόΠϯσΟϯάΛ࡞Ͱ͖Δɻ͔ͦ͠͠ͷAPI ىಈɺఀࢭͳͲɺݶఆతͳૢ࡞ͷΈ • ҰํͰHaconiwaɺίϯςφʹؔ͢ΔઃఆҰ௨Γͯ͢
DSLͰઃఆՄೳɻͳ͓͔ͭɺىಈͷ༷ʑͳλΠϛϯάͰ͋ͬͨ Γɺ͋Δ͍γάφϧϋϯυϥɺىಈޙͷඇಉظతϑοΫॲཧ αϙʔτ͢ΔͨΊɺΑΓϓϩάϥϜͳͲͰͷ੍ޚ͕༰қͰ͋Δ
طଘ࣮ʹൺͨ༏Ґੑ - อकੑ • ྫ͑rkt(CoreOS)/Kubernetesͱൺͯ: • rktଟ͘ͷઃఆΛαϙʔτ͢Δ͕ɺίϚϯυϥΠϯΦϓγϣ ϯͰͷड͚ೖΕͱͳΔ KubernetesΦʔέετϨʔγϣϯπʔϧ͕ͩɺHaconiwaͷ ࢦ͢ํੑʹ͍ۙͷ͕͋Δɻ
ҰํͰɺઃఆڊେͳyamlϑΝΠϧͷΈ
طଘ࣮ʹൺͨ༏Ґੑ - อकੑ • ʢঝલʣॊೈͰෳࡶͳίϯςφઃఆɺ͋Δ͍ΦʔέετϨʔ γϣϯͱͷ࿈ܞΛߟ͑ΔͱɺͦΕΒͷઃఆಈ࡞ΛRuby ͷΑ͏ͳݴޠͰهड़ͨ͘͠ͳΔ͜ͱ͕ߟ͑ΒΕΔɻ • HaconiwaͷΑ͏ʹઃܭࢥͷஈ֊ͰDSLʹΑΔ੍ޚΛα ϙʔτͨ͠ίϯςφɺͦ͏͍ͬͨཁΛड͚ࢭΊΒΕΔɻ
RubyΛ࠾༻͍ͯ͠ΔͷͰֶश͢͠͞/Մಡੑߴ͍
ֵ৽ੑʹ͍ͭͯ • ઌड़ͨ͠Α͏ʹɺHaconiwaDSLΛࠜຊͱͨ͠ॊೈੑɺ ಈతੑΛ࣮ݱ͍ͯ͠Δ • ͦͷ݁ՌɺʮίϯςφʯΛݻఆతͳԾڥͰͳ͘ɺ ϓϩάϥϜͰ੍ޚ͕ՄೳͳεϨουతͳͷͱൃలͤ͞ ͏Δɺͱߟ͑Δ
HaconiwaͷγεςϜίʔϧతଆ໘ • ίϯςφ࣮ߦج൫ͱͯ͠ɺOSͷू߹ମΛҰͭͷʮOSʯɺ ͋Δ͍ϦιʔεͷϓʔϧͱΈͳ͢ͱɺίϯςφͷάϧʔ ϓ͕ϓϩηεతɺίϯςφҰͭҰͭεϨουతͳɺ͋Δ छ͍ࣺͯͷαϒϧʔνϯͱ၏ͤΔ • ͦ͏ߟ͑ΔͱɺͦͷίϯςφΛࣗ༝ࣗࡏʹ࡞ɺΞΫηε Ͱ͖ΔHaconiwaͷ෦APIɺγεςϜίʔϧతͰ͋Δ
• චऀൃදʮHaconiwaͷதͱઃܭࢥʯp. 36
“Haconiwa API”ͷҰ࣮͕Haconiwa • c.f. specinfra/Serverspec • ʮHaconiwaͷ෦APIʯΛΑΓ൚༻తʹൈ͖ग़͢ͱɺ HaconiwaࣗͷଞʹɺίϯςφΛར༻༷ͨ͠ʑͳϛυϧ ΣΞΛ࡞Δ͜ͱ͕Ͱ͖ΔͷͰͳ͍͔
࣮ͱࠓޙͷల
ٕज़ൃදଞɺ࣮ʹ͍ͭͯ • RubyKaigi 2016ɺ໊ݹRubyձٞ03Λ࢝ΊɺRubyίϛϡ χςΟத৺ʹHaconiwaʹؔ͢ΔτʔΫΛॏͶ͍ͯΔஈ֊ • ଞɺͱͯ͠ɺGitHubͷϓϩδΣΫτͷ ελʔ͕97 (20172݄22ݱࡏ)
ࠓޙʹ͍ͭͯ 1 • ઌड़ͨ͠ίϯςφ࣮ߦج൫ͱͯ͠ͷOSΫϥελͷൃΛ͞Βʹਐ Ίͨɺদຊ྄հࢯͷFastContainerߏ(*)Λ౿·͑ɺॴଐձࣾͰ ϗεςΟϯάܥWebαʔϏεͷ։ൃΛਐΊ͍ͯΔஈ֊Ͱ͋Δ • FastContainerͷΑ͏ͳੜଘظؒͷίϯτϩʔϧ͞Εͨίϯςφ Haconiwaͱ૬ੑ͕͍͍ •
ྫ͑ɺʮαʔόϨεΞʔΩςΫνϟʯͷ࣮ݱʹ͍͍ͯΔ
• ʮFactContainerΞʔΩςΫνϟ֓ʯΑΓ
ࠓޙʹ͍ͭͯ 2 • ίϯςφϥϯλΠϜͱͯ͠ͷͷ্Λࢦ͢ • ۩ମతʹɺseccomp/apparmorͱ͍ͬͨηΩϡϦςΟؔ ͷAPIͷαϙʔτɺCRIUͱ͍ͬͨίϯςφىಈͷߴ Խʹཱٕͭज़ͱͷ࿈ܞΛߟ͍͑ͯΔ • ಉ࣌ʹυΩϡϝϯτͷॆ࣮......͍ͨ͠
૯ׅ
Haconiwaͷ·ͱΊ • Haconiwaɺྨࣅͷ࣮ͱൺͯඇৗʹಈతͰॊೈͳίϯςφΛ࡞ Ͱ͖ΔϥϯλΠϜͰ͋Γɺͦͷ࣮ݱͷͨΊʹRuby/mrubyͷੑ࣭Λ׆༻ ͍ͯ͠Δɻ • Haconiwaɺίϯςφ࣮ج൫ͷOSͷΫϥελΛͻͱ·ͱ·ΓͷOS ͱΈͳ͢ͱɺҰछͷγεςϜίʔϧͱߟ͑Δ͜ͱͰ͖Δ • ্ड़ͨ͠Α͏ͳHaconiwaͷಛΛ׆༻͠ɺ࣍ੈతͳϗεςΟϯάܥ
ͷαʔϏεΛߟҊɾ։ൃ͍ͯ͠Δ
ࢀߟࢿྉ
ࢿྉҰཡ 1. Haconiwaʹؔ͢Δࢿྉ The introduction of mRuby on Container https://speakerdeck.com/udzura/mruby-on-container
Haconiwaͷ͜Ε·Ͱͱ͜Ε͔Β https://speakerdeck.com/udzura/haconiwa-on-the-pavement Haconiwa ͷதͱઃܭࢥ https://speakerdeck.com/udzura/the-haconiwa-internals 2. FastContainer/DAOSߏʹ͍ͭͯ FastContainerΞʔΩςΫνϟ֓ https://speakerdeck.com/matsumoto_r/reactive-stateless-and-mortal- architecture-for-web-applications ະདྷͷαʔόج൫ͷHaconiwa/mrubyͷؔΘΓ https://speakerdeck.com/udzura/haconiwa-and-future-os 3. Serverspecͱspecinfraʹ͍ͭͯ ࠷ॳͷݴٴ https://github.com/mizzy/serverspec-thesis/pull/13#issuecomment-32700180 4. αʔόϨεΞʔΩςΫνϟʹ͍ͭͯ http://www.publickey1.jp/blog/16/qcon_tokyo_2016.html