Difference between revisions of "Demo scripts Virtuozzo"
m (Update demo "Full container lifecycle") |
(add criu demoes) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 27: | Line 27: | ||
# prlctl destroy $NAME | # prlctl destroy $NAME | ||
− | == | + | == Multiple containers creation == |
− | Create/start | + | Create/start 10 containers in a shell loop. |
− | |||
Here are the example commands needed: | Here are the example commands needed: | ||
<pre> | <pre> | ||
− | # time for ((CT= | + | # time for ((CT=100; CT<110; CT++)); do \ |
− | + | time prlctl create $CT --ostemplate centos-6-x86_64 --vmtype=ct; \ | |
− | + | prlctl start $CT; \ | |
− | + | done | |
</pre> | </pre> | ||
Line 49: | Line 48: | ||
<pre> | <pre> | ||
# for ((CT=200; CT<250; CT++)); do \ | # for ((CT=200; CT<250; CT++)); do \ | ||
− | + | prlctl set $CT --ipadd 10.1.1.$CT/24; \ | |
− | + | done | |
</pre> | </pre> | ||
Line 62: | Line 61: | ||
== Live migration == | == Live migration == | ||
+ | |||
+ | === xscreensaver inside container === | ||
If you have two boxes, do <code>vzmigrate --online</code> from one box | If you have two boxes, do <code>vzmigrate --online</code> from one box | ||
Line 74: | Line 75: | ||
FIXME: commands, setup, VNC template. | FIXME: commands, setup, VNC template. | ||
− | === CRIU (Checkpoint and Restore In Userspace === | + | === CRIU (Checkpoint and Restore In Userspace) === |
+ | * [http://criu.org/Simple_loop Simple loop] | ||
* [https://github.com/tych0/presentations/blob/master/ods2014.md Migration of Doom inside container inside LXC container] | * [https://github.com/tych0/presentations/blob/master/ods2014.md Migration of Doom inside container inside LXC container] | ||
* [http://criu.org/Docker Checkpoint and Restore of Docker container] | * [http://criu.org/Docker Checkpoint and Restore of Docker container] | ||
* [https://github.com/jpetazzo/critmux CRIU + tmux] | * [https://github.com/jpetazzo/critmux CRIU + tmux] | ||
− | + | ||
+ | This is a tech demo of [http://criu.org/ CRIU] and Docker integration, featuring [https://tmux.github.io/ tmux]. | ||
+ | |||
+ | <pre> | ||
+ | docker run -t -i --privileged --name critmux jpetazzo/critmux | ||
+ | Do stuff in tmux. Don't know what to do? Just type a few characters. | ||
+ | From another terminal, docker stop critmux. Container stops. | ||
+ | docker start critmux ; docker attach critmux. MIND. BLOWN. | ||
+ | Note: docker start -a doesn't quite work. | ||
+ | </pre> | ||
+ | |||
+ | See [https://asciinema.org/a/9889 screencast] recorded with Asciinema. | ||
+ | |||
* [http://criu.org/Asciinema CRIU screencasts] | * [http://criu.org/Asciinema CRIU screencasts] | ||
+ | * [http://blog.kubernetes.io/2015/07/how-did-quake-demo-from-dockercon-work.html How did the Quake demo from DockerCon Work?] | ||
+ | * [https://github.com/ianmiell/shutit-criu Live migration of Docker container inside Vagrant box] | ||
+ | |||
+ | === P.Haul === | ||
+ | |||
* [https://github.com/xemul/p.haul/blob/master/test/mtouch/HOWTO P.Haul HOWTO] | * [https://github.com/xemul/p.haul/blob/master/test/mtouch/HOWTO P.Haul HOWTO] | ||
* [https://github.com/xemul/p.haul/wiki/Live-migrating-OVZ-mainstream-container Live migrating OVZ mainstream container] | * [https://github.com/xemul/p.haul/wiki/Live-migrating-OVZ-mainstream-container Live migrating OVZ mainstream container] | ||
+ | == Docker inside CT == | ||
− | + | [[Docker_inside_CT]] | |
== Resource management == | == Resource management == | ||
Line 95: | Line 115: | ||
<pre> | <pre> | ||
# while [ true ]; do \ | # while [ true ]; do \ | ||
− | + | while [ true ]; do \ | |
− | + | echo " " > /dev/null; | |
− | + | done & | |
− | + | done | |
</pre> | </pre> | ||
Line 109: | Line 129: | ||
=== CPU scheduler === | === CPU scheduler === | ||
− | |||
− | |||
Create 3 containers: | Create 3 containers: | ||
<pre> | <pre> | ||
− | # | + | # prlctl create 101 |
− | # | + | # prlctl create 102 |
− | # | + | # prlctl create 103 |
</pre> | </pre> | ||
Set container weights: | Set container weights: | ||
<pre> | <pre> | ||
− | # | + | # prlctl set 101 --cpuunits 1000 |
− | # | + | # prlctl set 102 --cpuunits 2000 |
− | # | + | # prlctl set 103 --cpuunits 3000 |
</pre> | </pre> | ||
Line 130: | Line 148: | ||
Start containers: | Start containers: | ||
<pre> | <pre> | ||
− | # | + | # prlctl start 101 |
− | # | + | # prlctl start 102 |
− | # | + | # prlctl start 103 |
</pre> | </pre> | ||
Run busy loops in all containers: | Run busy loops in all containers: | ||
<pre> | <pre> | ||
− | # | + | # prlctl enter 101 |
[ve101]# while [ true ]; do true; done | [ve101]# while [ true ]; do true; done | ||
− | # | + | # prlctl enter 102 |
[ve102]# while [ true ]; do true; done | [ve102]# while [ true ]; do true; done | ||
− | # | + | # prlctl enter 103 |
[ve103]# while [ true ]; do true; done | [ve103]# while [ true ]; do true; done | ||
</pre> | </pre> | ||
Line 160: | Line 178: | ||
=== Disk quota === | === Disk quota === | ||
<pre> | <pre> | ||
− | # | + | # prlctl set CTID --diskspace 1048576:1153434 --save |
− | # | + | # prlctl start CTID |
− | # | + | # prlctl enter CTID |
[ve]# dd if=/dev/zero of=/tmp/tmp.file bs=1048576 count=1000 | [ve]# dd if=/dev/zero of=/tmp/tmp.file bs=1048576 count=1000 | ||
dd: writing `/tmp/tmp.file': Disk quota exceeded | dd: writing `/tmp/tmp.file': Disk quota exceeded | ||
</pre> | </pre> | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [http://criu.org/Asciinema CRIU screencasts] | ||
+ | * [https://www.youtube.com/c/OpenVZorg OpenVZ demo on Youtube] | ||
+ | * [[Screencasts|Virtuozzo screencasts]] | ||
+ | * [https://github.com/ligurio/jslinux-criu CRIU inside jslinux] | ||
[[Category:Events]] | [[Category:Events]] |
Latest revision as of 08:28, 13 October 2015
The following demo scripts (scenarios) can be used to show advantages of Virtuozzo.
Contents
Full container lifecycle[edit]
Create a container, set an IP, start, add a user, enter, exec, show
ps -axf
output inside the container, stop, and destroy.
It should take about two minutes ("compare that to a time you need
to deploy a new (non-virtual) server!"). During the demonstration,
describe what's happening and why.
Here are the example commands needed:
# NAME=vz # IP=10.1.1.123/24 # sed -i "/$IP /d" ~/.ssh/ # time prlctl create $NAME --ostemplate centos-6-x86_64 --vmtype=ct # prlctl set $NAME --ipadd $IP --hostname $NAME # prlctl start $NAME # prlctl exec $NAME ps axf # prlctl set $NAME --userpasswd guest:secret # ssh guest@$IP [vz]# ps axf [vz]# logout # prlctl stop $NAME # prlctl destroy $NAME
Multiple containers creation[edit]
Create/start 10 containers in a shell loop.
Here are the example commands needed:
# time for ((CT=100; CT<110; CT++)); do \ time prlctl create $CT --ostemplate centos-6-x86_64 --vmtype=ct; \ prlctl start $CT; \ done
Massive container load[edit]
Use containers from the previous item — load those by ab
or
http_load
. This demo shows that multiple containers are working
just fine, with low response time etc.
# for ((CT=200; CT<250; CT++)); do \ prlctl set $CT --ipadd 10.1.1.$CT/24; \ done
On another machine:
# rpm -ihv http_load #
FIXME: http_load commands
Live migration[edit]
xscreensaver inside container[edit]
If you have two boxes, do vzmigrate --online
from one box
to another. You can use, say, xvnc
in a container and
vncclient
to connect to it, then run
xscreensaver-demo
, choose a suitable screensaver (eye-candy but
not too CPU aggressive) and while the picture is moving start a live
migration. You'll see that xscreensaver
stalls for a few
seconds but then continues to run — on another machine! That looks amazing,
to say at least.
FIXME: commands, setup, VNC template.
CRIU (Checkpoint and Restore In Userspace)[edit]
- Simple loop
- Migration of Doom inside container inside LXC container
- Checkpoint and Restore of Docker container
- CRIU + tmux
This is a tech demo of CRIU and Docker integration, featuring tmux.
docker run -t -i --privileged --name critmux jpetazzo/critmux Do stuff in tmux. Don't know what to do? Just type a few characters. From another terminal, docker stop critmux. Container stops. docker start critmux ; docker attach critmux. MIND. BLOWN. Note: docker start -a doesn't quite work.
See screencast recorded with Asciinema.
- CRIU screencasts
- How did the Quake demo from DockerCon Work?
- Live migration of Docker container inside Vagrant box
P.Haul[edit]
Docker inside CT[edit]
Resource management[edit]
Below scenarios aims to show how OpenVZ resource management works.
UBC protection[edit]
fork() bomb[edit]
# while [ true ]; do \ while [ true ]; do \ echo " " > /dev/null; done & done
We can see that the number of processes inside container will not be growing.
We will see only the increase of numproc
and/or
kmemsize
fail counters in /proc/user_beancounters
.
dentry cache eat up[edit]
FIXME
CPU scheduler[edit]
Create 3 containers:
# prlctl create 101 # prlctl create 102 # prlctl create 103
Set container weights:
# prlctl set 101 --cpuunits 1000 # prlctl set 102 --cpuunits 2000 # prlctl set 103 --cpuunits 3000
We set next CPU sharing CT101 : CT102 : CT103 = 1 : 2 : 3
Start containers:
# prlctl start 101 # prlctl start 102 # prlctl start 103
Run busy loops in all containers:
# prlctl enter 101 [ve101]# while [ true ]; do true; done # prlctl enter 102 [ve102]# while [ true ]; do true; done # prlctl enter 103 [ve103]# while [ true ]; do true; done
Check in top that sharing works:
# top COMMAND %CPU bash 48.0 bash 34.0 bash 17.5
So, we see that CPU time is given to container in proportion ~ 1 : 2 : 3.
Now start some more busy loops. CPU distribution should remain the same.
Disk quota[edit]
# prlctl set CTID --diskspace 1048576:1153434 --save # prlctl start CTID # prlctl enter CTID [ve]# dd if=/dev/zero of=/tmp/tmp.file bs=1048576 count=1000 dd: writing `/tmp/tmp.file': Disk quota exceeded