Howdy, Stranger!

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


Low memory usage, high swap?
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.

Low memory usage, high swap?

littleguylittleguy Member
edited January 2012 in General

I have a OpenVZ CentOS6 box with 512MB RAM/512MB VSwap. I am running a standard apache/mysql setup.

Today I noticed that the swap was running fairly high while the memory usage was particularly low. (69MB RAM, 82MB swap)

!(http://i.imgur.com/NItH3.png)
A couple of minutes after the screenshot the memory usage went up to ~150MB (pretty normal for my setup) and the swap went down to 50MB.

Can anyone explain this behaviour?

Comments

  • Its called swap because it swaps between memory and disk. if its needed it swaps back in to ram. its usually quicker than generating the information again

    So you just had 32 mb put back on a ram stick

  • @exussum said: if its needed it swaps back in to ram.

    Isn't that what cache is for? Afaik swap isn't needed at all unless you run out of physical memory.

  • The vswap in OpenVZ is weird....

    Sometimes you just can have like 20MB or less used of your memory, and still be swapping.
    I don't know, probably is the buggy vswap behavior, or probably the node is really swapping because heavy overselling.

    Maybe @Francisco can tell us how this behaves really.

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    vswap is pressured by how much actual RAM the HN is using.

    It acts like real swap so if you get a lot of people using up their real allocations on the HN, you'll start seeing vswap usage.

    They fixed the accounting bug in vswap in the 44.11 release but I still don't trust it.

    Francisco

  • @Francisco said: if you get a lot of people using up their real allocations on the HN, you'll start seeing vswap usage.

    Thanks for the info Francisco!

    Just to clarify: are you saying that if you consistently use swap without maxing on your RAM, there is evidence of overselling? I understand you are a provider and don't want to get people paranoid, I'm asking just "in general". :)

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    Some, yes. vswap is a really odd thing and you can't force your nodes to not swap with it.

    Like, we make it so, while our nodes have swap, that linux always favors real RAM over swapping. With vswap we'd have to undo this and we take a chance at actually swapping.

    I'd much rather just assign users 'burstable real ram' than vswap just because it allows us to keep performance on the high side of things.

    Francisco

  • I think the idea with vswap is the same as having a high swappiness setting, where pages don't get used very often get stored in swap to make room for any other apps that might get launched.

    I prefer burst to vswap as well.
    Justin

Sign In or Register to comment.