3

It seems that given the memory percentage of the processes listed, my server should not be at 98% memory usage. Why is the cumulative memory usage so high?

top - 14:34:50 up 14 days, 22:54,  3 users,  load average: 0.00, 0.01, 0.05
Tasks: 139 total,   1 running, 138 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  32949428 total, 32566440 used,   382988 free,   604072 buffers
KiB Swap:        0 total,        0 used,        0 free. 31047712 cached Mem
-----------------------------------------------------------------------------------
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                              
 5897           20   0  906248 101500   6188 S   0.0  0.3   1:01.68 nscd                                                                                                                                                                 
 7880           20   0  154172  54840  18336 S   0.0  0.2   6:28.49 Xvnc-core                                                                                                                                                            
 8012           20   0  544700  28344  18244 S   0.0  0.1   1:04.04 xfdesktop                                                                                                                                                            
23362           20   0  518688  21600  11504 S   0.0  0.1   6:05.26 xfce4-terminal                                                                                                                                                       
 8010           20   0  626188  20388  14828 S   0.0  0.1   1:31.88 Thunar                                                                                                                                                               
 1433           20   0  322828  19260   2224 S   0.0  0.1   0:35.91 rsyslogd                                                                                                                                                             
 8008           20   0  427104  17992  11600 S   0.0  0.1   0:58.87 xfce4-panel                                                                                                                                                          
 7904           20   0   88624  17928    692 S   0.0  0.1   0:00.00 Xvnc: [host res                                                                                                                                                      
24261           20   0  535632  16868  11448 S   0.0  0.1   0:24.36 xfce4-appfinder                                                                                                                                                      
 3771           20   0  268892  12244   2816 S   0.0  0.0   2:29.83 fail2ban-server                                                                                                                                                      
 8004           20   0  154564  11800   8424 S   0.0  0.0   0:06.79 xfwm4                                                                                                                                                                
23358           20   0  152468   9164   7044 S   0.0  0.0   0:00.80 panel-2-actions                                                                                                                                                      
 7919           20   0  239968   8804   6388 S   0.0  0.0   0:00.10 x-session-manag                                                                                                                                                      
 7918           20   0  127908   8428   6000 S   0.0  0.0   0:01.68 vncserverui-vir                                                                                                                                                      
17987           20   0  161240   7988   5948 S   0.0  0.0   0:00.04 sshd                                                                                                                                                                 
23356           20   0  150596   7988   6164 S   0.0  0.0   0:00.78 panel-6-systray                                                                                                                                                      
 8034           20   0  321392   7760   5428 S   0.0  0.0   0:39.73 xfsettingsd                                                                                                                                                          
 7882           20   0  123264   6768   4352 S   0.0  0.0   0:09.57 vncserverui                                                                                                                                                          
 8032           20   0  230664   6636   4896 S   0.0  0.0   0:00.12 xfce4-power-man                                                                                                                                                      
 8098           20   0  286420   6244   2844 S   0.0  0.0   0:00.06 gvfs-udisks2-vo                                                                                                                                                      
    1           20   0   32640   6160   1440 S   0.0  0.0   0:06.64 init                                                                                                                                                                 
 8118           20   0  355216   5488   2752 S   0.0  0.0   0:00.05 gvfsd-trash                                                                                                                                                          
24755           20   0   15100   4536   1808 S   0.0  0.0   0:01.67 bash                                                                                                                                                                 
30756           20   0  103852   4400   3208 S   0.0  0.0   1:14.05 ntpd                                                                                                                                                                 
 7368           20   0   14924   4344   1796 S   0.0  0.0   0:00.08 bash                                                                                                                                                                 
 8027           20   0  286744   4216   3160 S   0.0  0.0   0:00.02 indicator-appli                                                                                                                                                      
18039           20   0   14900   4184   1660 S   0.0  0.0   0:00.09 bash                                                                                                                                                                 
 8101           20   0  362956   4132   2728 S   0.0  0.0   0:01.78 udisksd                                                                                                                                                              
 8042           20   0  239344   4108   3244 S   0.0  0.0   0:00.05 upowerd                                                                                                                                                              
 8124           20   0  291592   3848   3004 S   0.0  0.0   0:27.31 accounts-daemon                                                                                                                                                      
21857           20   0  112140   3764   2852 S   0.0  0.0   0:00.07 systemd-logind                                                                                                                                                       
 8074           20   0  124908   3192   2640 S   0.0  0.0   0:01.36 at-spi2-registr                                                                                                                                                      
31316           20   0   61376   3048   2372 S   0.0  0.0   0:10.19 sshd                                                                                                                                                                 
  801           20   0   18188   2996    640 S   0.0  0.0   0:28.84 dhclient                                                                                                                                                             
 8056           20   0  337316   2956   2448 S   0.0  0.0   0:00.01 at-spi-bus-laun                                                                                                                                                      
 7881           20   0   76604   2940   2056 S   0.0  0.0   0:00.32 Xvnc                                                                                                                                                                 
18038           20   0  161240   2928    888 S   0.0  0.0   0:00.46 sshd                                                                                                                                                                 
 8054           20   0  192444   2892   2356 S   0.0  0.0   0:00.01 gvfsd                                                                                                                                                                
 6895           20   0  120244   2744   2244 S   0.0  0.0   0:00.00 gvfsd-metadata                                                                                                                                                       
 1738           20   0   96896   2640    780 S   0.0  0.0   0:44.79 sendmail-mta 
cdosborn
  • 172
  • 8

2 Answers2

5

Because that's how modern operating systems work. You can't save RAM for later. A 4GB machine that uses only 2GB today can't use 6GB tomorrow -- it just wasted 2GB today. So your only choices are to use it or waste it. Modern OSes do their very, very best to use it rather than wasting it.

If you're thinking "I want it free now so I can use it later", you're forgetting that you can use it now and use it later. There's no tradeoff to make. Modern operating systems transition RAM directly from one use to another use without having to go through the extra wasted effort of making it free in-between.

Using RAM that you don't need to use isn't wasting it, it's being efficient. Not using RAM that you could use is wasting it.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
5

31047712 cached Mem

looks like you have a lot of stuff cached. Please refer to the venerable linuxatemyram.com

user9517
  • 114,104
  • 20
  • 206
  • 289
  • 1
    Unfortunately, that page contains a lot of oversimplifications that are just flat out false. I really don't like linking people to it. For example, "But what do you call memory that is both used for something and available for applications?" -- that applies to all unlocked memory, even memory used by applications. So nobody would call that free. It seems to claim that even memory used by applications should be considered free because it's also available for other uses should those uses get priority, which propagates a misunderstanding as serious as the one the site is trying to address. – David Schwartz Mar 18 '16 at 22:09
  • 1
    I guess it's kind of like physics. We get taught Newtonian physics which is good enough for many things but it falls apart at the edges which is where Einstein takes over with significantly more complexity. For most people (especially those asking crappy poorly researched questions here) the idea that most of it is in cache and will be returned upon request is good enough. – user9517 Mar 19 '16 at 07:28
  • I have no objection to simplifications as long as they don't contain actual falsehoods. That's where I draw the line. The reason we have this particular confusion is because people have a simple, naive notion of memory that's "used" and you can't fix that with another naive notion of "used". You just recreate the problem. – David Schwartz Mar 19 '16 at 19:05