Editing Demo scripts

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
The following demo scripts (scenarios) can be used to show advantages of OpenVZ.
 
The following demo scripts (scenarios) can be used to show advantages of OpenVZ.
  
== Full container lifecycle ==
+
== Full VE lifecycle ==
  
Create a container, set an IP, start, add a user, enter, exec, show
+
Create VE, set IP, start, add user, enter, exec, show ps -axf output inside VE, stop, and destroy. It should take 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.
<code>ps -axf</code> 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:
 
Here are the example commands needed:
  
  # CT=123
+
  # VE=123
 
  # IP=10.1.1.123
 
  # IP=10.1.1.123
 
  # sed -i "/$IP /d" ~/.ssh/
 
  # sed -i "/$IP /d" ~/.ssh/
  # time vzctl create $CT --ostemplate fedora-core-5-i386-default
+
  # time vzctl create $VE --ostemplate fedora-core-5-i386-default
  # vzctl set $CT --ipadd $IP --hostname newCT --save
+
  # vzctl set $VE --ipadd $IP --hostname newVE --save
  # vzctl start $CT
+
  # vzctl start $VE
  # vzctl exec $CT ps axf
+
  # vzctl exec $VE ps axf
  # vzctl set $CT --userpasswd guest:secret --save
+
  # vzctl set $VE --userpasswd guest:secret --save
 
  # ssh guest@$IP
 
  # ssh guest@$IP
  [newCT]# ps axf
+
  [newVE]# ps axf
  [newCT]# logout
+
  [newVE]# logout
  # vzctl stop $CT
+
  # vzctl stop $VE
  # vzctl destroy $CT
+
  # vzctl destroy $VE
  
== Massive container creation ==
+
== Massive VE creation ==
  
Create/start 50 or 100 containers in a shell loop. Shows fast deployment
+
Create/start 50 or 100 VEs in a shell loop. Shows fast deployment and high density.
and high density.
 
  
 
Here are the example commands needed:
 
Here are the example commands needed:
  
<pre>
+
# VE=200
# time for ((CT=200; CT<250; CT++)); do \
+
# time while [ $VE -lt 250 ]; do \
>  time vzctl create $CT --ostemplate fedora-core-9-i386; \
+
>  time vzctl create $VE --ostemplate fedora-core-5-i386-default; \
>  vzctl start $CT; \
+
>  vzctl start $VE; \
> done
+
> let VE++; \
</pre>
+
> done
 
 
== Massive container load ==
 
 
 
Use containers from the previous item — load those by <code>ab</code> or
 
<code>http_load</code>. This demo shows that multiple containers are working
 
just fine, with low response time etc.
 
  
<pre>
+
== Massive VE load ==
# for ((CT=200; CT<250; CT++)); do \
 
>  vzctl set $CT --ipadd 10.1.1.$CT --save; \
 
> done
 
</pre>
 
  
On another machine:
+
Use VEs from previous item — load those by <code>ab</code> or <code>http_load</code>. This demo shows that multiple VEs are working just fine, with low response time etc.
  
<pre>
+
FIXME: commands, ab/http_load setup.
# rpm -ihv http_load
 
#
 
</pre>
 
FIXME: http_load commands
 
  
 
== Live migration ==
 
== Live migration ==
  
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 to another. You can use, say, <code>xvnc</code> in a VE and <code>vncclient</code> to connect to it, then run <code>xscreensaver-demo</code> and while the picture is moving do a live migration. You'll show <code>xscreensaver</code> stalls for a few seconds but then keeps running — on another machine! That looks amazing, to say at least.
to another. You can use, say, <code>xvnc</code> in a container and
 
<code>vncclient</code> to connect to it, then run
 
<code>xscreensaver-demo</code>, 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 <code>xscreensaver</code> 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.
+
FIXME: commands, setup, vnc template.
  
 
== Resource management ==
 
== Resource management ==
Line 85: Line 59:
 
> done
 
> done
 
</pre>
 
</pre>
 
We can see that the number of processes inside container will not be growing.
 
We will see only the increase of <code>numproc</code> and/or
 
<code>kmemsize</code> fail counters in <code>/proc/user_beancounters</code>.
 
  
 
==== dentry cache eat up ====
 
==== dentry cache eat up ====
Line 94: Line 64:
  
 
=== CPU scheduler ===
 
=== CPU scheduler ===
 
+
Create 3 VPSes:
{{Warning|CPU weights only works in stable kernels.}}
 
 
 
Create 3 containers:
 
 
<pre>
 
<pre>
 
# vzctl create 101
 
# vzctl create 101
Line 104: Line 71:
 
</pre>
 
</pre>
  
Set container weights:
+
Set VPS weights:
 
<pre>
 
<pre>
 
# vzctl set 101 --cpuunits 1000 --save
 
# vzctl set 101 --cpuunits 1000 --save
Line 111: Line 78:
 
</pre>
 
</pre>
  
We set next CPU sharing <code>CT101 : CT102 : CT103 = 1 : 2 : 3</code>
+
We set next cpu sharing <code>VPS101 : VPS102 : VPS103 = 1 : 2 : 3</code>
  
Start containers:
+
Run VPSes:
 
<pre>
 
<pre>
 
# vzctl start 101
 
# vzctl start 101
Line 120: Line 87:
 
</pre>
 
</pre>
  
Run busy loops in all containers:
+
Run busy loops in VPSes:
 
<pre>
 
<pre>
 
# vzctl enter 101
 
# vzctl enter 101
Line 138: Line 105:
 
bash      17.5
 
bash      17.5
 
</pre>
 
</pre>
 
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 ===
 
=== Disk quota ===
 
<pre>
 
<pre>
# vzctl set CTID --diskspace 1048576:1153434 --save
+
# vzctl set VEID --diskspace 1048576:1153434 --save
# vzctl start CTID
+
# vzctl start VEID
# vzctl enter CTID
+
# vzctl enter VEID
 
[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>
 
[[Category:Events‏‎]]
 

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: