LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-24-2009, 05:18 PM   #1
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 31
Something is eating my memory


I have Debian Lenny (amd64) installed with 16 GB of physical memory and 6 GB of swap space.

I noticed a minor hiccup in the system performance thirty minutes ago and started poking around. If I run 'free -m' it reports:

Code:
             total       used       free     shared    buffers     cached
Mem:         16086      15774        312          0        679       4954
-/+ buffers/cache:      10140       5946
Swap:         5498          0       5498
Am I really using 15.75 GB of physical memory? If I run: 'ps aux' the %MEM for everything is like 0.2

Top isn't suggesting that anything is eating all the memory either:

Code:
top - 17:14:11 up 1 day,  4:30,  7 users,  load average: 1.13, 1.01, 0.91
Tasks: 165 total,   1 running, 164 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.8%sy,  0.0%ni, 99.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  16472844k total, 15903848k used,   568996k free,   700276k buffers
Swap:  5630772k total,      152k used,  5630620k free,  4592376k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4085 root      20   0     0    0    0 S    6  0.0   0:00.18 pdflush
    1 root      20   0 10312  752  620 S    0  0.0   0:01.74 init
Any ideas? This is making me a bit nervous as I just went live with this server yesterday. It ran for months in testing (but with only me using the system) and now it's been running for about 30 hours straight.
 
Old 11-24-2009, 05:23 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
This is to do with the way linux memory management works, I believe. Memory is marked as available when no longer needed but not actually freed until another process requires it. So although it might show 15GB in use, it doesn't mean all that memory is actively being used and other processes can still take it.
 
Old 11-24-2009, 05:25 PM   #3
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Thanks for confirming that. I started to suspect that as I realized it was rather convenient that almost all memory was "used" and yet there was a nice little cushion and the system is functioning (apparently) well.

Is there a way I can check how much is actually used by programs so I can keep an eye on it.
 
Old 11-24-2009, 05:33 PM   #4
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Ah, here is a helpful page:

http://rimuhosting.com/howto/memory.jsp

Quote:
To see how much memory you are currently using, run free -m. It will provide output like:

Code:
            total    used   free    shared buffers cached
Mem:        90      85       4      0       3       34
-/+ buffers/cache:  46      43
Swap:       9        0       9
The top row 'used' (85) value will almost always nearly match the top row mem value (90). Since Linux likes to use any spare memory to cache disk blocks (34).

The key used figure to look at is the buffers/cache row used value (46). This is how much space your applications are currently using. For best performance, this number should be less than your total (90) memory. To prevent out of memory errors, it needs to be less than the total memory (90) and swap space (9).

If you wish to quickly see how much memory is free look at the buffers/cache row free value (43). This is the total memory (90)- the actual used (46). (90 - 46 = 44, not 43, this will just be a rounding issue)
 
Old 11-24-2009, 05:47 PM   #5
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
The only thing I still don't get is, it seems 10 GB of 16 GB are being used. That's better than all of it, but what individual programs are using it? If I do 'ps aux' as root, I get the output below. If I add up the VSZ numbers, it comes out to about 4,300,000 (4.3 GB?). Where is the other 6GB being used (assuming the VSZ number reflects MB of memory used).

