High Memory Usage, Advice appreciated!

Have you used Linode.com VPS Hosting?

  • No, not familiar with them.

    Votes: 9 64.3%
  • Yes, currently hosting with them.

    Votes: 3 21.4%
  • Yes, but switched to someone else

    Votes: 2 14.3%

  • Total voters
    14

sdrawkcab

Verified User
Joined
Aug 18, 2009
Messages
26
Hello. I am using a VPS from Linode.com, with 360MB memory, and 4 separate Quad-Core CPU's. After a hard reboot, only five minutes later, My CentOS 5.3_x86-64 setup is up to using 355MB of 360 Available (virtually dedicated) memory. Worth noting, My CentOS was installed with bare minimum setup, and officially setup by DirectAdmin technical support themselves.

With the current problem, I can get the box to function decently for about 24 hours, but then have to do a reboot as the responsiveness deteriorates rapidly after that amount of time with the current ongoing problem, slowing down every service, even SSH. I've had my hosting provider verify that it is not a network issue at the link layer, but the issue does reside on my software configuration.

As I'm no linux guru, and still learning, I would appreciate any advice or suggestions on how to better troubleshoot the issue. I've noticed that apache is running with consistently high memory usage without my understanding why.

Many thanks for your time.

I've included the pastes from a few diagnostics below.

Code:
[root@server /]# free -m
             total       used       free     shared    buffers     cached
Mem:           360        355          4          0         10         47
-/+ buffers/cache:        297         62
Swap:          511        283        228
Code:
[root@server /]# vmstat 1 30
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 274000  26724   2184  35448   33   41    98    56   42   32  0  0 96  3  0
 0  0 274000  26740   2192  35440    0    0     0    56   39   31  0  0 100  0  0
 0  0 274000  26740   2192  35448    0    0     0     0   19   28  0  0 100  0  0
 0  0 273804  25576   2224  35508 1112    0  1216     0  165  148  0  0 89 11  0
 0  0 273796  25576   2224  35548   32    0    44     0   49   38  0  0 100  0  0
 0  0 273796  25576   2224  35548    0    0     0     0   17   20  0  0 100  0  0
 0  0 273796  25576   2224  35548    0    0     0     0   22   32  0  0 100  0  0
 0  0 273796  25576   2224  35548    0    0     0     0   17   18  0  0 100  0  0
 0  0 273796  25516   2232  35540    0    0     0    48   25   36  0  0 100  0  0
 0  0 273796  25516   2232  35540    0    0     0     0   19   20  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   21   30  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   27   26  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   41   28  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   19   18  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   19   28  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   24   22  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   23   32  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   15   18  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   26   32  0  0 100  0  0
 0  0 273796  25516   2232  35548    0    0     0     0   18   20  0  0 100  0  0
 0  0 273796  25516   2240  35540    0    0     0    12   25   36  0  0 100  0  0
 0  0 273796  25516   2240  35540    0    0     0     4   26   26  0  0 100  0  0
 0  1 273792  25516   2240  35540   12    0    12     0   42   37  0  0 99  1  0
 0  0 271380  22504   2240  35544 2632    0  2632     0  755  467  9  1 81  9  0
 0  0 271380  22504   2240  35548    0    0     0     0   35   39  0  0 100  0  0
 0  0 271380  22504   2240  35548    0    0     0     0   19   20  0  0 100  0  0
 0  0 271380  22504   2240  35548    0    0     0   256   81   32  0  0 100  0  0
 0  0 271380  22504   2248  35540    0    0     0   244   28   26  0  0 100  0  0
 0  0 271380  22504   2248  35548    0    0     0     0   20   28  0  0 100  0  0
 0  0 271380  22504   2248  35548    0    0     0     0   16   20  0  0 100  0  0
