jtune reports 0M Memory Used
Miroslav Lachman
000.fbsd at quip.cz
Fri Jun 29 15:39:08 UTC 2007
Hi,
I am testing cdjones_jail_soc2006.patch on FreeBSD 6.2-RELEASE, patch
applied and GENERIC kernel, libc + jls, jail, jtune binaries recompiled
/ reinstalled.
I have some problems / questions. My testing setup is bellow (FreeBSD
running in Qemu on Windows XP)
notes:
host system hase name qemuspeed
jails are alpha, beta, gamma
!!! next content is very long !!!
root at qemuspeed ~/# jls
JID IP Address Hostname Path
3 172.16.16.4 gamma.xps.quip.test /usr/jail/gamma
2 172.16.16.3 beta.xps.quip.test /usr/jail/beta
1 172.16.16.2 alpha.xps.quip.test /usr/jail/alpha
root at qemuspeed ~/# ./jtune_all.sh
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / None 0
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / None 0
JID Hostname Memory Used / Limit CPU Shares
1 alpha.xps.quip.test 0 M / None 0
## from top (load 3)
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
1498 root 1 123 0 1680K 1172K RUN 0:54 32.21% sh
1499 root 1 122 0 1680K 1172K RUN 0:52 32.04% sh
1497 root 1 122 0 1680K 1172K RUN 0:57 32.03% sh
root at qemuspeed ~/# ./jtune_sysctls.sh
kern.sched.limit_jail_cpu: 0 -> 1
security.jail.limit_jail_memory: 0 -> 1
kern.sched.system_cpu_shares: 0 -> 10
security.jail.jail_pager_interval: 5 -> 5
## top is still same, endless loops in Jails are still running
root at qemuspeed ~/# ./jtune_tunes.sh
JID Hostname Memory Used / Limit CPU Shares
1 alpha.xps.quip.test 0 M / 5 M 5
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / 15 M 15
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / 20 M 20
## few minutes after aplying jtune settings - WCPU is still the same [it
seems wrong]
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
1497 root 1 170 0 1680K 844K RUN 5:17 32.62% sh
1498 root 1 170 0 1680K 1172K RUN 5:16 31.54% sh
1499 root 1 170 0 1680K 1172K RUN 5:17 30.71% sh
## retest with tcsh while (1) endless loop [it seems OK according to
jtune settings]
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
1368 root 1 129 0 3924K 2692K RUN 3:29 58.25% tcsh
1359 root 1 170 0 3924K 2692K RUN 1:55 24.27% tcsh
1350 root 1 170 0 3928K 1068K RUN 0:55 12.06% tcsh
root at qemuspeed ~/# ./jtune_all.sh
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / 20 M 20
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / 15 M 15
JID Hostname Memory Used / Limit CPU Shares
1 alpha.xps.quip.test 0 M / 5 M 5
## Why jtune -j JID -i shows Memory Used 0M if the process in Jail uses
2M5 (reported by top)
root at qemuspeed ~/# /etc/rc.d/jail stop alpha
Stopping jails: alpha.xps.quip.test.
## ^^^ takes about 1 minute to stop busy jail alpha
root at qemuspeed ~/# jls
JID IP Address Hostname Path
3 172.16.16.4 gamma.xps.quip.test /usr/jail/gamma
2 172.16.16.3 beta.xps.quip.test /usr/jail/beta
root at qemuspeed ~/# ./jtune_all.sh
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / 20 M 20
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / 15 M 15
## try to start Jail again with new jtune parameters:
jail -M 5 -S 5 /usr/jail/alpha alpha.xps.quip.test 172.16.16.2 /bin/sh
/etc/rc
## it takes more than 2 minutes to start new jail [host system is too
busy by other 2 jails running endless loop]
root at qemuspeed ~/# ./jtune_all.sh
JID Hostname Memory Used / Limit CPU Shares
4 alpha.xps.quip.test 0 M / 5 M 5
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / 20 M 20
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / 15 M 15
## top after few minutes runnig new jail [seems OK]
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
1368 root 1 170 0 3924K 2692K RUN 19:59 51.76% tcsh
1359 root 1 129 0 3924K 2456K RUN 11:04 34.03% tcsh
2194 root 1 170 0 3788K 1936K RUN 0:18 9.26% tcsh
## now some Mem limit testing
## run dd command in each jail
dd if=/dev/zero of=/dev/null bs=16m
## top after few minutes
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
2607 root 1 170 0 34052K 16688K RUN 5:42 43.64% dd
2606 root 1 132 0 34052K 16572K RUN 4:10 36.35% dd
2605 root 1 170 0 34052K 16736K RUN 0:56 12.85% dd
## ^^^ SIZE is 34MB and RES is 16MB even if jtune setting is 5MB for
jail aplha and jtune is still reporting 0MB usage:
root at qemuspeed ~/# ./jtune_all.sh
JID Hostname Memory Used / Limit CPU Shares
5 alpha.xps.quip.test 0 M / 5 M 5
JID Hostname Memory Used / Limit CPU Shares
3 gamma.xps.quip.test 0 M / 20 M 20
JID Hostname Memory Used / Limit CPU Shares
2 beta.xps.quip.test 0 M / 15 M 15
So am I doing something wrong?
Is there any useful tutorial / howto / example of jtune usage and useful
values?
Why sh loops shows same WCPU for each jail (not corresponding to jtune
values) but tcsh loops are correct?
Are there somebody with some success stories with this patch / good
knowlendge to explain some details about my examples?
content of my "shortcut scripts":
root at qemuspeed ~/# cat jtune_all.sh
#!/bin/sh
jails=`jls | awk '$1 ~ /[0-9]+/ { print $1 }'`
for jid in $jails
do
jtune -j $jid -i
done
root at qemuspeed ~/# cat jtune_sysctls.sh
#!/bin/sh
sysctl kern.sched.limit_jail_cpu=1
sysctl security.jail.limit_jail_memory=1
sysctl kern.sched.system_cpu_shares=10
sysctl security.jail.jail_pager_interval=5
root at qemuspeed ~/# cat jtune_tunes.sh
#!/bin/sh
jtune -j 1 -m 5 -s 5
jtune -j 2 -m 15 -s 15
jtune -j 3 -m 20 -s 20
jtune -j 1 -i
jtune -j 2 -i
jtune -j 3 -i
root at alpha ~/# cat while.sh
#!/bin/sh
while [ 1 ]
do
# nothing
done
## or same loop in tcsh shell as
while (1)
end
I know that this loop is not ideal for CPU usage testing but...
Miroslav Lachman
More information about the freebsd-jail
mailing list