Your SlideShare is downloading. ×
Docker + Checkpoint/Restore
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Docker + Checkpoint/Restore

457
views

Published on

CoreOS meetup http://coreos-meetup-tokyo.connpass.com/event/12596/

CoreOS meetup http://coreos-meetup-tokyo.connpass.com/event/12596/

Published in: Engineering

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
457
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Docker + Checkpoint/Restore Yuto Kawamura(kawamuray)
  • 2. ● Yuto Kawamura(kawamuray) ● 東京工科大学修士過程2年でした ● Docker(Container)を用いた効率的なリソーススケジューリングについて研 究していました ● http://cloud.watch.impress.co.jp/docs/case/20150224_689058.html About me
  • 3. ● 修士でやっていた研究の一部を紹介します. ● 一言で言うと,Checkpoint/Restore(CRIU)を用いてコンテナの起動を高 速化するという話です. Today’s topic
  • 4. ● Using this tool, you can freeze a running application (or part of it) and checkpoint it to a hard drive as a collection of files. You can then use the files to restore and run the application from the point it was frozen at. ● http://criu.org/ ● (ほんとは全然違うけど)VMのスナップショットみたい な動作イメージ Checkpoint/Restore
  • 5. Checkpoint/Restore fdinfo-2.img fifo.img filelocks.img ifaddr-8.img inetsk.img inotify.img mm-1.img mountpoints-11.img netdev-8.img cgroup.img Running environment Checkpoint Image Proc1 Proc2 Proc3 criu dump criu restore
  • 6. ● Startup acceleration ● Live migration ○ LXCでは複数の実装例http://www. slideshare.net/kawamuray/lxc-onganeti ○ 完全なLive migrationではない ■ わずかなダウンタイム ● http://criu.org/Usage_scenarios Checkpoint/Restoreの使い道
  • 7. CRIUを使う目的
  • 8. これ
  • 9. ● n台のサーバで構成されるPaaSクラスタのサービスキャパシティを最大化 したい ● キャパシティを増やしたいならサーバ増やせば良いのでは? ○ 金がない ● 稼働率の低いインスタンスはすぐ殺す ● サービスの負荷が上がったときはものすごくオンデマンドにリソースを増 やす ● inetd リソース効率の最大化
  • 10. ● アプリケーションによっては起動がとても遅い ○ Java(JVM)アプリは顕著(そして多い) ○ アプリケーション(コンテナ)の中身に関わらず(外部から)起動を高速 化したい (色々ある)問題点(の一つ)
  • 11. Application startup time problem Initialization Serving Initialization Serving Initialization Serving Instance1 Instance2 Instance3 Overhead x Number of created instances e.g, Tomcat8 Real time 3.715386 s CPU time(according to cgroups) 17.13 ms
  • 12. Solution Initialization Serving Serving Serving Instance1 Instance2 Instance3 Checkpoint image
  • 13. ● アプリケーションの起動が完了したタイミングで作成する必要がある ● どうやって判定する? ○ TCPソケットを経由してサービス提供するアプリを想定 ○ 指定portにlistenを始めた時点で起動+初期化が終わったということ にしよう ● 他の方法 ○ アプリケーション側から通知してもらうなど ○ 計測対象にしたいくつかのサーブレットアプリ(tomcat)は↑の方法で 十分だった Create Checkpoint Image
  • 14. ● Checkpoint/Restore機能をDocker daemonに実装した ○ docker checkpoint CONTAINER_ID ○ docker restore CONTAINER_ID CHECKPOINT_ID ● 外部からcriuコマンドを実行するのはだめ? ○ CRIU_REPOS/contrib/docker_cr.sh ■ docker daemonのchild processとしてリストアできない ■ docker daemonが復元したコンテナを認識できない ■ restoreしたcontainerが迷子になります ● Patches are available at https://github. com/kawamuray/docker/commits/master Native support of CR on Docker
  • 15. Docker run process
  • 16. Docker restore process
  • 17. Implementation Docker daemon Checkpoint Image Container type ContainerCheckpoint struct { ID string ImageID string NetworkSettings *NetworkSettings CreatedAt time.Time } Checkpoint Image /var/lib/docker/containers/{ID} /checkpoints/{CHECKPOINT_ID} Image(AUFS layer) Checkpoint criu dump Container criu restore Restore
  • 18. DEMO
  • 19. ● 一つのチェックポイントから複数のコンテナをリストアするた めに,Checkpoint imageを書き換える Patched checkpoint image Patch eth0 IP address 192.168.123.111 eth0 MAC address 52:54:00:4a:0b:6e Cgroups hierarchy /system.slice/fuga eth0 IP address 192.168.123.110 eth0 MAC address 52:54:00:4a:0b:6d Cgroups hierarchy /system.slice/hoge ContainerA Restore ContainerB Restore No conflicts
  • 20. Startup time benchmark HDD SSD Tomcat8
  • 21. ● Patches from Saied Kazemi ○ Googler ○ CRIU contributor ○ https://speakerdeck.com/saied/experimental-docker-checkpoint-and- restore-with-criu ○ https://github.com/filbranden/docker/pull/1 ○ https://github.com/SaiedKazemi/libcontainer-criu/pull/1 Similar works
  • 22. ● Checkpoint/Restoreは,アプリケーションコンテナの起動高速化に使えま す. ● Checkpoint/Restoreの注目度と可能性は無限大です. ● CoreOS最高! まとめ