Code:
[root@server /]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1  10344   580 ?        Ss   02:04   0:00 init [3]
root         2  0.0  0.0      0     0 ?        S    02:04   0:00 [migration/0]
root         3  0.0  0.0      0     0 ?        SN   02:04   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    02:04   0:00 [migration/1]
root         5  0.0  0.0      0     0 ?        SN   02:04   0:00 [ksoftirqd/1]
root         6  0.0  0.0      0     0 ?        S    02:04   0:00 [migration/2]
root         7  0.0  0.0      0     0 ?        SN   02:04   0:00 [ksoftirqd/2]
root         8  0.0  0.0      0     0 ?        S    02:04   0:00 [migration/3]
root         9  0.0  0.0      0     0 ?        SN   02:04   0:00 [ksoftirqd/3]
root        10  0.0  0.0      0     0 ?        S<   02:04   0:00 [events/0]
root        11  0.0  0.0      0     0 ?        S<   02:04   0:00 [events/1]
root        12  0.0  0.0      0     0 ?        S<   02:04   0:00 [events/2]
root        13  0.0  0.0      0     0 ?        S<   02:04   0:00 [events/3]
root        14  0.0  0.0      0     0 ?        S<   02:04   0:00 [khelper]
root        15  0.0  0.0      0     0 ?        S<   02:04   0:00 [kthread]
root        17  0.0  0.0      0     0 ?        S<   02:04   0:00 [xenwatch]
root        18  0.0  0.0      0     0 ?        S<   02:04   0:00 [xenbus]
root        27  0.0  0.0      0     0 ?        S<   02:04   0:00 [kblockd/0]
root        28  0.0  0.0      0     0 ?        S<   02:04   0:00 [kblockd/1]
root        29  0.0  0.0      0     0 ?        S<   02:04   0:00 [kblockd/2]
root        30  0.0  0.0      0     0 ?        S<   02:04   0:00 [kblockd/3]
root        32  0.0  0.0      0     0 ?        S<   02:04   0:00 [kseriod]
root       104  0.0  0.0      0     0 ?        S    02:04   0:00 [pdflush]
root       105  0.0  0.0      0     0 ?        S    02:04   0:00 [pdflush]
root       106  0.0  0.0      0     0 ?        S<   02:04   0:01 [kswapd0]
root       107  0.0  0.0      0     0 ?        S<   02:04   0:00 [aio/0]
root       108  0.0  0.0      0     0 ?        S<   02:04   0:00 [aio/1]
root       109  0.0  0.0      0     0 ?        S<   02:04   0:00 [aio/2]
root       110  0.0  0.0      0     0 ?        S<   02:04   0:00 [aio/3]
root       112  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsIO]
root       113  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsCommit]
root       114  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsCommit]
root       115  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsCommit]
root       116  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsCommit]
root       117  0.0  0.0      0     0 ?        S<   02:04   0:00 [jfsSync]
root       118  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfslogd/0]
root       119  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfslogd/1]
root       120  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfslogd/2]
root       121  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfslogd/3]
root       122  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfsdatad/0]
root       123  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfsdatad/1]
root       124  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfsdatad/2]
root       125  0.0  0.0      0     0 ?        S<   02:04   0:00 [xfsdatad/3]
root       734  0.0  0.0      0     0 ?        S<   02:04   0:00 [net_accel/0]
root       735  0.0  0.0      0     0 ?        S<   02:04   0:00 [net_accel/1]
root       736  0.0  0.0      0     0 ?        S<   02:04   0:00 [net_accel/2]
root       737  0.0  0.0      0     0 ?        S<   02:04   0:00 [net_accel/3]
root       744  0.0  0.0      0     0 ?        S<   02:04   0:00 [kpsmoused]
root       748  0.0  0.0      0     0 ?        S<   02:04   0:00 [kcryptd/0]
root       749  0.0  0.0      0     0 ?        S<   02:04   0:00 [kcryptd/1]
root       750  0.0  0.0      0     0 ?        S<   02:04   0:00 [kcryptd/2]
root       751  0.0  0.0      0     0 ?        S<   02:04   0:00 [kcryptd/3]
root       752  0.0  0.0      0     0 ?        S<   02:04   0:00 [kmirrord]
root       762  0.0  0.0      0     0 ?        S<   02:04   0:00 [kjournald]
root       830  0.0  0.0  12604   356 ?        S<s  02:04   0:00 /sbin/udevd -d
root      2401  0.0  0.0   6736   140 ?        Ss   02:04   0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-
root      2553  0.0  0.1   5908   520 ?        Ss   02:04   0:00 syslogd -m 0
root      2556  0.0  0.0   3800   324 ?        Ss   02:04   0:00 klogd -x
root      2567  0.0  0.0  10728   316 ?        Ss   02:04   0:00 irqbalance
rpc       2586  0.0  0.1   8048   408 ?        Ss   02:04   0:00 portmap
rpcuser   2610  0.0  0.1  10140   520 ?        Ss   02:04   0:00 rpc.statd
dbus      2658  0.0  0.1  21256   636 ?        Ss   02:04   0:00 dbus-daemon --system
root      2720  0.0  0.1  18992   512 ?        Ssl  02:04   0:00 pcscd
root      2761  0.0  0.1   6072   468 ?        Ss   02:04   0:00 dovecot
root      2763  0.0  0.2  10776  1004 ?        S    02:04   0:00 dovecot-auth
dovecot   3029  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3030  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3031  0.0  0.4  33872  1484 ?        S    02:04   0:00 pop3-login
dovecot   3033  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3035  0.0  0.4  33872  1484 ?        S    02:04   0:00 pop3-login
dovecot   3036  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3038  0.0  0.4  33868  1520 ?        S    02:04   0:00 pop3-login
dovecot   3039  0.0  0.4  33872  1484 ?        S    02:04   0:00 pop3-login
dovecot   3040  0.0  0.4  33872  1484 ?        S    02:04   0:00 pop3-login
dovecot   3041  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3042  0.0  0.4  33868  1484 ?        S    02:04   0:00 pop3-login
dovecot   3043  0.0  0.4  33872  1484 ?        S    02:04   0:00 pop3-login
dovecot   3045  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3046  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3047  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3048  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3049  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3050  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3051  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3052  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3053  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3054  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3055  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3056  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3057  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3058  0.0  0.3  33880  1448 ?        S    02:04   0:00 imap-login
dovecot   3059  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
dovecot   3060  0.0  0.3  33884  1448 ?        S    02:04   0:00 imap-login
root      7255  0.0  0.1  60536   664 ?        Ss   02:04   0:00 /usr/sbin/sshd
root      7265  0.0  0.2 135436   928 ?        Ss   02:04   0:00 cupsd
root      7278  0.0  0.1  21644   512 ?        Ss   02:04   0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
ntp       7291  0.0  1.3  23396  5032 ?        SLs  02:04   0:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root      7303  0.0  0.2  65952  1012 ?        S    02:04   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysq
mysql     7326  0.0  1.6 197572  6140 ?        Sl   02:04   0:01 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysq
mail      7377  0.0  0.1  54588   648 ?        Ss   02:04   0:00 /usr/sbin/exim -bd -q15m -oP /var/run/exim.pid
root      7382  0.0  0.7 156376  2732 ?        Ss   02:04   0:00 /usr/bin/spamd -d -c -m 5
root      7399  0.0  0.3 156376  1416 ?        S    02:04   0:00 spamd child
root      7400  0.0  0.3 156376  1424 ?        S    02:04   0:00 spamd child
ftp       7411  0.0  0.1  13128   428 ?        Ss   02:04   0:00 proftpd: (accepting connections)
root      7421  0.0  0.2  74836   952 ?        Ss   02:04   0:00 crond
xfs       7441  0.0  0.1  20248   580 ?        Ss   02:04   0:00 xfs -droppriv -daemon
root      7460  0.0  0.0  18736   348 ?        Ss   02:04   0:00 /usr/sbin/atd
avahi     7480  0.0  0.2  23280   960 ?        Ss   02:04   0:00 avahi-daemon: running [server.local]
avahi     7481  0.0  0.0  23148   132 ?        Ss   02:04   0:00 avahi-daemon: chroot helper
68        7491  0.0  0.2  32156  1012 ?        Ss   02:04   0:00 hald
root      7492  0.0  0.1  21692   540 ?        S    02:04   0:00 hald-runner
root      7517  0.0  0.8 259752  3172 ?        SN   02:05   0:00 /usr/bin/python -tt /usr/sbin/yum-updatesd
root      7519  0.0  0.2  13044   864 ?        SN   02:05   0:00 /usr/libexec/gam_server
named     7543  0.0  0.4 172232  1820 ?        Ssl  02:05   0:00 named -u named
root      7574  0.0  0.0  18412   240 ?        S    02:05   0:00 /usr/sbin/smartd -q never
root      7579  0.0  0.3  48704  1328 ?        Ss   02:05   0:00 /usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/w
root      7582  0.0  0.1   3792   400 tty1     Ss+  02:05   0:00 /sbin/mingetty tty1
root      7810  0.0  0.6  88088  2508 ?        Ss   02:10   0:00 sshd: root@pts/0
root      7909  0.0  0.2  66088  1044 pts/0    Ss+  02:10   0:00 -bash
root      8730  0.0  0.0   1232   152 ?        Ss   02:32   0:00 /usr/local/directadmin/da-popb4smtp
nobody    8760  0.0  0.3  54716  1200 ?        Ss   02:32   0:00 /usr/local/directadmin/directadmin d
root      8895  0.0  1.3 101644  5028 ?        Ss   02:36   0:00 /usr/sbin/httpd -k start -DSSL
apache    8933  0.1  4.7 130360 17340 ?        S    02:37   0:02 /usr/sbin/httpd -k start -DSSL
apache    8935  0.0  9.3 130360 34472 ?        S    02:37   0:02 /usr/sbin/httpd -k start -DSSL
apache    8936  0.0  9.1 184720 33652 ?        S    02:37   0:01 /usr/sbin/httpd -k start -DSSL
apache    8937  0.0  3.6 130360 13620 ?        S    02:37   0:01 /usr/sbin/httpd -k start -DSSL
apache    9261  0.0  5.4 133284 20200 ?        S    02:43   0:01 /usr/sbin/httpd -k start -DSSL
apache    9264  0.0  8.6 184728 31868 ?        S    02:43   0:01 /usr/sbin/httpd -k start -DSSL
dovecot   9340  0.0  0.4  33872  1612 ?        S    02:45   0:00 pop3-login
apache    9394  0.0  9.2 132488 33944 ?        S    02:46   0:01 /usr/sbin/httpd -k start -DSSL
apache    9422  0.0  7.7 179176 28508 ?        S    02:47   0:00 /usr/sbin/httpd -k start -DSSL
root      9450  0.0  0.6  88088  2476 ?        Ss   02:48   0:00 sshd: root@pts/1
root      9461  0.0  0.3  66084  1416 pts/1    Ss   02:48   0:00 -bash
dovecot   9719  0.0  0.4  33868  1620 ?        S    02:50   0:00 pop3-login
apache    9866  0.0  6.4 135552 23704 ?        S    02:54   0:00 /usr/sbin/httpd -k start -DSSL
apache   10109  0.0  8.5 130188 31540 ?        S    02:59   0:00 /usr/sbin/httpd -k start -DSSL
nobody   12432  0.0  0.0  54716   352 ?        S    03:04   0:00 /usr/local/directadmin/directadmin d
nobody   12577  0.0  0.0  54716   352 ?        S    03:06   0:00 /usr/local/directadmin/directadmin d
nobody   12578  0.0  0.0  54716   352 ?        S    03:06   0:00 /usr/local/directadmin/directadmin d
nobody   12636  0.0  0.0  54716   352 ?        S    03:08   0:00 /usr/local/directadmin/directadmin d
nobody   12637  0.0  0.0  54716   352 ?        S    03:08   0:00 /usr/local/directadmin/directadmin d
dovecot  12638  0.0  0.5  33872  2176 ?        S    03:08   0:00 pop3-login
dovecot  12639  0.0  0.5  33872  2172 ?        S    03:08   0:00 pop3-login
root     18410  0.0  0.2  65612   980 pts/1    R+   03:12   0:00 ps aux
 

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
360mb of ram is not enough to run a decent site, let alone a control panel.
 

