Results 1 to 3 of 3

Thread: KVM Memory usage

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Beans
    21

    Question KVM Memory usage

    Hi there,

    I'm seeing some high memory usage and was wondering if it was normal.

    I'm running 2 VMs on my Ubuntu 12.04 (server edition) :

    1) Windows 2008R2 server which has 2048MB assigned to it.
    2) Ubuntu server edition 12.04 which has also 2048MB assigned to it.

    in TOP I get 2 processes :
    The first kvm process (windows 2008R2) uses about 2G of memory.
    But the second kvm process (Ubuntu 12.04) uses more than 4G of memory.

    2.03G in SWAP and 2G in RES.. Isn't that quite high for a simple lamp stack running a few websites ? (2x wordpress, subsonic, tools)

    Code:
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
    28616 libvirt-  20   0 2470m 2.0g 6916 S    7 25.9   0:24.38 435m kvm
     1324 root      20   0  833m 7488 3976 S    1  0.1   0:23.15 826m libvirtd
       36 root      25   5     0    0    0 S    1  0.0  13:35.79    0 ksmd
     2125 libvirt-  20   0 4467m 2.0g 6688 S    1 26.6  27:13.29 2.3g kvm
    27695 sinnige   20   0  133m 2368 1040 S    0  0.0   0:00.29 131m sshd
        1 root      20   0 24452 2216 1296 S    0  0.0   0:01.03  21m init
        2 root      20   0     0    0    0 S    0  0.0   0:00.00    0 kthreadd
        3 root      20   0     0    0    0 S    0  0.0   0:01.88    0 ksoftirqd/0
        6 root      RT   0     0    0    0 S    0  0.0   0:00.00    0 migration/0
        7 root      RT   0     0    0    0 S    0  0.0   0:00.48    0 watchdog/0
        8 root      RT   0     0    0    0 S    0  0.0   0:00.00    0 migration/1
        9 root      20   0     0    0    0 S    0  0.0   0:05.55    0 kworker/1:0
       10 root      20   0     0    0    0 S    0  0.0   0:02.20    0 ksoftirqd/1
       12 root      RT   0     0    0    0 S    0  0.0   0:00.43    0 watchdog/1
       13 root      RT   0     0    0    0 S    0  0.0   0:00.00    0 migration/2
       15 root      20   0     0    0    0 S    0  0.0   0:03.17    0 ksoftirqd/2
       16 root      RT   0     0    0    0 S    0  0.0   0:00.42    0 watchdog/2
    Last edited by Antoniya001; August 14th, 2012 at 11:34 PM. Reason: mistake

  2. #2
    Join Date
    Oct 2006
    Beans
    36
    Distro
    Ubuntu

    Re: KVM Memory usage

    I'm not sure why you're seeing the 4GB usage, but usually each VM will reserve the amount of memory that you set it with. If you have 1GB, 2GB, and 4GB VMs running, then you will see 7GB of ram allocate with the respective amounts for each of their processes. It doesn't seem to depend on what is running in each VM. Although, one would assume that if there was a chunk of RAM that wasn't being touched by a VM, then it would start swapping that to disk, but if Linux's caching is active on the VM this probably won't happend.

  3. #3
    Join Date
    Jun 2007
    Location
    Neverland
    Beans
    894
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: KVM Memory usage

    Virt is asked for allocation. Res is the actual usage.

    Both/each your kvms take 2gb exactly. The fact they asked for more is not quite important. A process can ask for infinite memory and use only the allocated.

    I believe your virtual machines are using whatever they need, and the host is allocating extra for its own needs. Whatever resides in swap could be pages from a snapshot or memory image or similar.

    The real usage - you need to check inside the guest. Think of that 2gb limit as the real ram for the guest. And if your oses support kvm extensions, then you can overcommit and share, so your memory allocation won't be a hard limit.

    Dedoimedo
    Linux Systems Expert / Systems Programmer, LPIC-1, LPIC-2(WIP), GSEC, CCHD, CCHA
    http://www.dedoimedo.com - A place to learn a lot about a lot!

    Pangolin Review | Ringtail Review | Linux Games | My books

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •