managed dedicated server
Virtual Private Server (VPS)
WHM cPanel License
DirectAdmin DA License
ServerTune
Server Management
Colocation Services
Web Hosting
cPanel and DirectAdmin LicensingServer Management PlansVirtual Private ServersDedicated Servers
HOMEAbout ServerTuneContact usHelp Desk/Technical SupportKnowledgebase
cheap dedicated serversSpecial PromotionsReseller's Program managed dedicated serverunmanaged dedicated server
Space
Serious about business? check this out: Issues, Tips, and Solutions
Search:    Advanced search
Browse by category:
| Glossary |
HowTo: determine load and memory usage for your VPS
Printer Friendly
email to a friend
Add comment Add comment
Views: 304
Votes: 0
Comments: 0
Posted: 30 Sep, 2007
by: Support T.
* * * * *
Updated: 30 Sep, 2007
by: Support T.
SSH to the server and run the following commad (one single line):
    grep oomguarpages /proc/user_beancounters | awk '{s=$2;t=$3;u=$4; {print "VPS Memory Usage\nCurrent Held: " s/256 "MB\nMax Held: " t/256 "MB\nBarrier: "u/256"MB" }}'

If you are having problems with memory usage of your VPS, the vast majority of memory conditions reported and are totally normal behavior. The first important thing is that these values are for the entire physical server - so you are actually seeing memeory and swap usage for the physical server that your VPS uses.

If you're used to the way Windows manages memory, you might think that these numbers indicate the system is running out of memory. However, Unix-like operating systems allocate and manage memory very differently.

Basically, any file that is ever read by the operating system is cached in memory to make access to it faster. If you run the command "free" on your VPS, you'll see that there are only 54600 kB of memory is free! But you'll also notice that 1934308 kB are allocated as buffers and cache. This memory is considered "free" - it will get allocated if it is needed. Otherwise, it goes to making the system file access faster.

Unix systems also agressively swap out unused application code. If one of the VPS users has MySQL running, but it hasn't been accessed in a long time, the kernel will swap it out to reclaim the memory. It does this because that memory would be better spent making file access faster than waiting for some rarely used code to run.

In a nutshell, unless you were experiencing serious performance issues, these are just symptoms of the operating system keeping things running as fast as possible!

In our experience, the hardest thing to work around when using a VPS for hosting is limited memory. It's definitely a challenge to try and tune a database, Web server, and application server for load under the constraints of a VPS plan (typically 512 MB or less of RAM). The best solution we came-up with was to use a baseline of about 70% of your guaranteed memory quota when the various servers started up, with 30% of your guaranteed memory free for high traffic situations. This seems to be working for many clients pretty well so far, especially considering that memory usage can theoretically temporarily burst to 300% of guaranteed memory quota.

However hosting in a VPS can present some challenges when trying to determine load and memory usage for your VPS. For instance, when using top, the memory statistics displayed represent the whole server and not your VPS. That said, to get an idea of what your memory usage is, how much have been reserved, and how much your VPS is allowed to burst to, use the following scripts:

    #!/bin/bash
    bean=`cat /proc/user_beancounters`
    guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'`
    burst=`echo "$bean" | grep privvm | awk '{ print $5;}'`
    priv=`echo "$bean" | grep privvm | awk '{ print $2;}'`
    let total=guar/256
    let used=priv/256
    let burst=burst/256
    echo "VPS memory usage:"
    echo "Used: $used MB"
    echo "Total: $total MB"
    echo "Burstable to: $burst MB"
Other articles in this Category
document Downloads
document Documentation and HowTo
document Technical Support
document How can I change my VPS time or timezone?
document Can I install two VPSs with two different Operation Systems such as: Windows OS and Linux OS on the same dedicate server?
document HowTo :: change or add an IP for a VPS
document HowTo :: change the hostname
document HowTo :: starting, stopping, restarting, and querying status of VPS
document HowTo :: Listing existing VPSs



RSS