容器热迁移技术(CRIU)的应用分析(2016.06.12)
1.热迁移技术:
真的是热迁移么?no.
kernel based vs userspace c/r
2.两个性能指标:downtime/total time:
3.CRIU安装:
$ git clone –b v2.2 https://github.com/xemul/criu.git $ cd criu/
安装依赖包:
apt-get install -y libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler
protobuf-compiler python-protobuf libnl-3-dev pkg-config libcap-dev asciidoc
change the version ,mark as hijacked,修改下版本
$ vim Makefile.versions
$ make && make install
[kernel]: $ uname -a Linux vm1 3.13.11-ckt22 #1 SMP Sat Jul 25 16:04:44 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
#3.13 must be patched, you ‘d better try to use 3.19. 实际上CRIU的内核维护都不在提供ubuntu14.04的相关安装包了,强烈建议使用ubuntu15.04(3.19)或者更高的版本。
docker native vs external :
/home/vagrant/criu# criu -V
Version: 2.2.99 //99 is my personal version
GitID: v2.2
docker version:
As we try to use native docker checkpoint, you may need to use this specification version of Docker. thanks to Ross Boucher. https://github.com/boucher/docker/releases https://github.com/boucher/docker/releases/tag/v1.9.0-experimental-cr.1 download: docker-1.9.0-dev $mv docker-1.9.0-dev /usr/bin/docker
$ ls docker docker
$ docker -v Docker version 1.9.0-dev, build 59c375a, experimental
4.简单案例(待补充)
5.RUNC与CRIU的关系(待补充)
6.CRIU当前的问题(待补充):
Closed TCP socket with peer-name blocks dump #62 https://github.com/xemul/criu/issues/62
tcp: allow to enable repair mode for sockets in closing states https://lists.openvz.org/pipermail/criu/2014-April/013653.html
[CRIU] unexpected socket state dump failure https://lists.openvz.org/pipermail/criu/2015-October/022675.html
http://benohead.com/tcp-about-fin_wait_2-time_wait-and-close_wait/
https://lwn.net/Articles/525675/ LCE: Checkpoint/restore in user space: are we there yet?
7.内核补丁的介绍(待补充):
8.热迁移与不可变基础设施(Immutable Infrastructure):
New pattern for deploying Docker containers: immutable infrastructure As we discussed above, we use Docker as a “lightweight VM”. However, there is a voice in Docker community that “rather than being a lightweight VM”. Another main difference from VMs is that the containers are designed to be stateless and replaceable [17]. In the VM-centered world, VM contains all the working information like codes, disk data and state data. We say the VM infrastructure is mutable. But Docker container can be deployed in stateless pattern which is defined as immutable infrastructure that use replace rather maintain the state. According to immutable infrastructure, if we could separate the task into small tasks and separate the data and state, we may just need to kill the old container and immediately link to the new container. Handoff will be significantly simplified.<个人的summer project>
9.总结
10.My demo https://www.youtube.com/watch?v=S1J0HzCLSoM
References:
[15] CRIU. Checkpoint/Restore In Userspace, https://criu.org/Docker. [16] http://www.slideshare.net/Docker/live-migrating-a-container-pros-cons-and-gotchas. [17] https://blog.docker.com/2016/03/containers-are-not-vms/ posted By Mike Coleman March 24, 2016. [18] https://www.chef.io/blog/2014/06/23/immutable-infrastructure-practical-or-not/ Posted on June 23, 2014 by Julian Dunn. [19] http://developers.redhat.com/blog/2015/01/20/microservice-principles-and- immutability-demonstrated-with-apache-spark-and-cassandra/ Posted on: January 20, 2015 by jayunit100.
本人原创, 发布于个人博客:xichenpro.com @2016-06-13 chen xi @CMU