0

I have a server for which I cannot account where the ram is going.

Output of top (sorted by %MEM) indicates I have 96GB of ram on this server.

top - 23:30:54 up 1 day, 21:55,  2 users,  load average: 1447.94, 1429.95, 1430.95
Tasks: 403 total,   1 running, 402 sleeping,   0 stopped,   0 zombie
Cpu(s):  8.2%us,  9.5%sy,  0.0%ni, 79.6%id,  1.8%wa,  0.0%hi,  0.9%si,  0.0%st
Mem:  98650976k total, 98025188k used,   625788k free,   419924k buffers
Swap:  4095996k total,        0k used,  4095996k free,  8917188k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
17570 web       20   0 64.7g  46g  27m S 12.1 49.8  68:49.85 java
17162 memcache  20   0 5619m 4.6g 1728 S  0.0  4.9   2:56.36 memcached
16694 root      20   0 2428m 1.6g 6984 S 99.7  1.7 193:50.29 glusterfs
17572 web       20   0 8034m 389m  27m S  0.0  0.4   0:39.24 java
17568 web       20   0 8225m 301m  27m S  0.3  0.3   0:26.64 java
17571 web       20   0 10.9g 253m  27m S  0.0  0.3   0:19.22 java
17569 web       20   0 7965m 252m  27m S  0.0  0.3   0:19.57 java

Yet vmstat only 'sees' ~64GB

[root@web-node19 ~]# vmstat -a -S M
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
 7  0      0    692  10836  54313    0    0  2236   751   13    1 14 15 70  1  0

Here's a full output of meminfo

[root@web-node19 ~]# cat /proc/meminfo
MemTotal:       98650976 kB
MemFree:          847812 kB
MemAvailable:   16597476 kB
Buffers:          420016 kB
Cached:          9362772 kB
SwapCached:            0 kB
Active:         55884280 kB
Inactive:       11407444 kB
Active(anon):   55029988 kB
Inactive(anon):  2483792 kB
Active(file):     854292 kB
Inactive(file):  8923652 kB
Unevictable:       14896 kB
Mlocked:           14896 kB
SwapTotal:       4095996 kB
SwapFree:        4095996 kB
Dirty:             41428 kB
Writeback:           416 kB
AnonPages:      57523880 kB
Mapped:            87048 kB
Shmem:              2072 kB
Slab:           10233020 kB
SReclaimable:    6959564 kB
SUnreclaim:      3273456 kB
KernelStack:       51728 kB
PageTables:       148464 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    53421484 kB
Committed_AS:   34019392 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      128600 kB
DirectMap2M:     3706880 kB
DirectMap1G:    96468992 kB

Could anyone point me in the right direction? Where's the remaining memory at? :)

Thank you,

2 Answers 2

1

The first line of vmstat is showing the average usage of the resources since the last reboot and not the totals. The swapd column is displaying 0 despite the system obviously having virtual memory on disk or swap space. It's just that none is being used.

It doesn't show 96GB because buffers and cache aren't displayed which is what you'd see with free.

5
  • The memory values aren’t averages, even on the first line. Commented Sep 4, 2020 at 4:54
  • Note that none of the swap is in use; that’s why it shows 0. Commented Sep 4, 2020 at 5:00
  • @StephenKitt Unless I'm not interpreting it correctly, the man space states that it shows the average uses of the system resources since the last reboot which my answer indicates. I've updated the rest of my answer for clarity because it was a bit off. Commented Sep 4, 2020 at 13:48
  • You’re not interpreting anything incorrectly, the manpage is confusing. The memory fields always show the current usage, retrieved from /proc/meminfo on Linux. Commented Sep 4, 2020 at 13:56
  • @StephenKitt That makes a lot more sense. Thanks. Commented Sep 4, 2020 at 14:35
0

vmstat -a doesn’t track all the system’s memory; in particular it’s missing all the memory used in buffers and cache (which you can see without -a).

Your values match the information from /proc/meminfo:

MemFree:          847812 kB
...
Active:         55884280 kB
Inactive:       11407444 kB

(with a little variation since the outputs weren’t simultaneous).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.