Howdy, Stranger!

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

Advertise on LowEndTalk.com
Dedicated Ram/ Guaranteed Ram... an oldie but a goody that deserves being seen again
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

Dedicated Ram/ Guaranteed Ram... an oldie but a goody that deserves being seen again

AnthonySmithAnthonySmith Top Provider
edited February 2013 in Tutorials

After reading another thread here and after answering a similar question a few times on IRC I thought I would bring this one back in to the lime light.

http://www.lowendbox.com/blog/how-to-tell-your-openvz-vps-is-swapping/

Think of this as one of those, how many IOPS do you get, dd results type threads:

tl;dr for people who dont want to read all the info in the link

1) go to: http://hostingfu.com/article/vzfree-checking-memory-usage-inside-openvz-ve

2) wget http://hostingfu.com/files/vzfree/vzfree-0.1.tgz

3) install make gcc, e.g. yum install gcc make or apt-get install make gcc

4) make

5) make install

then run vzfree and you get an output like:

racksrv.com 512MB VPS, zero unplanned down time in 2 years.
Racksrv Nodes are enterprise grade and they have never been featured on LEB.

             Total     Used     Free
Kernel:   2048.00M    4.49M 2043.51M
Allocate:  512.00M  126.91M  385.09M (512M Guaranteed)
Commit:    512.00M   96.02M  415.98M (72.1% of Allocated)
Swap:                 0.00M          (0.0% of Committed)

quickweb 512MB VPS, 1 unplanned outage in 18 months due to disk failure whcih is completely acceptable.
Quickweb seems to have left LEB behind quite some time ago.

             Total     Used     Free
Kernel:   2048.00M    5.44M 2042.56M
Allocate:  768.00M  192.81M  575.19M (512M Guaranteed)
Commit:    512.00M   71.65M  440.35M (34.3% of Allocated)
Swap:                 0.00M          (0.0% of Committed)

The other more simple approach is a little script that long time member @rm wrote

#!/bin/bash
cat /proc/user_beancounters | grep -E '(uid|physpages|oomguarpages)'
PHYS=`cat /proc/user_beancounters | grep " physpages " | awk '{print $2}'`
OOMGUAR=`cat /proc/user_beancounters | grep " oomguarpages " | awk '{print $2}'`
SWAP=$(($OOMGUAR-$PHYS))
echo
echo Swapped out: $SWAP pages, or $(($SWAP*4096/1024)) KiB

Save that as e.g. scamram, chmod +x scamram and ./scamram

and you get an output like:

       uid  resource                     held              maxheld              barrier                limit              failcnt
            physpages                   16994                29671                    0           2147483647                    0
            oomguarpages                16995                29672               131072           2147483647                    0

Swapped out: 0 pages, or 0 KiB


So essentially it is a good little method to see if any of your dedicated or guaranteed memory is being swapped out on the node due to over allocation.

I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

