Normal VPS RAM usage, XEN Vs OpenVZ ?

Discussion in 'Site & Server Administration' started by Jezz, Sep 13, 2008.

  1. #1
    At the moment I have two VPS servers,
    I'll name them Xen and Hyper for this discussion.

    Both of them have Centos 4.5 as the operating systems

    Xen uses Apache and Bind. Has 256mb Ram and 544mb swap partition (no burst ram)

    Hyper uses Lightpd and Tiny Dns. Has 256mb Ram and 128mb Burst Ram (no swap)

    Now, I've recently moved my sites over to Hyper, And I estimate due too promotion that my traffic has doubled since the move.
    I've been having a stability problem with Lightpd and thanks to some help from some guys Here we have established that I need more ram on this machine.

    Now getting to the point:
    Xen was my first VPS, From the first time I ever logged in, with no dns/domains/traffic the ram usage was in the orange.
    about 150mb from memory. I didn't know how much ram the op system is supposed to use etc.
    But now that I have Hyper when I first logged in there was only about 70mb used.
    I realize that there are vast differences between these two machines though, And this is the reason for my post.

    There is still one site hooked up to Xen the moment, but it's a very small forum with practically no traffic.
    Logging in now, Lxadmin reports ram usage of 224mb

    [​IMG]

    the output from 'ps aux' for Xen is:

    
    USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.2  2560  540 ?        S    Sep06   0:00 init [3]
    root         2  0.0  0.0     0    0 ?        S    Sep06   0:00 [migration/0]
    root         3  0.0  0.0     0    0 ?        SN   Sep06   0:00 [ksoftirqd/0]
    root         4  0.0  0.0     0    0 ?        S<   Sep06   0:00 [events/0]
    root         5  0.0  0.0     0    0 ?        S<   Sep06   0:00 [khelper]
    root         6  0.0  0.0     0    0 ?        S<   Sep06   0:00 [kthread]
    root         7  0.0  0.0     0    0 ?        S<   Sep06   0:00 [xenwatch]
    root         8  0.0  0.0     0    0 ?        S<   Sep06   0:00 [xenbus]
    root        12  0.0  0.0     0    0 ?        S<   Sep06   0:00 [kblockd/0]
    root        29  0.0  0.0     0    0 ?        S    Sep06   0:00 [pdflush]
    root        30  0.0  0.0     0    0 ?        S    Sep06   0:00 [pdflush]
    root        31  0.0  0.0     0    0 ?        S    Sep06   0:00 [kswapd0]
    root        32  0.0  0.0     0    0 ?        S<   Sep06   0:00 [aio/0]
    root       174  0.0  0.0     0    0 ?        S    Sep06   0:00 [kseriod]
    root       281  0.0  0.0     0    0 ?        S    Sep06   0:00 [kjournald]
    root       454  0.0  0.0     0    0 ?        S<   Sep06   0:00 [kauditd]
    root       793  0.0  0.1  2416  428 ?        S<s  Sep06   0:00 udevd
    root       921  0.0  0.0     0    0 ?        S    Sep06   0:00 [kjournald]
    root      1247  0.0  0.2  3364  544 ?        Ss   Sep06   0:00 syslogd -m 0
    root      1251  0.0  0.1  2096  384 ?        Ss   Sep06   0:00 klogd -x
    named     1276  0.0  1.1 37660 2944 ?        Ssl  Sep06   0:00 /usr/sbin/named -
    rpc       1322  0.0  0.2  1944  532 ?        Ss   Sep06   0:00 portmap
    rpcuser   1341  0.0  0.2  1860  712 ?        Ss   Sep06   0:00 rpc.statd
    root      1413  0.0  0.1  5240  376 ?        Ss   Sep06   0:00 rpc.idmapd
    root      1525  0.0  0.4  5916 1164 ?        Ss   Sep06   0:01 /usr/sbin/sshd
    root      1538  0.0  0.3  2752  796 ?        Ss   Sep06   0:00 xinetd -stayalive
    root      1551  0.0  0.1  2364  448 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1553  0.0  0.0  2928  212 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1560  0.0  0.1  3372  444 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1563  0.0  0.0  2432  212 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1567  0.0  0.1  2872  468 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1569  0.0  0.1  3164  396 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1575  0.0  0.1  2660  448 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1577  0.0  0.0  1704  208 ?        S    Sep06   0:00 /usr/lib/courier-
    root      1616  0.0  0.1  1936  336 ?        Ss   Sep06   0:00 gpm -m /dev/input
    root      1897  0.0  0.4  5768 1236 ?        S    Sep06   0:00 /bin/sh /usr/bin/
    mysql     1943  0.0  2.0 25112 5372 ?        Sl   Sep06   0:14 /usr/libexec/mysq
    qmails    1969  0.0  0.1  2864  392 ?        S    Sep06   0:00 qmail-send
    qmaill    1976  0.0  0.1  2160  420 ?        S    Sep06   0:00 splogger qmail
    root      1977  0.0  0.1  2952  328 ?        S    Sep06   0:00 qmail-lspawn |pre
    qmailr    1978  0.0  0.1  2568  348 ?        S    Sep06   0:00 qmail-rspawn
    qmailq    1981  0.0  0.1  2500  324 ?        S    Sep06   0:00 qmail-clean
    root      1982  0.0  0.3  6280  928 ?        Ss   Sep06   0:02 crond
    root      2000  0.0  0.1  2380  416 ?        Ss   Sep06   0:00 /usr/sbin/atd
    dbus      2013  0.0  0.3  3132  796 ?        Ss   Sep06   0:00 dbus-daemon-1 --s
    root      2035  0.0  0.8  5080 2112 ?        Ss   Sep06   0:00 hald
    root      2042  0.0  0.1  2256  460 xvc0     Ss+  Sep06   0:00 /sbin/agetty xvc0
    root      3739  0.0  5.6 27752 14840 ?       Ss   Sep06   0:00 /usr/sbin/httpd
    root      4731  0.0  0.8  7564 2320 ?        Ss   09:45   0:00 sshd: root@pts/0
    root      4733  0.0  0.5  5740 1384 pts/0    Ss+  09:45   0:00 -bash
    lxlabs    4838  0.0  0.6  4532 1820 ?        S    Sep06   0:00 /usr/local/lxlabs
    apache    5589  0.0  4.7 27884 12376 ?       S    10:03   0:00 /usr/sbin/httpd
    root     11829  0.0  0.8  8212 2300 ?        Ss   12:18   0:00 sshd: root@pts/1
    root     11831  0.0  0.5  6096 1376 pts/1    Ss   12:18   0:00 -bash
    root     11956  0.0  0.2  3004  768 pts/1    R+   12:20   0:00 ps aux
    root     23130  0.0  0.7  8996 1992 ?        Ss   04:02   0:00 cupsd
    apache   23178  0.0  4.9 28128 13028 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23179  0.0  4.9 28124 13004 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23180  0.0  4.9 28128 13028 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23181  0.0  4.9 28128 13040 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23182  0.0  4.9 28120 13020 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23183  0.0  4.9 28112 13000 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23184  0.0  4.9 28164 13056 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23185  0.0  4.9 28124 13044 ?       S    04:02   0:00 /usr/sbin/httpd
    apache   23657  0.0  4.9 28164 13088 ?       S    04:47   0:00 /usr/sbin/httpd
    apache   23658  0.0  4.9 28120 13012 ?       S    04:47   0:00 /usr/sbin/httpd
    apache   23659  0.0  4.9 28132 13040 ?       S    04:47   0:00 /usr/sbin/httpd
    
    Code (markup):
    With XEN ram is supposed to be pre allocated so...
    Where has my ram gone? lol
    And should there be so many instances of apache?

    Or... is this normal for a XEN setup?

    Rebooting Xen Now to see Ram usage once it restarts...
    Its back with only 132mb used (this will slowly creep up again though)
    showing 8 instances of Apache.

    Thanks in advance for any help in making sense of this :)
     
    Jezz, Sep 13, 2008 IP
  2. yyahmee

    yyahmee Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've seen Apache use almost all of my memory under my dedicated server.
    Maybe Apache and Lighttpd has something to do with your issue here.
     
    yyahmee, Sep 13, 2008 IP
  3. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks yyahmee,
    Maybe this is normal for Apache?
    Maybe that's why I have such a huge ram usage difference between the two.
    In anycase I think it's obvious that I will need to get more ram.
    But I'd really like to know if this is normal for a XEN and Apache VPS with lxadim.
     
    Jezz, Sep 13, 2008 IP
  4. yyahmee

    yyahmee Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    HP's OpenVZ and Xen comparison showed that Xen used more RAM then OpenVZ but I don't know by how much.
    Try putting Lighttpd and see if the RAM usage changes ;)
     
    yyahmee, Sep 13, 2008 IP
  5. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #5
    hmm... I am not sure if I can do this with lxadmin.
    I'll have a look though :)
    the OpenVZ one is the one that I'm keeping, But I still want to get a handle on this, so that I know what's normal :cool:
     
    Jezz, Sep 13, 2008 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    If you type free -m in ssh as root you will see cache memory thats said to be the real memory usage
     
    Bohra, Sep 13, 2008 IP
  7. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #7
    that could be a clue.

    On the Apache Machine (no traffic):
    
                                  total       used       free     shared    buffers     cached
    Mem:                          256         144        111          0         20         64
    -/+ buffers/cache:                        60         195
    Swap:                         543         0          543
    
    
    Code (markup):
    And the Lightpd Machine (with traffic):
    
                                  total       used       free     shared    buffers     cached
    Mem:                           325        143        181          0          0          0
    -/+ buffers/cache:                        143        181
    Swap:                            0          0          0
    
    Code (markup):
    So maybe this has something to do with buffers/cache.
     
    Jezz, Sep 13, 2008 IP
  8. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #8
    Ok... I found out how to swap my new vps to Apache
    And all my ram is gone on this machine as well... lol
    Which makes me just a little embarrassed about this thread :eek:

    Well, I've got to learn somehow... and before I had nothing to compare it with.
    So, for any other Noobs out there thinking about a VPS for proxy hosting...
    256mb ram, even with another 128mb burst is just not enough! :eek:
     
    Jezz, Sep 17, 2008 IP
  9. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #9
    The purpose of RAM is to avoid use of swap and reduce HDD access as much as possible.
    A good OS / server environment makes use of all RAM whenever possible. Hence the more RAM you have - the more RAM will be "gone" ( used ) - at the benefit of reduced access times for data and reduced wear and tear for hard drives.

    example:
    on my "workhorse" -laptop, an acer ferrari 5000, i have 4 GB ram, I work a lot and have plenty of difference applications open at almost any given time.

    > free -m
    total used free shared buffers cached
    Mem: 3965 3909 56 0 262 1953
    -/+ buffers/cache: 1694 2271
    Swap: 5145 0 5145

    on my server with quiet some traffic ( around 9GB / day with currently daily average of 559303 hits / day I have

    > free -m
    total used free shared buffers cached
    Mem: 2011 1721 289 0 89 1277
    -/+ buffers/cache: 355 1656
    Swap: 2047 0 2047

    Hence in both cases most of the RAM used ... = success!

    both machines are fast and I will definitely have a much larger RAM on my next generation server to speed things up even more and to reduce HDD access further.

    hence for you the RAM used is just 1 factor - the most important however is the access speed / page load speed from your server - including mySQL, CPU and other data to serve pages.
    the only reliable comparison data thus MUST include a test of a sample page loaded under precise condition - that of course also needs to consider your local LAN / WLAN / ISP environment!
     
    hans, Sep 17, 2008 IP
  10. The Universes

    The Universes Peon

    Messages:
    187
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Your running a lot more than just web server + php. Theres a mail server, mysql, bind dns (named), and so on, which all consume a lot of memory. If you strictly ran Lighttpd + PHP + xcache, that would be plenty of RAM for a proxy site. A bare bones CentOS machine uses maybe 50MB of RAM.
     
    The Universes, Sep 18, 2008 IP