massive

Verified User
Joined
Feb 16, 2006
Messages
307
I have 20 sites with 30000+ visits per month (in total) in a 512mb ram vps with no problem at all.
 

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
That's 512, it can be done with 512, and technically it can be done with 360 too, but you will need to tweak a few things to get the memory useage down a little.
 

Rich-Boy

Verified User
Joined
Jan 24, 2006
Messages
223
Taken directly from http://help.directadmin.com/item.php?id=195
The system says shows that I have used up all my ram, should I be concerned?
Unix (Linux/FreeBSD) boxes can often cause confusion with memory usage. If you run "top", it will normally show you that about 98% of the memory has been used up. This is actually normal and no, you probably have not run out of ram. Unix is always doing it's own internal house keeping with the system, thus will use up the avaiable memory to do so. If a real program is started up and it needs that memory, the house keeping tasks are instantly dropped and that memory is freed up for the program that needs it.

You only have to be concerned with memory usage once your swap memory starts to grow. If the swap usage is less than about 10 meg and isn't moving or growing, then you're still in the green. Only once you see your swap memory usage starting to climb to you have to worry. If that happens, then you either need more ram, or else one of your programs is chewing up memory quickly due to heavy system load (eg, volumes of mysql queries) or possibly program memory leaks. Sometimes restarting apache and mysql can reduce the amount of memory used, but it will usually grow back up to where it was over time.
I would be concerned about the amount of swap memory being used, it is possible that you are running too much on the server for the amount of ram it has. The periods of unresponsiveness, however, I would suggest are more likely to be the cause of another vps on the root server crashing, getting ddos'd or something similar. If you regularly loose contact with your server even when you are not running much then I would consider asking to be placed on another of your provider's servers if possible or a complete change or provider.