Comments

  • jcalebjcaleb Moderator

    But for .32 it reports weird numbers right?

  • @jcaleb said: But for .32 it reports weird numbers right

    Maybe, they are both 2.6.18 boxes

    I am sure we can work out what is what on 2.6.32 boxes given some examples.

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • Only one of my VPS using 2.6.18

                 Total     Used     Free
    Kernel:   2048.00M    4.09M 2043.91M
    Allocate: 2048.00M  276.50M 1771.50M (1536M Guaranteed)
    Commit:   1536.00M  159.66M 1376.34M (56.3% of Allocated)
    Swap:                 0.00M          (0.0% of Committed)
    

    Tried on .32 boxes.

                 Total     Used     Free
    Kernel:   1024.00M   33.62M  990.38M
    Allocate: 36028797018963968.00M  442.81M 36028797018963524.00M (3602879701896396
    Commit:   36028797018963968.00M  261.13M 36028797018963708.00M (51.4% of Allocat
    Swap:              -1528.55M          (-671.8% of Committed)
    
                 Total     Used     Free
    Kernel:   8796093022208.00M   18.15M 8796093022189.85M
    Allocate: 36028797018963968.00M  475.57M 36028797018963492.00M (36028797018963967M Guaranteed)
    Commit:   36028797018963968.00M  336.91M 36028797018963632.00M (67.0% of Allocated)
    Swap:              -192.35M          (-60.3% of Committed)
    
                 Total     Used     Free
    Kernel:    512.00M   14.46M  497.54M
    Allocate: 36028797018963968.00M  393.51M 36028797018963576.00M (3602879701896396
    Commit:   36028797018963968.00M  206.32M 36028797018963760.00M (48.8% of Allocat
    Swap:              -538.51M          (-280.7% of Committed)
    

    I'm here to collect your heart

  • If you want @AnthonySmith I could add this to the lowendwiki?

    Quis custodiet ipsos custodes?
    https://raymii.org - https://cipherli.st
  • nstormnstorm Member
    edited February 2013

    This are kinda outdated. Most hosts use recent, vSwap enabled OpenVZ kernels nowdays. And it has a different memory model, so these methods wont work.

    EDIT: For new, vSwap-enabled (.32) kernels you can just check casual 'free -m' and will show you real info, instead of how old kernels handle this. Still a swap for this aren't real swap usage, its just a vSwap but the pages are still in physical memory. There are a lot of detailed info on this matter here.

  • jcalebjcaleb Moderator
    edited February 2013

    So how to know swapping in the node in .32? Is it possible?

  • How to tell if your OpenVZ provider is overselling: They just are :P

  • Someone can move it to tutorials?

  • challengekechallengeke Member
    edited February 2013

    Great Article,Thank you.

  • @AnthonySmith said: So essentially it is a good little method to see if any of your dedicated or guaranteed memory is being swapped out on the node due to over allocation.

    Memory get swapped out all the time, it's not necessarily a sign of "over allocation". It could equally be that the processes using the memory are idle. I see this all the time on OpenVZ VMs.... get a new VM, install some (daemon) stuff, then leave it idle. A few days later some memory will be swapped out. Start actually using the daemon processes (put some traffic through) and the "swapped memory" disappears. I think it's just expected behaviour of the Linux kernel.

  • @sleddog said: Memory get swapped out all the time, it's not necessarily a sign of "over allocation".

    Memory gets swapped out on dedicated servers too. It's how the operating system works and what swap is for.

    Serving you the best VPS, Web hosting, dedicated servers and more - Cloud Shards | Query Foundry
    We operate the network AS62638 | Available in Syd AU and Dallas, Los Angeles and NYC USA
  • My undersold KVM node has around 500mb in swap and hasn't come close to running out of memory.

    image

    FreeVPS.us - The oldest post to host VPS provider
  • Linux may swap out memory tied up by idle processes, and use that memory for caching. There are a few parameters, like swappiness, that give you some control over this on a dedicated box -- or xen/kvm.

  • The point is not if and when Linux Swaps ram. the point is that this shows if the host node has swapped out your active ram that has been dedicated to the container, i.e. the host node has no option but to move 100mb of your 256mb active commit on your 2GB box in to swap on the host node which would be transparent on the container otherwise (apart from performance)

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • @AnthonySmith We give like 30-40GB on 16GB servers, and it almost never peaks beyond 8GB.

    I find the 256MB Plans are the ones who use all their resources.

    AboveClouds • UK Company • UK Datacentre • UK Customer Support

    High Performance Pure SSD Cloud Hosting with a personal touch

  • AnthonySmithAnthonySmith Top Provider
    edited February 2013

    @Jacob +1 for honesty, interesting numbers too :)

    Although you should really change your website as your not really offering dedicated RAM :p

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • JacobJacob Member
    edited February 2013

    @AnthonySmith It's dedicated, but shared. I'm planning to get the 16GB HNs abit more beefier but they're fine for now.

    I would say overselling 50-60% of RAM is sensible, as I can imagine others go for the 80% mark.

    AboveClouds • UK Company • UK Datacentre • UK Customer Support

    High Performance Pure SSD Cloud Hosting with a personal touch

  • @Jacob said: dedicated, but shared.

    haha,

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • @AnthonySmith said: The point is not if and when Linux Swaps ram. the point is that this shows if the host node has swapped out your active ram that has been dedicated to the container, i.e. the host node has no option but to move 100mb of your 256mb active commit on your 2GB box in to swap on the host node which would be transparent on the container otherwise (apart from performance)

    But in the case I described, it's not active ram, it's ram consumed by idle processes that gets swapped out over time. Try installing AMP in a OpenVZ VM (with guaranteed/burst) and leave it idle for a few days, then check....

  • concerto49concerto49 Member
    edited February 2013

    @Jacob said: I would say overselling 50-60% of RAM is sensible, as I can imagine others go for the 80% mark.

    30-40GB from 16GB is ~250% right?

    Serving you the best VPS, Web hosting, dedicated servers and more - Cloud Shards | Query Foundry
    We operate the network AS62638 | Available in Syd AU and Dallas, Los Angeles and NYC USA
  • @concerto49 said: 30-40GB from 16GB is ~250% right?

    haha again, this guy cracks me up, the count to 3 rule now has a place.

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • @AnthonySmith said: haha again, this guy cracks me up, the count to 3 rule now has a place.

    Sorry what did I do?

    You have 16GB of RAM. You over allocate to say 40GB. That's 250% more than what you have. That's how I see it. Not I want to allocate 40GB and assume 20GB might get used.

    From a risk management perspective it's about how much more you're selling and pushing it over and how risky it is, not what might get used up.

    Serving you the best VPS, Web hosting, dedicated servers and more - Cloud Shards | Query Foundry
    We operate the network AS62638 | Available in Syd AU and Dallas, Los Angeles and NYC USA
  • @concerto49

    sorry, nothing I was laughing to much to form a good sentence. That was me laughing at Jacob again after you pointed out his obvious contradiction and saying he should count to 3 before posting :)

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • @Jacob
    Thank your for sharing some real numbers. 30-40GB on 16GB.
    I was guessing that 50% mark. And if I look to my vps systems that might be right. I hardly ever use the "burst RAM" because it is not a guaranteed resource.

    E.g. for my new buyvm box: I am allowed to use 128 MB of RAM but I am able to use up to 256 MB for a .. short period ... of time.

    Or how should "burst memory" be defined?
    Use it as long as no one else use it?

    For me its fine because I do not have to shut down any service to do an apt-get upgrade. That is my main use for "bust memory". And I think it is the main purpose, or?

    wlanboy.com - a twitter archive dedicated to vps providers

  • @concerto49 There is always one, It was also posted from my phone.

    Back ontopic though, I would be interested to hear other providers numbers or is it top secret? ;)

    AboveClouds • UK Company • UK Datacentre • UK Customer Support

    High Performance Pure SSD Cloud Hosting with a personal touch

  • My figures are:

    1GB Ram reserved for the host OS per 16GB

    On a 32GB Node I sell 30GB of ram.

    So that is dedicated 1:1 pre allocated Ram.

    Mem: 33531696k total, 32828808k used, 702888k free 
    

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

  • OpenVZ, silly...

    @AnthonySmith said: So that is dedicated 1:1 pre allocated Ram.

    AboveClouds • UK Company • UK Datacentre • UK Customer Support

    High Performance Pure SSD Cloud Hosting with a personal touch

  • @Jacob said: OpenVZ, silly...

    I think it is yes but some people seem to like it :)

    I am no longer active here, find me at https://talk.lowendspirit.com (Just like LET without the scams)

Sign In or Register to comment.