Code:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  10312   752 ?        Ss   Nov23   0:01 init [2]
root         2  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/0]
root         4  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Nov23   0:01 [watchdog/0]
root         6  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/1]
root         7  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/1]
root         8  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/1]
root         9  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/2]
root        10  0.0  0.0      0     0 ?        S<   Nov23   0:01 [ksoftirqd/2]
root        11  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/2]
root        12  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/3]
root        13  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/3]
root        14  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/3]
root        15  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/4]
root        16  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/4]
root        17  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/4]
root        18  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/5]
root        19  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/5]
root        20  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/5]
root        21  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/6]
root        22  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/6]
root        23  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/6]
root        24  0.0  0.0      0     0 ?        S<   Nov23   0:00 [migration/7]
root        25  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksoftirqd/7]
root        26  0.0  0.0      0     0 ?        S<   Nov23   0:00 [watchdog/7]
root        27  0.0  0.0      0     0 ?        S<   Nov23   0:03 [events/0]
root        28  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/1]
root        29  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/2]
root        30  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/3]
root        31  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/4]
root        32  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/5]
root        33  0.0  0.0      0     0 ?        S<   Nov23   0:02 [events/6]
root        34  0.0  0.0      0     0 ?        S<   Nov23   0:03 [events/7]
root        35  0.0  0.0      0     0 ?        S<   Nov23   0:00 [khelper]
root        76  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/0]
root        77  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/1]
root        78  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/2]
root        79  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/3]
root        80  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/4]
root        81  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/5]
root        82  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/6]
root        83  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kblockd/7]
root        85  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kacpid]
root        86  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kacpi_notify]
root       193  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ksuspend_usbd]
root       199  0.0  0.0      0     0 ?        S<   Nov23   0:00 [khubd]
root       202  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kseriod]
root       281  0.2  0.0      0     0 ?        S<   Nov23   4:02 [kswapd0]
root       282  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/0]
root       283  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/1]
root       284  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/2]
root       285  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/3]
root       286  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/4]
root       287  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/5]
root       288  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/6]
root       289  0.0  0.0      0     0 ?        S<   Nov23   0:00 [aio/7]
root      1044  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/0]
root      1050  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/1]
root      1051  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/2]
root      1052  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/3]
root      1053  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/4]
root      1054  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/5]
root      1055  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/6]
root      1056  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata/7]
root      1057  0.0  0.0      0     0 ?        S<   Nov23   0:00 [ata_aux]
root      1366  0.0  0.0      0     0 ?        S<   Nov23   0:00 [scsi_eh_0]
root      1472  0.0  0.0      0     0 ?        S<   Nov23   0:27 [kjournald]
root      1548  0.0  0.0  16876  1088 ?        S<s  Nov23   0:00 udevd --daemon
root      2099  0.0  0.0      0     0 ?        S<   Nov23   0:00 [edac-poller]
root      2209  0.0  0.0  65928  2992 ?        Ss   08:48   0:00 sshd: huypham [priv]
huypham   2211  0.0  0.0  66612  2412 ?        S    08:48   0:01 sshd: huypham@notty
huypham   2212  0.0  0.0  42696  2492 ?        Ss   08:48   0:00 /usr/lib/openssh/sftp-server
root      2308  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kpsmoused]
root      2479  0.1  0.0      0     0 ?        SN   Nov23   1:47 [kipmi0]
root      2668  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kjournald]
root      2669  3.5  0.0      0     0 ?        S<   Nov23  61:01 [kjournald]
root      2670  0.0  0.0      0     0 ?        S<   Nov23   0:38 [kjournald]
root      2671  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kjournald]
root      2672  0.0  0.0      0     0 ?        S<   Nov23   0:40 [kjournald]
root      2673  0.0  0.0      0     0 ?        S<   Nov23   0:01 [kjournald]
root      2674  0.0  0.0      0     0 ?        S<   Nov23   0:01 [kjournald]
root      2675  0.0  0.0      0     0 ?        S<   Nov23   0:04 [kjournald]
root      2676  0.0  0.0      0     0 ?        S<   Nov23   0:00 [kjournald]
root      2677  3.0  0.0      0     0 ?        S<   Nov23  53:37 [kjournald]
daemon    2760  0.0  0.0   8020   572 ?        Ss   Nov23   0:00 /sbin/portmap
statd     2772  0.0  0.0  10136   764 ?        Ss   Nov23   0:00 /sbin/rpc.statd
root      2784  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/0]
root      2786  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/1]
root      2787  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/2]
root      2788  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/3]
root      2789  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/4]
root      2790  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/5]
root      2791  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/6]
root      2792  0.0  0.0      0     0 ?        S<   Nov23   0:00 [rpciod/7]
root      2820  0.0  0.0      0     0 ?        S<   Nov23   0:00 [nfsiod]
root      2861  0.0  0.0  42028   712 ?        Ss   Nov23   0:00 /usr/sbin/rpc.idmapd
root      3102  0.0  0.0 187112  2172 ?        Sl   Nov23   0:18 /usr/sbin/rsyslogd -c3
root      3113  0.0  0.0   3796   600 ?        Ss   Nov23   0:00 /usr/sbin/acpid
root      3135  0.0  0.0  48864  1184 ?        Ss   Nov23   0:01 /usr/sbin/sshd
root      3144  0.0  0.2 101760 41256 ?        Ss   Nov23   0:17 /usr/sbin/spamd --create-prefs --max-children 5 --helper-home-dir -d --pidfile=/var/
102       3159  0.0  0.0 204456  8532 ?        Ssl  Nov23   0:29 /usr/sbin/spamass-milter -P /var/run/spamass/spamass.pid -f -p /var/run/spamass/spam
102       3207  0.6  0.2 109292 48816 ?        S    16:44   0:18 spamd child
root      3218  0.0  0.0  10128   680 ?        Ss   Nov23   0:03 /usr/sbin/inetd
root      3226  0.0  0.0  65928  3008 ?        Ss   16:45   0:00 sshd: davidst [priv]
root      3229  0.0  0.0  27768  1752 ?        Ss   Nov23   0:09 sendmail: accepting connections
smmsp     3232  0.0  0.0  25696  1368 ?        Ss   Nov23   0:00 sendmail: Queue runner@00:15:00 for /var/spool/clientmqueue
davidst   3235  0.0  0.0  66064  1712 ?        S    16:45   0:00 sshd: davidst@pts/0
davidst   3236  0.0  0.0  20432  3332 pts/0    Ss   16:45   0:00 -bash
root      3249  0.0  0.0  19832  1056 ?        Ss   Nov23   0:01 /usr/sbin/cron
root      3265  0.0  0.0 155116 11056 ?        Ss   Nov23   0:02 /usr/sbin/apache2 -k start
root      3282  0.0  0.0   3796   576 tty1     Ss+  Nov23   0:00 /sbin/getty 38400 tty1
root      3284  0.0  0.0   3796   576 tty2     Ss+  Nov23   0:00 /sbin/getty 38400 tty2
root      3285  0.0  0.0   3796   580 tty3     Ss+  Nov23   0:00 /sbin/getty 38400 tty3
root      3286  0.0  0.0   3796   580 tty4     Ss+  Nov23   0:00 /sbin/getty 38400 tty4
root      3288  0.0  0.0   3796   576 tty5     Ss+  Nov23   0:00 /sbin/getty 38400 tty5
root      3289  0.0  0.0   3796   576 tty6     Ss+  Nov23   0:00 /sbin/getty 38400 tty6
root      3572  0.0  0.0  65928  3012 ?        Ss   16:50   0:00 sshd: davidst [priv]
davidst   3574  0.0  0.0  65928  1700 ?        S    16:50   0:00 sshd: davidst@pts/3
davidst   3575  0.0  0.0  20432  3324 pts/3    Ss   16:50   0:00 -bash
root      3589  0.0  0.0  32448  1216 pts/3    S    16:50   0:00 su
root      3590  0.0  0.0  18836  1960 pts/3    S+   16:50   0:00 bash
www-data  3652  0.0  0.0 155212  7628 ?        S    16:54   0:00 /usr/sbin/apache2 -k start
www-data  3660  0.0  0.0 155204  7632 ?        S    16:54   0:00 /usr/sbin/apache2 -k start
www-data  3744  0.0  0.0 155204  7640 ?        S    16:58   0:00 /usr/sbin/apache2 -k start
www-data  3764  0.0  0.0 155684  7856 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data  3767  0.0  0.0 155196  7644 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data  3769  0.0  0.0 155204  7636 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
root      3868  0.0  0.0  32448  1216 pts/0    S    17:04   0:00 su
root      3869  0.0  0.0  18828  1928 pts/0    S    17:04   0:00 bash
www-data  3955  0.0  0.0 155700  7844 ?        S    17:07   0:01 /usr/sbin/apache2 -k start
www-data  3981  0.0  0.0 155196  7604 ?        S    17:09   0:00 /usr/sbin/apache2 -k start
root      4037  0.0  0.2 101760 39280 ?        S    17:10   0:00 spamd child
www-data  4112  0.0  0.0 155196  7584 ?        S    17:15   0:00 /usr/sbin/apache2 -k start
www-data  4213  0.0  0.0 155684  7680 ?        S    17:21   0:00 /usr/sbin/apache2 -k start
root      4215  0.0  0.0  27896  2684 ?        S    17:21   0:00 sendmail: server 189107113188.user.veloxzone.com.br [189.107.113.188] (may be forged
root      4370  0.0  0.0  27900  2176 ?        S    17:29   0:00 sendmail: ./nAOGBg7A006105 mail.eudict.com.: user open
root      4423  0.9  0.0      0     0 ?        S    17:32   0:01 [pdflush]
root      4441  0.5  0.0      0     0 ?        S    17:33   0:00 [pdflush]
root      4443  0.0  0.0  28108  2852 ?        S    17:34   0:00 sendmail: nAONYLjF004443 client-190.40.66.201.speedy.net.pe [190.40.66.201] (may be
root      4444  0.0  0.0  27904  2716 ?        S    17:34   0:00 sendmail: server client-190.40.66.201.speedy.net.pe [190.40.66.201] (may be forged)
102       4452  0.0  0.0  15100  1348 ?        S    17:34   0:00 /usr/bin/spamc -u spamass-milter
root      4453  0.0  0.0  16012  1104 pts/0    R+   17:34   0:00 ps aux
root      4864  0.0  0.0      0     0 ?        S<   Nov23   0:00 [lockd]
root      4865  0.0  0.0      0     0 ?        S<   Nov23   0:00 [nfsd4]
root      4866  0.0  0.0      0     0 ?        S    Nov23   0:11 [nfsd]
root      4867  0.0  0.0      0     0 ?        S    Nov23   0:15 [nfsd]
root      4868  0.0  0.0      0     0 ?        S    Nov23   0:11 [nfsd]
root      4869  0.0  0.0      0     0 ?        S    Nov23   0:12 [nfsd]
root      4870  0.0  0.0      0     0 ?        S    Nov23   0:12 [nfsd]
root      4871  0.0  0.0      0     0 ?        S    Nov23   0:15 [nfsd]
root      4872  0.0  0.0      0     0 ?        S    Nov23   0:13 [nfsd]
root      4873  0.0  0.0      0     0 ?        S    Nov23   0:10 [nfsd]
root      4877  0.0  0.0  14368   824 ?        Ss   Nov23   0:00 /usr/sbin/rpc.mountd
root      5227  0.0  0.0  65928  3008 ?        Ss   Nov23   0:00 sshd: jianhua [priv]
jianhua   5236  0.0  0.0  65928  1700 ?        S    Nov23   0:00 sshd: jianhua@pts/5
jianhua   5237  0.0  0.0  19248  2080 pts/5    Ss+  Nov23   0:00 -bash
root      8768  0.0  0.0  65928  3032 ?        Ss   10:38   0:00 sshd: zhang [priv]
zhang     8770  0.0  0.0  65928  1760 ?        S    10:38   0:01 sshd: zhang@pts/1
zhang     8771  0.0  0.0  19316  2144 pts/1    Ss   10:38   0:00 -bash
zhang     8776  0.0  0.0 138196 10228 pts/1    S+   10:38   0:06 pine
root     11659  0.0  0.0  65928  3008 ?        Ss   Nov23   0:00 sshd: rkannan [priv]
rkannan  11665  0.0  0.0  66064  1720 ?        S    Nov23   0:01 sshd: rkannan@pts/7
rkannan  11666  0.0  0.0  19304  2148 pts/7    Ss+  Nov23   0:00 -bash
root     11717  0.0  0.0  65928  2992 ?        Ss   11:02   0:00 sshd: kundu [priv]
kundu    11733  0.0  0.0  66064  1716 ?        S    11:03   0:02 sshd: kundu@pts/4
kundu    11734  0.0  0.0  19292  2196 pts/4    Ss+  11:03   0:00 -bash
root     16016  0.0  0.0  65928  3004 ?        Ss   11:47   0:00 sshd: jianhua [priv]
jianhua  16022  0.0  0.0  65928  1696 ?        S    11:47   0:00 sshd: jianhua@pts/2
jianhua  16023  0.0  0.0  19248  2076 pts/2    Ss+  11:47   0:00 -bash
 
Old 11-24-2009, 05:54 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Let's see /proc/meminfo
 
Old 11-24-2009, 06:00 PM   #7
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Code:
MemTotal:     16472844 kB
MemFree:        462580 kB
Buffers:        723912 kB
Cached:        3419684 kB
SwapCached:          0 kB
Active:        1190592 kB
Inactive:     14243468 kB
SwapTotal:     5630772 kB
SwapFree:      5630620 kB
Dirty:             492 kB
Writeback:           0 kB
AnonPages:      113016 kB
Mapped:          12940 kB
Slab:           498244 kB
SReclaimable:   485188 kB
SUnreclaim:      13056 kB
PageTables:       8496 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:  13867192 kB
Committed_AS:   347888 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    303784 kB
VmallocChunk: 34359434423 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB
 
Old 11-24-2009, 08:14 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I don't see anything out of order there. To keep yourself sane, just keep an eye on "active/inactive" ratio. The active shows you aren't heavily using the memory (at that time anyway). I also like to see that slabs aren't eating too much - just see if that increases too much over time.
As for what's using it there are a couple of ways of finding out. "top" can be sorted by mem%, if you have sysstat installed that'll show depending on kernel level - look for pidstat. Else there is /proc/<pid>/smaps - there's a perl script somewhere to show that in a sensible format. Might only be for a single pid IIRC.
 
Old 11-24-2009, 11:46 PM   #9
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
The active/inactive and slabs seem about the seem right now, but I've been running "free -m" all night and this is what I see (with some block of time between each major change:

Code:
csc:stats# free -m | grep cache:
-/+ buffers/cache:      10679       5407
csc:stats# free -m | grep cache:
-/+ buffers/cache:      11495       4590
csc:stats# free -m | grep cache:
-/+ buffers/cache:      11495       4590
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12306       3780
You have new mail in /var/mail/root
csc:stats#
csc:stats#
csc:stats#
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12323       3763
csc:stats#
csc:stats#
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12318       3767
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12327       3759
csc:stats# ls
Basically, the free memory is getting smaller and smaller. I'm tempted to reboot right now while most users are inactive (and pray the system comes back up automatically since I'd rather not go to the office at midnight) to see what it looks like at the start and monitor it over the next few days.

Reading /proc/meminfo right now shows that most things that could go down have a little (expected at night time), but the "Dirty:" total has gone way up to about half a GB from just half a MB

Code:
MemTotal:     16472844 kB
MemFree:        756348 kB
Buffers:        849444 kB
Cached:        2191844 kB
SwapCached:          0 kB
Active:         956716 kB
Inactive:     14184848 kB
SwapTotal:     5630772 kB
SwapFree:      5630620 kB
Dirty:          523464 kB
Writeback:         180 kB
AnonPages:      181232 kB
Mapped:          16196 kB
Slab:           493708 kB
SReclaimable:   479224 kB
SUnreclaim:      14484 kB
PageTables:      10876 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:  13867192 kB
Committed_AS:   471472 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    303784 kB
VmallocChunk: 34359434423 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB
Ok, "dirty" likes to jump up and down from about 500 MB to almost 0. However, "free -m" continues to report less and less unused memory.

Code:
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12318       3767
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12327       3759
csc:stats# ls
df.091124  free.091124
csc:stats# less free*
csc:stats# less free*
csc:stats#
csc:stats#
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12564       3522
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12564       3522
csc:stats#
csc:stats#
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12550       3536
csc:stats# free -m | grep cache:
-/+ buffers/cache:      12553       3533
Nerve wracking this is...

Last edited by davidstvz; 11-24-2009 at 11:52 PM.
 
Old 11-25-2009, 12:16 AM   #10
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Well, a took a chance on a remote reboot (got screwed on that once) and no problems.

"free -m" reports:

Quote:
total used free shared buffers cached
Mem: 16086 1686 14400 0 9 1459
-/+ buffers/cache: 217 15869
Swap: 5498 0 5498
... and it isn't showing any signs of increasing quickly. Mem info looks like this a few minutes after reboot:

Code:
MemTotal:     16472844 kB
MemFree:      15395892 kB
Buffers:         12320 kB
Cached:         773052 kB
SwapCached:          0 kB
Active:         110252 kB
Inactive:       845712 kB
SwapTotal:     5630772 kB
SwapFree:      5630772 kB
Dirty:          518048 kB
Writeback:           0 kB
AnonPages:       83860 kB
Mapped:          10816 kB
Slab:            47604 kB
SReclaimable:    34928 kB
SUnreclaim:      12676 kB
PageTables:       8460 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:  13867192 kB
Committed_AS:   354564 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    303784 kB
VmallocChunk: 34359434423 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB
At least I can sleep. I just wish I knew if the slowly decreasing "unused" memory reported by free is an actual problem. And if it is, was it there all along or was it caused by some new program I installed today. I added TeX (and many helper programs) an x-windows tool or two, several programming languages and added spamhaus filtering to sendmail. I also reduced the forklimit for spamassassin from 5 to 2 (at the recommendation of another site somewhere that suggested it runs fine with just 1 and limits potential resource usage spikes).

EDIT

Well, by the morning the stats look about the same... I'm starting to realize that this is probably normal. the inactive/active ratio is good and the slab is staying about the same.

Last edited by davidstvz; 11-25-2009 at 12:37 PM.
 
Old 11-25-2009, 07:15 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Glad to hear it. As for
Quote:
I just wish I knew if the slowly decreasing "unused" memory reported by free is an actual problem
As always - "it depends". Most likely not. You'll find the free number will get to a low thresh-hold and stay there - cache will be freed in need. Start worrying when swap gets used and always increases (a small usage is o.k.). That may well indicate a problem and you will get your biggest consumer smacked by the OOM-killer. And it's nearly always the one thing you don't want killed.
But there's nothing to indicate a problem in the numbers we've seen so far.
 
Old 11-25-2009, 11:28 PM   #12
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Thanks for the reassurances. After monitoring the system further and, incidentally, installing the same Debian OS on another system, I'm seeing that these numbers are not a problem.

The second system I mentioned has similar hardware, but weaker and fewer CPUs and most importantly only 1 GB of memory instead of 16. There are no users are serious web serving going on since I only want it for rsyncing backups (and was thinking of using it as an emergency server in case the main goes down). Anyway, this thing is using a tiny bit of swap space (just 50 MB) and has very little free memory and I can notice major unresponsiveness while the files are rsyncing (which the first server didn't experience when I transferred from the old BSD server I was phasing out).

In any case... I think I just need to buy some memory for my backup server and relax a bit.

Thanks
 
Old 11-26-2009, 08:55 AM   #13
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Unlike every other similar thread I've seen, this time I think something is seriously wrong.

Quote:
Am I really using 15.75 GB of physical memory?
Not quite. Some significant fraction of the 4954MB reported as cached and the 679MB reported as buffers is effectively free.

But that still leaves most of your memory not accounted for.

Quote:
Top isn't suggesting that anything is eating all the memory either:
Did you try telling it to sort so the largest values in the RES column are on top?

Quote:
Originally Posted by davidstvz View Post
If I do 'ps aux' as root, I get the output below. If I add up the VSZ numbers, it comes out to about 4,300,000 (4.3 GB?). Where is the other 6GB being used (assuming the VSZ number reflects MB of memory used).
Actually the amount used by processes is less than or equal to the total of the RSS column, which is much less than the total of VSZ.

So something really doesn't add up here.

Quote:
Originally Posted by syg00 View Post
I don't see anything out of order there.
Can you explain why?

I'm especially confused about that "Inactive" number. I don't understand how Active and Inactive relate to the other measures of memory use. When memory is not Mapped nor Anonymous nor Slab nor Buffers nor Cache, what significant uses are left?
 
Old 11-26-2009, 04:27 PM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Linux uses lazy allocation. It's too expense to continually run the page queues when not needed - more so as the RAM size increases. If a page is no longer needed by a task, it doesn't necessarily go back on the free q straight away. New requests come off the free q - so the apparent usage is larger than the "real" usage.
Active/inactive is simply a LRU indicator (new/old, hot/cold - pick a terminology). If pages are needed to replenish the free list, they can be taken from (non-dirty) inactive as well as cache without the need for a write.
 
Old 11-27-2009, 10:21 AM   #15
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Well, the system has been running fine since Monday at noon. I rebooted on Tuesday night, but it was likely unnecessary. The memory usage was behaving about the same by the next morning.

This is what top reports when sorted by memory (interactive command: shift+M):

Code:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2872 root      20   0  106m  47m 2628 S    0  0.3   0:09.66 spamd
30650 root      20   0  103m  44m 2564 S    0  0.3   0:01.08 spamd
 3100 root      20   0 99.4m  40m 2588 S    0  0.3   0:21.56 spamd
 3710 gb        20   0  118m  25m 4348 S    0  0.2   0:05.70 emacs
 3115 spamass-  20   0  207m  15m  780 S    0  0.1   0:15.94 spamass-milter
 3221 root      20   0  151m  10m 5212 S    0  0.1   0:03.22 apache2
 3921 www-data  20   0  151m 7732 1560 S    0  0.0   0:00.00 apache2
 3821 www-data  20   0  152m 7728 1576 S    0  0.0   0:00.00 apache2
 3894 www-data  20   0  151m 7708 1536 S    0  0.0   0:00.00 apache2
 3872 www-data  20   0  152m 7672 1556 S    0  0.0   0:00.16 apache2
 3640 www-data  20   0  151m 7604 1580 S    0  0.0   0:00.00 apache2
 3892 www-data  20   0  151m 7600 1540 S    0  0.0   0:00.00 apache2
 3870 www-data  20   0  151m 7580 1556 S    0  0.0   0:00.00 apache2
 3890 www-data  20   0  151m 7456 1532 S    0  0.0   0:00.00 apache2
 3939 www-data  20   0  151m 7224 1348 S    0  0.0   0:00.00 apache2
 3949 www-data  20   0  151m 7216 1340 S    0  0.0   0:00.00 apache2
 3959 www-data  20   0  151m 6700  860 S    0  0.0   0:00.00 apache2
 3575 davidst   20   0 20424 3328 1448 S    0  0.0   0:00.06 bash
 3662 gb        20   0 20428 3320 1444 S    0  0.0   0:00.12 bash
 3651 root      20   0 65928 3072 2400 S    0  0.0   0:00.04 sshd
 3572 root      20   0 65928 3008 2392 S    0  0.0   0:00.00 sshd
32651 root      20   0 65928 2996 2372 S    0  0.0   0:00.04 sshd
21656 root      20   0 65928 2992 2372 S    0  0.0   0:00.86 sshd
13970 root      20   0 65928 2988 2380 S    0  0.0   0:00.00 sshd
32653 huypham   20   0 66740 2568 1200 S    0  0.0   0:02.04 sshd
21658 huypham   20   0 66580 2324 1200 S    0  0.0   0:02.00 sshd
21659 huypham   20   0 42500 2296 1412 S    0  0.0   0:00.18 sftp-server
32654 huypham   20   0 42472 2280 1412 S    0  0.0   0:01.10 sftp-server
 3058 root      20   0  183m 2232 1028 S    0  0.0   0:24.36 rsyslogd
13973 kundu     20   0 19268 2160 1420 S    0  0.0   0:00.20 bash
 3644 root      20   0 27768 2048  968 S    0  0.0   0:00.00 sendmail
 3960 chensec5  20   0 32256 1948 1508 R   31  0.0   0:00.92 in.qpopper
 3793 root      20   0 18820 1908 1368 S    0  0.0   0:00.00 bash
 3632 root      20   0 27768 1868  864 S    0  0.0   0:00.00 sendmail
 3183 root      20   0 27768 1744  788 S    0  0.0   0:43.30 sendmail
 3660 gb        20   0 65928 1728 1052 S    0  0.0   0:00.00 sshd
13972 kundu     20   0 66064 1712 1084 S    0  0.0   0:06.44 sshd
 3574 davidst   20   0 66064 1692 1060 S    0  0.0   0:00.06 sshd
 3186 smmsp     20   0 25696 1376  556 S    0  0.0   0:00.04 sendmail
 3908 root      20   0 18956 1320  940 R    0  0.0   0:00.42 top
 3792 root      20   0 32448 1212  956 S    0  0.0   0:00.00 su
 3091 root      20   0 48864 1180  676 S    0  0.0   0:00.74 sshd
 1529 root      16  -4 16876 1088  488 S    0  0.0   0:00.16 udevd
19429 root      20   0 18564 1064  768 S    0  0.0   0:01.56 rpc.mountd
 3203 root      20   0 19832 1056  816 S    0  0.0   0:01.56 cron
 2727 statd     20   0 10136  756  632 S    0  0.0   0:00.00 rpc.statd
    1 root      20   0 10312  752  620 S    0  0.0   0:02.08 init
 2816 root      20   0 42028  712  380 S    0  0.0   0:00.00 rpc.idmapd
 3174 root      20   0 10128  684  556 S    0  0.0   0:06.52 inetd
 3069 root      20   0  3796  600  476 S    0  0.0   0:00.00 acpid
 2715 daemon    20   0  8020  596  456 S    0  0.0   0:00.02 portmap
 3238 root      20   0  3796  580  484 S    0  0.0   0:00.00 getty
 3239 root      20   0  3796  580  484 S    0  0.0   0:00.00 getty
 3242 root      20   0  3796  580  484 S    0  0.0   0:00.00 getty
 3241 root      20   0  3796  576  484 S    0  0.0   0:00.00 getty
 3244 root      20   0  3796  576  484 S    0  0.0   0:00.00 getty
 3245 root      20   0  3796  576  484 S    0  0.0   0:00.00 getty
    2 root      15  -5     0    0    0 S    0  0.0   0:00.42 kthreadd
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
X.org Is Eating All My Memory Quantumstate Linux - Software 3 08-16-2007 11:59 PM
Xorg is eating up my memory!!! eantoranz Linux - Software 1 05-31-2006 01:32 PM
eating all my memory (HELP!) twon Linux - Hardware 4 05-12-2006 08:40 AM
Something is eating my memory benne Linux - Software 15 11-25-2004 06:02 AM
How do I see what's eating all my memory? thomas.nichols Linux - General 1 09-05-2001 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration