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
CRIUをホスティングで試していく #hostingcasual / My CRIU Life...
Search
KONDO Uchio
March 22, 2019
Technology
0
390
CRIUをホスティングで試していく #hostingcasual / My CRIU Life in Progress
@ホスティングカジュアル #5
直近のイベント宣伝等を抜いています。
KONDO Uchio
March 22, 2019
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
190
Narrative of Ruby & Rust
udzura
0
170
開発者生産性指標の可視化 / pepabo-four-keys
udzura
3
1.6k
Talk of RBS
udzura
0
390
Re: みなさん最近どうですか? / FGN tech meetup in 2021
udzura
0
710
Dockerとやわらかい仮想化 - ProSec-IT/SECKUN 2021 edition -
udzura
2
670
Device access filtering in cgroup v2
udzura
1
770
"Story of Rucy" on RubyKaigi takeout 2021
udzura
0
720
Other Decks in Technology
See All in Technology
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
220
あなたの知らない Function.prototype.toString() の世界
mizdra
PRO
2
460
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
180
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
130
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
200
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
160
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
110
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
2
230
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
540
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
240
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
Featured
See All Featured
Writing Fast Ruby
sferik
627
61k
Automating Front-end Workflow
addyosmani
1366
200k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Scaling GitHub
holman
458
140k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Docker and Python
trallard
40
3.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Making Projects Easy
brettharned
115
5.9k
Done Done
chrislema
181
16k
Code Review Best Practice
trishagee
64
17k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Transcript
ϗεςΟϯάͰ$3*6Λ͓͏ ۙ౻Ӊஐ࿕(.01FQBCP *OD ϗεςΟϯάΧδϡΞϧ <)BDPOJXB$3*6ਐḿ><ݕࡧ>
γχΞɾϓϦϯγύϧΤϯδχΞ ۙ౻ Ӊஐ࿕ / @udzura https://blog.udzura.jp/ Uchio Kondo ٕज़෦ ٕज़ج൫νʔϜ
ίϯςφ
None
ϗεςΟϯάʹಋೖ
Web Proxy Web Request Dispatcher FastContainer Runtime CMDB ❌ FastContainer
Killed 1. Check 2. Boot 3. Forward 4. Terminate
ϦΫΤετ Ұఆ࣌ؒͷఀࢭ ఀࢭޙͷ࣍ͷϦΫΤετͰ Ұ͔Βىಈ OHY@NSVCZ $POUBJOFST ݱࡏͷڍಈ
࠶ىಈͷίετ
None
Memory dump Network conf File descriptors cgroup params ...... CRIU
Target process Syscalls, /proc files ... Kernel $3*6ͰΠϝʔδΛ࡞ɺ͔ͦ͜Βىಈ ˞ࢀߟ
ϦΫΤετ ఀࢭޙͷ࣍ͷϦΫΤετͰ $3*6Πϝʔδ͔Βىಈ OHY@NSVCZ $3*6ಋೖ ඇಉظͰ Πϝʔδͷ࠶࡞ $POUBJOFST $3*6JNBHF
ޮՌଌఆ
ڥ Ұ෦ Bench(Bastion) Compute(Users) Web Proxy Core API CMDB 8
Core 51GB Mem 1 Core 2GB Mem
ܭଌ݁Ռ
ܭଌ݁Ռ DPOUFOUSPPUFYU
ܭଌ݁Ռ
ܭଌ݁Ռ 3FTQPOTF5JNF NT ✴"QBDIF͕Ϩεϙϯε Λฦͨ࣌ؒ͠Λൺֱɻ ✴"QBDIFͯ͢ͷϫʔ Χʔ্ཱ͕͕ͪΔલʹ ϨεϙϯεΛฦͤΔ͜ ͱ͕ޙʹΘ͔ͬͨ
࣮
ϦετΞ͞ΕͨϓϩηεΛɺ )BDPOJXBͷԼʹ͍ͨ͠ɻ Haconiwa sv-sv \- criu restore \- Container Haconiwa
sv-sv \- Haconiwa sv \- Container ௨ৗىಈ CRIUܦ༝ͷىಈ ϑοΫॲཧ ओʹ͜͜Ͱߦ͏ ʁʁʁ
ํ๏ TXSLNPEF SFTUPSFTJCMJOH shd: vagrant@pts/0 \_ -bash \_ sudo
../mruby/bin/mruby example/restore_child.rb \_ ../mruby/bin/mruby example/restore_child.rb <- libcriuΛݺͼग़ͨ͠mruby script \_ /usr/local/apache2/bin/httpd -DFOREGROUND -X <- ͜Ε͕ίϯςφϓϩηε \_ /usr/local/sbin/criu swrk 6 <- ͜Ε͕swrkϞʔυͰ্ཱ͕ͪͬͨαʔϏεͰɺ cr_restore_tasks() ͜͜ͰಡΜͰ͍Δ \_ sh -c ps auxf <- ֬ೝͷͨΊʹ system() ͨ͠ͷ \_ ps auxf
$3*6ͷTXSLNPEF w·ͣTXSLϞʔυͷઆ໌Ͱ͕͢ɺ͜ΕMJCDSJVͰؔΛݺͼग़ͨ͠ࡍʹɺ ΞυϗοΫʹDSJVόΠφϦͦͷͷΛݺͼग़ͯ͠αʔϏεΛ࡞͠ɺݟ͔͚ ্αʔϏεͳ͠ͰDSJVͷػೳΛ͏ϞʔυͰ͢ʢਤ̎ࠨʣɻ
DMPOF $-0/&@1"3&/5 $ ./clone-tarou parent --use-clone-parent [!] Hey, maybe a
new sibling is added 26627 pts/1 S+ 0:00 \_ ./clone-tarou parent --use-clone-parent 26628 pts/1 S+ 0:00 \_ clone-tarou tarou --use-clone-parent 26629 pts/1 S+ 0:00 \_ clone-tarou jirou [!] exit: PID=26628 [!] exit: PID=26629 <DMPOFͷ$-0/&@1"3&/5ϑϥάͷڍಈΛ؍͢Δ><ݕࡧ>
clone(fun, ..., CLONE_PARENT|CLONE_NEWPID) ɺΧʔωϧͷόʔδϣϯʹΑͬͯ ಈ͔ͳ͍Β͍͠ $3*6ͷίϝϯτΑΓ
ํ๏ FYFDDNEͬͪ͜Λ࠾༻ Haconiwa sv \- criu restore \- Container
Haconiwa sv \- haconiwa _restored \- Container FYFD XBJU wDSJVίϚϯυͰϦετΞ͔ͯ͠ΒɺҙͷϓϩάϥϜʹFYFDWF Ͱ͖Δ wFYFDલʹGPSLͨ͠ϓϩηεΛɺ৽͍͠ϓϩάϥϜଆͰXBJU Ͱ͖Δ
&YUFSOBMCJOENPVOUରԠ /path/to/pivot_root `- / (bind-mount self) `- /etc -> /other/etc
`- /home/foo -> /other2/home `- /var/log -> /other3/log wSPPUGTͷ֎ଆʹ͋ΔϑΝΠϧγεςϜSPPUΛCJOENPVOUͯ͠ɺ DISPPUQJWPU@SPPU ͔ͯ͠Β͑ΔΑ͏ʹ͢Δ͜ͱ͕Α͋͘Δ™ wͦ͏͍͏֎ଆͷϑΝΠϧγεςϜΛ$3*6͕ཧղͰ͖ΔΑ͏ʹ͢Δ ͜͜ʹpivot_root
&YUFSOBMCJOENPVOU͕͏·͍͔͘Μ
Φϓγϣϯ͗͢ΜͶΜ
Ṗʹͭͳ͕Βͳ͍ωοτϫʔΫ
ωοτϫʔΫϩοΫ͕1"5)͕ͳ͍ͷͰ ղআ͞Εͳ͍ɻ
ͯ͠Δʁ Hotstart Start from CRIU
Web Proxy Web Request Dispatcher FastContainer Runtime CMDB ❌ FastContainer
Killed 1. Check 2. Boot 3. Forward 4. Terminate 'BTU3FNPUF$IFDLͱ͍͏ NHFNΛར༻͍ͯͬͯ͠Δ͕ɺ ઃఆ͕มʁ
'BTU3FNPUF$IFDLͷύϥϝʔλௐ
None
IUUQTHJUIVCDPNIBDPOJXBIBDPOJXBQVMMT RJT"QS JT"DMPTFE ͦͷ΄͔ wࡉʑͱࠔͬͨ͜ͱ͕͕͋ͬͨɺׂͱҰ௨ΓରԠͰ͖ͨؾ͕͢Δɻ wԼهࢀߟΣοϒϖʔδͰ͢
ࠓޙ
ϦϦʔεͰ͖ΔΑ͏ؤுΔͧʙ OPEB͞Μ͕
(SFOBEJOFͱ͍͏ͷΛ࡞ͬͨ
None