PVE Host Swaps, when it has a lot of memory available

RRJ

Member
Apr 14, 2010
245
0
16
Estonia, Tallinn
Hi,

Just noticed, that proxmox Host PVE swaps, when it has a lot of memory. /proc/userbeancounters fails show 0 for every host. Why this could happen?

Memory usage is like: committed 7, total 14, swaped 1,5 GB.

Code:
pve-manager: 2.2-26 (pve-manager/2.2/c1614c8c)
running kernel: 2.6.32-16-pve
proxmox-ve-2.6.32: 2.2-80
pve-kernel-2.6.32-11-pve: 2.6.32-66
pve-kernel-2.6.32-16-pve: 2.6.32-80
lvm2: 2.02.95-1pve2
clvm: 2.02.95-1pve2
corosync-pve: 1.4.4-1
openais-pve: 1.1.4-2
libqb: 0.10.1-2
redhat-cluster-pve: 3.1.93-1
resource-agents-pve: 3.9.2-3
fence-agents-pve: 3.1.9-1
pve-cluster: 1.0-28
qemu-server: 2.0-64
pve-firmware: 1.0-21
libpve-common-perl: 1.0-37
libpve-access-control: 1.0-25
libpve-storage-perl: 2.0-34
vncterm: 1.0-3
vzctl: 4.0-1pve2
vzprocps: 2.0.11-2
vzquota: 3.1-1
pve-qemu-kvm: 1.2-7
ksm-control-daemon: 1.1-1

Processes sorted by SWAP usage:
Code:
    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
   7446 root      20   0 1283m 404m 1984 S    5  2.9   5106:54 879m kvm
 260223 root      20   0  773m  70m 2412 S    4  0.5   5218:39 703m kvm
   6893 root      20   0  871m 367m 2412 S    2  2.6   5030:06 504m kvm
   7541 root      20   0  580m  81m 2412 S    3  0.6   5155:20 499m kvm
   7617 root      20   0  863m 370m 2424 S    6  2.6   7540:55 492m kvm
   5706 root      20   0  640m 235m 2412 S    3  1.7   4771:37 405m kvm
   1531 root      20   0  381m 1364  828 S    0  0.0  56:50.17 380m rrdcached
   7382 root      20   0 1064m 703m 2420 S   24  5.0  32478:19 360m kvm
   1554 root      20   0  336m  19m  18m S    1  0.1 325:48.87 317m pmxcfs
 854368 www-data  20   0  294m 5436 1496 S    0  0.0   0:00.17 289m apache2
 854367 www-data  20   0  293m 5428 1492 S    0  0.0   0:00.18 288m apache2

If I go inside a KVM Guest, I don't see any SWAP usage nor high memory usage.

As an example, the free output from machine that runs under process PID 260223
Code:
             total       used       free     shared    buffers     cached
Mem:        767512     694528      72984          0      99384     245136
-/+ buffers/cache:     350008     417504
Swap:      1048568         92    1048476
 
Last edited:
Hi,

Just noticed, that proxmox Host PVE swaps, when it has a lot of memory. /proc/userbeancounters fails show 0 for every host. Why this could happen?

Memory usage is like: committed 7, total 14, swaped 1,5 GB.

Code:
pve-manager: 2.2-26 (pve-manager/2.2/c1614c8c)
running kernel: 2.6.32-16-pve
proxmox-ve-2.6.32: 2.2-80
pve-kernel-2.6.32-11-pve: 2.6.32-66
pve-kernel-2.6.32-16-pve: 2.6.32-80
lvm2: 2.02.95-1pve2
clvm: 2.02.95-1pve2
corosync-pve: 1.4.4-1
openais-pve: 1.1.4-2
libqb: 0.10.1-2
redhat-cluster-pve: 3.1.93-1
resource-agents-pve: 3.9.2-3
fence-agents-pve: 3.1.9-1
pve-cluster: 1.0-28
qemu-server: 2.0-64
pve-firmware: 1.0-21
libpve-common-perl: 1.0-37
libpve-access-control: 1.0-25
libpve-storage-perl: 2.0-34
vncterm: 1.0-3
vzctl: 4.0-1pve2
vzprocps: 2.0.11-2
vzquota: 3.1-1
pve-qemu-kvm: 1.2-7
ksm-control-daemon: 1.1-1

