KVM VE not using Swap at all?

Giovanni

Renowned Member
Apr 1, 2009
111
11
83
Hi guys

I moved a production machine using Centos 3.4 and cpanel to KVM and now the high load seems to be cause of the memory usage.

There is 1536 allocated to this VE, and has a 3GB swap which seems that is not being used.

top - 08:36:48 up 17:25, 2 users, load average: 17.09, 16.56, 9.34
Tasks: 136 total, 12 running, 123 sleeping, 0 stopped, 1 zombie
Cpu(s): 46.2%us, 16.6%sy, 0.0%ni, 0.0%id, 0.0%wa, 20.9%hi, 16.3%si, 0.0%st
Mem: 1541964k total, 1530016k used, 11948k free, 16800k buffers
Swap: 3112952k total, 84k used, 3112868k free, 941508k cached


Any ideas as to why and how to fix it or is this a known bug?

Here is /etc/fstab for the VE

/dev/VolGroup00/LogVol00 / ext3 defaults,usrquota 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/usr/tmpDSK /tmp ext3 defaults,noauto 0 0
swapon -a makes no difference.

root@server11 [~]# free
total used free shared buffers cached
Mem: 1541964 1533048 8916 0 12720 997376
-/+ buffers/cache: 522952 1019012
Swap: 3112952 84 3112868
root@server11 [~]#
also another quick question related to this VE, on proxmox KVM settings I set CPU Sockets 4 and CPU per Socket 1, however the OS on the machine only sees 1 cpu
 
Last edited:
did you really have 4 cpu's in your physical server? or only 1 quadcore?
you should not assign more cpu's than you really have;

the linux kernel will not waste memory in not using it - availiable free memory will be used for disk caching - this is what you see in cached;
your output shows 941508k cached - that means this memory is almost free when a process need it;

there is a parameter which controls the swapping;
on normal linux systems 'cat /proc/sys/vm/swappiness' should return '60'
increasing or decreasing manipulates the time the kernel will use the swap;
lower values will avoid swapping, higher values will swap more often;

try to allocate more memory, start applications that need more memory and the cached value should decrease - if it goes to zero the swap space should be come in use;
 
did you really have 4 cpu's in your physical server? or only 1 quadcore?
you should not assign more cpu's than you really have;

the linux kernel will not waste memory in not using it - availiable free memory will be used for disk caching - this is what you see in cached;
your output shows 941508k cached - that means this memory is almost free when a process need it;

there is a parameter which controls the swapping;
on normal linux systems 'cat /proc/sys/vm/swappiness' should return '60'
increasing or decreasing manipulates the time the kernel will use the swap;
lower values will avoid swapping, higher values will swap more often;

try to allocate more memory, start applications that need more memory and the cached value should decrease - if it goes to zero the swap space should be come in use;

Thanks for your response. The server is a single quad core CPU. This is what I ment when I used the settings I stated earlier.

cat /proc/sys/vm/swappiness shows "60" hmm
 
ok, than you can only assign 1 cpu with 4 cores;

swappiness 60 is ok, the default on the most linux systems, try to use up all your memory and see if your system is using the swap partition;
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!