I can recommend the use of several other tools also;

A more informative version of top, htop, is useful for identifying resource hogging programs so you could try installing this. Similarly to see the amount of memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:
Code:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr | less
Keep tabs on how many hits each of your websites are getting in real time using Apache's server-status module by adding the following to your httpd.conf and navigating to http://your.ip/secret-status
Code:
ExtendedStatus On
<Location /secret-status>
    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
</Location>
I hope this helps
 
Last edited:

sdrawkcab

Verified User
Joined
Aug 18, 2009
Messages
26
Thanks for that valuable information Rich-Boy. I appreciate it.

Sometimes restarting apache and mysql can reduce the amount of memory used, but it will usually grow back up to where it was over time.
This is what I'm seeing... I have to restart the apache services between in intervals ranging from 24 hours to 5 days before the server as a whole becomes very slow to respond.

If this is the case, restarting is only a "bandaid" fix, and not the real solution. Do you have any advice for determining the root cause of apache climbing up higher and higher with the memory usage?
 

sdrawkcab

Verified User
Joined
Aug 18, 2009
Messages
26
That's 512, it can be done with 512, and technically it can be done with 360 too, but you will need to tweak a few things to get the memory useage down a little.
I'm definitely interested in getting my memory usage down. As I don't want to go about tweaking things the wrong way, do you have any advice on where to begin with this to make the necessary configuration tweaks properly, so as to not adversely affect my server and it's services as a whole?
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
I agree that 360mb isn't enough, possibly not even for one site, unless it's pure html with no mysql, perl, php, etc. Note that your description of the amount of processors is totally immaterial; your VPS is getting only a small part of one processor.