Processes sorted by SWAP usage:
Code:
    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
   7446 root      20   0 1283m 404m 1984 S    5  2.9   5106:54 879m kvm
 260223 root      20   0  773m  70m 2412 S    4  0.5   5218:39 703m kvm
   6893 root      20   0  871m 367m 2412 S    2  2.6   5030:06 504m kvm
   7541 root      20   0  580m  81m 2412 S    3  0.6   5155:20 499m kvm
   7617 root      20   0  863m 370m 2424 S    6  2.6   7540:55 492m kvm
   5706 root      20   0  640m 235m 2412 S    3  1.7   4771:37 405m kvm
   1531 root      20   0  381m 1364  828 S    0  0.0  56:50.17 380m rrdcached
   7382 root      20   0 1064m 703m 2420 S   24  5.0  32478:19 360m kvm
   1554 root      20   0  336m  19m  18m S    1  0.1 325:48.87 317m pmxcfs
 854368 www-data  20   0  294m 5436 1496 S    0  0.0   0:00.17 289m apache2
 854367 www-data  20   0  293m 5428 1492 S    0  0.0   0:00.18 288m apache2

If I go inside a KVM Guest, I don't see any SWAP usage nor high memory usage.

As an example, the free output from machine that runs under process PID 260223
Code:
             total       used       free     shared    buffers     cached
Mem:        767512     694528      72984          0      99384     245136
-/+ buffers/cache:     350008     417504
Swap:      1048568         92    1048476
Hi,
are you sure that the host swaps?
If I look on a host, there is some swap-space used but not realy swaping:
Code:
root@proxmox1:~# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-29                              partition       8388600 13544   -1
root@proxmox1:~# iostat -dm 5 dm-29
Linux 2.6.32-17-pve (proxmox1)  02/05/2013      _x86_64_        (8 CPU)

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
dm-29             0.51         0.00         0.00       6631         44

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
dm-29             0.00         0.00         0.00          0          0

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
dm-29             1.00         0.00         0.00          0          0

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
dm-29             0.00         0.00         0.00          0          0
^C
root@proxmox1:~# cat /proc/meminfo 
MemTotal:       32889844 kB
MemFree:          195576 kB
Buffers:          360280 kB
Cached:         14026968 kB
SwapCached:         1492 kB
Active:         17666456 kB
Inactive:       14240992 kB
Active(anon):   16454096 kB
Inactive(anon):  1124116 kB
Active(file):    1212360 kB
Inactive(file): 13116876 kB
Unevictable:       63740 kB
Mlocked:           63740 kB
SwapTotal:       8388600 kB
SwapFree:        8375056 kB
Dirty:               536 kB
Writeback:             0 kB
AnonPages:      17582560 kB
Mapped:            72372 kB
Shmem:             51480 kB
Slab:             356924 kB
SReclaimable:     293188 kB
SUnreclaim:        63736 kB
KernelStack:        3456 kB
PageTables:        53508 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    24833520 kB
Committed_AS:   23378076 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      432892 kB
VmallocChunk:   34359151040 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        7168 kB
DirectMap2M:     2039808 kB
DirectMap1G:    31457280 kB
BTW. swapping inside an KVM-guest has nothing to do with swapping of the host.

Udo
 
Well, it does not actually swap. May be I asked my question in wrong way. Just interesting, what could be the reason for moving data to disk (swap), when it has a lot of memory to use. And actually, if data was placed there, it will be read someday too and this reading will be slow.
 

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!