Wednesday, October 10, 2007

Finding memory usage in Virtuozzo VPS

I have a client who has a VPS at iPowerWeb. I can't say that I'm very thrilled with iPowerWeb, especially after finding javascript trojans scattered on pages throughout their site.

Anyway, I needed to figure out how much memory is available to their VPS. I found some information here about it. I've consolidated the pertinent information below:

Assuming your VPS provider is using UBC memory managment instead of SLM, use this command to get memory details:
cat /proc/user_beancounters
It's not the version, it depends on if your provider is using SLM or UBC memory management for your VPS. If SLM you'll see virtual memory available to your VPS, if UBC you'll see the memory available to the entire node. In this case, the VPS is using UBC (user_beancounters would have some parameters set to unlimited if using SLM).

privvmpages 102169 102687 131072 139264 150550
vmguarpages 0 0 67584 2147483647 0

This means you have 264MB guaranteed memory, 512MB burstable memory. You get these by dividing the number by 1024 (to convert to MB) and multiplying by 4 (as they're measured in 4KB pages on VZ). You should be concerned about the 150550 failcnt in the privvmpages parameter. This means that your VPS is running out of memory.
Here's my client's output:

[root@localhost conf]# cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
377: kmemsize 4721767 4740068 16384000 18022400 0
lockedpages 0 0 4096 4096 0
privvmpages 63893 63930 262144 292912 1
shmpages 5935 5935 131072 131072 0
dummy 0 0 0 0 0
numproc 49 49 400 400 0
physpages 19182 19188 0 2147483647 0
vmguarpages 0 0 36864 2147483647 0
oomguarpages 19182 19188 18432 2147483647 0
numtcpsock 18 18 600 600 0
numflock 11 11 200 210 0
numpty 1 1 48 48 0
numsiginfo 0 0 512 512 0
tcpsndbuf 225836 225836 4300800 6144000 0
tcprcvbuf 351884 351884 4300800 6144000 0
othersockbuf 11180 11180 3072000 5529600 0
dgramrcvbuf 0 0 524288 524288 0
numothersock 16 16 600 600 0
dcachesize 175522 177878 4192304 4317184 0
numfile 2041 2050 8192 8192 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 14 14 128 128 0


So, I calculate that the VPS has 1024MB of burstable memory and only 144MB of guaranteed memory. Not nearly enough to run apache, mysql, and a java servlet engine...

Now, what I don't know for sure is which of those numbers shows the current memory usage.

No comments: