Hullo there,
I admin a vm with Bytemark, and am wondering why the swap is showing as full. Htop shows Mem usage to be roughly half (out of 984MB), but swap is at 255/255MB and hasn't shown any signs of changing for several hours now.
vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 262116 237032 58540 258224 2 1 5 1 4 4 19 10 69 2
swapon -s Filename Type Size Used Priority /dev/vdb partition 262136 262116 -1
cat /proc/sys/vm/swappiness 60
Is there any way i can see what the swap is full of, or why it is full when there is plenty memory available?
Thanks,
Jenny
Is there any way i can see what the swap is full of, or why it is full when there is plenty memory available?
It might relate to what VM technology your provider is using. Many VM technologies use a balloon driver which allows the system to steal memory from your VM to allocate it to others. Other things like tmpfs can also use it.
On one of our systems, we have some big VMs, and if I look for a line called VmSwap in the /proc/pid/status file, I can see this is responsible for almost all my swap useage:
#ps v -u qemu PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 7444 ? Sl 19393:04 4066 2818 34398217 33652364 25.4 /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 32768 -smp 2,sockets=2,cores=1,threads=1 8380 ? Sl 13157:03 5288 2818 68921177 66595700 50.3 /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 65536 -smp 8,sockets=8,cores=1,threads=1
#cat /proc/8380/status | grep ^VmSwap VmSwap: 646248 kB
# free total used free shared buffers cached Mem: 132142972 131448352 694620 0 257232 26698436 -/+ buffers/cache: 104492684 27650288 Swap: 262143984 673900 261470084
Can anyone come up with a script to sort this output for all processes by named process\pid?
On 29 August 2011 16:36, Karl Foley karl@thefoleyhouse.co.uk wrote:
Is there any way i can see what the swap is full of, or why it is full when there is plenty memory available?
It might relate to what VM technology your provider is using. Many VM technologies use a balloon driver which allows the system to steal memory from your VM to allocate it to others. Other things like tmpfs can also use it.
On one of our systems, we have some big VMs, and if I look for a line called VmSwap in the /proc/pid/status file, I can see this is responsible for almost all my swap useage:
#ps v -u qemu PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 7444 ? Sl 19393:04 4066 2818 34398217 33652364 25.4 /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 32768 -smp 2,sockets=2,cores=1,threads=1 8380 ? Sl 13157:03 5288 2818 68921177 66595700 50.3 /usr/libexec/qemu-kvm -S -M rhel6.1.0 -enable-kvm -m 65536 -smp 8,sockets=8,cores=1,threads=1
#cat /proc/8380/status | grep ^VmSwap VmSwap: 646248 kB
# free total used free shared buffers cached Mem: 132142972 131448352 694620 0 257232 26698436 -/+ buffers/cache: 104492684 27650288 Swap: 262143984 673900 261470084
Can anyone come up with a script to sort this output for all processes by named process\pid?
Thanks, Karl - interesting stuff about the ballooning thing as well. This: #ps v -u qemu -is this on the vm, yes? I don't have a user qemu so only get a No user name error. Usage has dropped down again now, but I'd be interested to have a look: a script would be handy indeed.
Jenny
Thanks, Karl - interesting stuff about the ballooning thing as well. This: #ps v -u qemu -is this on the vm, yes? I don't have a user qemu so only get a No user name error. Usage has dropped down again now, but I'd be interested to have a look: a script would be handy indeed.
Sorry - That was on the host running kvm. You need to look at your own processes on the vm.
On 29 August 2011 19:55, Karl Foley karl@thefoleyhouse.co.uk wrote:
Thanks, Karl - interesting stuff about the ballooning thing as well. This: #ps v -u qemu -is this on the vm, yes? I don't have a user qemu so only get a No user name error. Usage has dropped down again now, but I'd be interested to have a look: a script would be handy indeed.
Sorry - That was on the host running kvm. You need to look at your own processes on the vm.
Yep, I totally misunderstood there :-)
Thanks,
Jenny
Here's a nice explanation about memory ballooning: http://rwmj.wordpress.com/2010/07/17/virtio-balloon/ -- ATB, Karl