Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Memory usage in KVM and OpenVZ
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Memory usage in KVM and OpenVZ

dnwkdnwk Member
edited January 2013 in Help

Hi all
I just migrate my server from a KVM vps to OpenVZ vps. I install same stuff in both vm. However, I find out that when I use top, applications use more Memory in OpenVZ than KVM. In KVM, top command show that I only use about 500 something M of memory. But in OpenVZ, it is easily go over 1024 M.
Why is that happening?

Comments

  • There exist a similar post :-|


    It actually depends what the server is being used for, generally as I came to know Java and OVZ are not to friendly with each other.

    In many cases OVZ usage less resources then KVM

  • So it would be better to tell what you are using so that others may help, in a better and precised manner. :)

  • if it is java yes you will need more memory than kvm, but it will also be cheaper.

  • I ran a Mail Server. in detail , zarafa. Zarafa, Apache and PHP5-FPM!

  • hrmmm, you may need to do some optimization.

  • who is the vps through?

  • dnwkdnwk Member
    edited January 2013

    I install them using the same way in same OS.
    Oh, I saw the difference. I am using BuyVM's machine. @Francisco
    But I saw in OVZ, the kernel is 2.6. But in KVM, I install 3.2
    Does that make any difference?

  • If I remember correctly, OVZ without vswap shows the amount of memory allocated, while KVM shows the real usage.

  • yeah 2.6 is the older non vswap kernel that works differently.

  • So, is there a way to know how many memory I really use?

  • You should see an amount that is cached memory, that is memory that may or may not be in use.

  • what is that site? linuxatemymemory? is that it?

  • root@mg:~# free -m
    total used free
    Mem: 2048 1261 786
    -/+ buffers/cache: 1261 786
    Swap: 0 0 0

    The method on linuxatmymemory does not really helpful.

  • @MikeIn said: It actually depends what the server is being used for, generally as I came to know Java and OVZ are not to friendly with each other.

    @24khost said: if it is java yes you will need more memory than kvm, but it will also be cheaper.

    Can we please get over the Java + OpenVZ bashing? It's not really a problem on OpenVZ with VSwap. In the older burst structure there are a lot more memory issues than just Java anyhow.

    With enough VSwap, it should be more than comparable if not sometimes better than KVM.

  • jarjar Patron Provider, Top Host, Veteran
    edited January 2013

    Make this a bash script:

    #!/bin/bash
    
    SWAP="${1:-512}"
    
    NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0"
    
    umount /proc/meminfo 2> /dev/null
    sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo
    mount --bind /etc/fake_meminfo /proc/meminfo
    
    free -m
    

    Run that after booting your OpenVZ, start your applications, see if the memory looks more like what you see in KVM. Memory usage is different for some applications without swap, even if it doesn't use it. The existence of it (or even appearance of it) alone seems to be enough to make some applications run at far less memory usage. I won't pretend to understand it, but I can run a full Ubuntu desktop (Unity2D) with the false appearance of swap at around 250mb memory usage. Same thing without the fake swap, nearly 1GB.

    That script is fake swap. Don't use it in production. It tricks the system into thinking that swap exists. If it tries to use it, it'll probably crash. If you want swap on your OpenVZ, you can use one with the 2.6.32 kernel and vSwap enabled. Currently vSwap seems to have stability issues on high capacity nodes. I'm sure @Francisco will enable it again on BuyVM the moment he's convinced that it is stable for everyone.

  • Try use htop maybe?

  • @jarland Thanks for your advice. Right now the memory usage show up in top is about three times the KVM. So I am kind of re-consider if I should stay with KVM or move into OVZ

    @ErawanArifNugroho htop show up the same thing as top

    In BuyVM's support ticket, they said it is the real memory usage.

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    @dnwk said: In BuyVM's support ticket, they said it is the real memory usage.

    For now it is.

    The 'burst ram' is there to help make up for the annoying memory allocating .18 does.

    We have .32 on a good 20+ nodes I figure and they seem fine. We got a few that still crap out and won't take it properly so we figure the issue still exists, we're just not triggering it on the other nodes.

    Francisco

  • @Francisco said: We have .32 on a good 20+ nodes

    Can customers request to migrate to .32 from .18 nodes?

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    @jcaleb said: Can customers request to migrate to .32 from .18 nodes?

    Maybe but we aren't keeping the nodes on .32 once they crash. We can't have nodes that we aren't certain will stay online for long periods of time. Prior to the CPU upgrades, we had countless nodes in the 200+ uptime range with a few past 300 days.

    Francisco

  • @jcaleb said: an customers request to migrate to .32 from .18 nodes?

    Probably not - that would be a pain in the rear end and time consuming for the provider to move people back and fourth.

    CustomerX: I'm not happy with the .32 kernel can you please move me back to .18.

  • As others have pointed out, stick with OpenVZ with VSwap enabled. Otherwise KVM or Xen.

    Without VSwap OpenVZ seems to mark far more memory allocated than a KVM or OpenVZ/vSwap VPS would.

  • smansman Member
    edited June 2013

    Java doesn't work correctly in OpenVZ 2.6.18.x CentOS 5 based kernel. They changed the memory management in 2.6.32.x CentOS 6 based kernel and java now works fine. OpenVZ does not use more memory. It uses significantly less because you are not running a kernel. Individual processes should use the same regardless of which virtualization you are using. So it must be an interpretation issue not technical.

  • You should really stop resurrecting long-dead threads....

  • I think you should choose xen instead of openvz if you need guarantee ram

Sign In or Register to comment.