What’s KSM ?
KSM combines memory pages from multiple processes into one copy on write memory region.
This feature is effective when you run multiple processes.
This feature is also effective when you run multiple VMs under KVM , because these VMs run as processes.
How to check whether KSM works or not
- verify your Kernel supports KSM
CONFIG_KSM=y means your kernel support KSM.
You can check kernel parameters related to KSM under /sys/kernel/mm/ksm/ directory.
- check /sys/kernel/mm/ksm/pages_sharing after running VMs
If its number is greater than zero , KSM is effective.
before running VMs
after running 8 VMs
start 8 VMs
taking advantages of KSM because pages_sharing is increasing
KSM combines memory pages from multiple processes into one copy on write memory region.
This feature is effective when you run multiple processes.
This feature is also effective when you run multiple VMs under KVM , because these VMs run as processes.
How to check whether KSM works or not
- verify your Kernel supports KSM
root@hat1:~# tail -1 /etc/lsb-release DISTRIB_DESCRIPTION="Ubuntu 10.10" root@hat1:~# uname -r 2.6.35-25-server |
root@hat1:~# egrep -i ksm /boot/config-`uname -r` CONFIG_KSM=y |
CONFIG_KSM=y means your kernel support KSM.
You can check kernel parameters related to KSM under /sys/kernel/mm/ksm/ directory.
root@hat1:~# ls /sys/kernel/mm/ksm/* /sys/kernel/mm/ksm/full_scans /sys/kernel/mm/ksm/pages_unshared /sys/kernel/mm/ksm/pages_shared /sys/kernel/mm/ksm/pages_volatile /sys/kernel/mm/ksm/pages_sharing /sys/kernel/mm/ksm/run /sys/kernel/mm/ksm/pages_to_scan /sys/kernel/mm/ksm/sleep_millisecs |
- check /sys/kernel/mm/ksm/pages_sharing after running VMs
If its number is greater than zero , KSM is effective.
before running VMs
root@hat1:~# LANG=C virsh list --all Id Name State ---------------------------------- - centos5.5-1 shut off - ubuntu-1 shut off - ubuntu-2 shut off - ubuntu-3 shut off - ubuntu-4 shut off - ubuntu-5 shut off - ubuntu-6 shut off - ubuntu-7 shut off - ubuntu-8 shut off - ubuntu-vm-org shut off - vpn_test shut off - win2008-R2-1 shut off root@hat1:~# cat /sys/kernel/mm/ksm/pages_sharing 0 |
after running 8 VMs
start 8 VMs
virsh # start ubuntu-1 ドメイン ubuntu-1 が起動されました virsh # start ubuntu-2 ドメイン ubuntu-2 が起動されました virsh # start ubuntu-3 ドメイン ubuntu-3 が起動されました virsh # start ubuntu-4 ドメイン ubuntu-4 が起動されました virsh # start ubuntu-5 ドメイン ubuntu-5 が起動されました virsh # start ubuntu-6 ドメイン ubuntu-6 が起動されました virsh # start ubuntu-7 ドメイン ubuntu-7 が起動されました virsh # start ubuntu-8 ドメイン ubuntu-8 が起動されました |
taking advantages of KSM because pages_sharing is increasing
root@hat1:~# while [ 1 ]; do cat /sys/kernel/mm/ksm/pages_sharing; sleep 1; done 0 0 0 0 1136 2326 2366 3599 4334 4362 4730 5012 6233 6591 10899 15706 20532 24941 29372 33898 35748 35785 |
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.