Jeff
 

sdrawkcab

Verified User
Joined
Aug 18, 2009
Messages
26
I agree that 360mb isn't enough, possibly not even for one site, unless it's pure html with no mysql, perl, php, etc. Note that your description of the amount of processors is totally immaterial; your VPS is getting only a small part of one processor.

Jeff
Hello Jeff, while a good typical assumption, I don't believe it to be completely accurate in my scenario, as Linode states this...

How do I get my fair share of CPU?

We limit the number of Linodes placed on each host machine. We also only place one plan type on each host. In the worst-case scenario, you're splitting CPU time evenly with your fellow Linoders, but are still able to use the full potential of the host if others are idle.
Talking with Linode support they've informed me that the CPU utilization graphs based on logs in 5 minute intervals shows the host machine rarely averaging anything above an idle. When my server becomes almost unresponsively slow, I've seen my OS instance burn up all 4 host machine CPU's from their visual logs, when my server instance slugs along (obviously something wrong there with my config) to cause it to do such.
 

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
Taken directly from http://help.directadmin.com/item.php?id=195


I would be concerned about the amount of swap memory being used, it is possible that you are running too much on the server for the amount of ram it has. The periods of unresponsiveness, however, I would suggest are more likely to be the cause of another vps on the root server crashing, getting ddos'd or something similar. If you regularly loose contact with your server even when you are not running much then I would consider asking to be placed on another of your provider's servers if possible or a complete change or provider.

I can recommend the use of several other tools also;

A more informative version of top, htop, is useful for identifying resource hogging programs so you could try installing this. Similarly to see the amount of memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:
Code:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr | less
Keep tabs on how many hits each of your websites are getting in real time using Apache's server-status module by adding the following to your httpd.conf and navigating to http://your.ip/secret-status
Code:
ExtendedStatus On
<Location /secret-status>
    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
</Location>
I hope this helps
A VPS will not act the same way, in most cases it the memory displayed is what it's actually using at that moment.... it's not like a dedicated server in this manner.

Of course it all depends on what VS it's running on and how it's configured, but most do work this way.
 

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
I'm definitely interested in getting my memory usage down. As I don't want to go about tweaking things the wrong way, do you have any advice on where to begin with this to make the necessary configuration tweaks properly, so as to not adversely affect my server and it's services as a whole?
The two biggest issues are mysql and alpache..

Try this mysql file and see how it performs, then try tweaking httpd as well.

PHP:
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-bdb
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
After you setup the above my.cnf file, post up your apache settings and we can see what is needed.
 

Rich-Boy

Verified User
Joined
Jan 24, 2006
Messages
223
A VPS will not act the same way, in most cases it the memory displayed is what it's actually using at that moment.... it's not like a dedicated server in this manner.

Of course it all depends on what VS it's running on and how it's configured, but most do work this way.
This is true however a vps should not be running with that much swap being used
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Hello Jeff, while a good typical assumption, I don't believe it to be completely accurate in my scenario
I won't argue with them, they know more about their setup than I do.

However I do wonder how this affects apache (and possibly your problem).

Apache2 will use multiple cores for multiple processes. It would be very easy for one VPS's apache run to hold on to all cores in this scenario.

Or am I wrong?

Jeff
 

sdrawkcab

Verified User
Joined
Aug 18, 2009
Messages
26
But when I look to the Stars... I feel like myself.

So I ran "top" to check the memory usage in real time when I noticed the machine was preforming slowly. This allowed me to trace the issue to specifically MySQL.

I checked the MySQL configuration, and It was empty, and no default configuration had been setup yet. I copied over the "large" configuration file shipped with MySQL, which was for machines with 512MB of memory dedicated to mostly MySQL processing.

I then upgraded my VPS to 720MB Ram, and performance has seen a night to day improvement.

I did notice after a few days that the new VPS host machine that I got moved to for the upgrade was not running stable. It had rebooted my instance on it's own, as well as was not responding properly to commands and instructions from the Xen Visualization software. After discussing this with my VPS provider, they investigated and moved me to a new host machine, and I've been running stable and responsive since.

Thanks for your input everyone. For purpose of reference of anyone looking at a similar issue in the future; In summary this particular issue can be traced to a few things in the following list.

-Limited Physical Memory
-No MySQL (my.conf) installed.
-Unstable Host machine
 

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
Most likely it was an over loaded box to start with... more often then not you will see this in time with most companies.... they should be monitoring this though and migrating as needed to ensure a proper load. Most of the time it's the squeaky wheel that get's moved and if you never say anything they will leave it as is.
 

tillo

Verified User
Joined
Oct 28, 2007
Messages
862
Location
Switzerland
You shouldn't use the 512MB-dedicated MySQL example config on a 720MB VPS; some time in the future MySQL is going to use that much memory and you will have problems again.
Use the config with smallest cache values available, the most non-optimized one. You can't optimize and bring down CPU and disk IO loads without RAM, it's just not possible.

Also, for the one suggesting XCache... that's an opcode cacher, it uses RAM to avoid CPU and disk IO loads. It's the same thing, if you setup any cache it will just make it worse.

Also, I wouldn't use CentOS on a VPS... I'd use Debian or Gentoo to achieve a smaller base system (disk space, RAM, loads...). But that's me, others may disagree.
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Also, I wouldn't use CentOS on a VPS... I'd use Debian or Gentoo to achieve a smaller base system
Do you support DirectAdmin on Gentoo?

We do very minimal CentOS installs; we install from the Installation CDROM only some of the server selections; we deselect a lot and select nothing else.

Then we run a simple yum script which updates the box and gives us all the other packages DirectAdmin needs.

But for one of our routers: freeBSD running on a 128mb solid state drive. ;)

Jeff
 
Top