0

Since I've found discussion of buffers/cache on that site, not Unix of SE, I post my question here. I've read In Linux, what is the difference between "buffers" and "cache" reported by the free command? and Meaning of the buffers/cache line in the output of free, where it is written:

caches will be freed automatically if memory gets scarce, so they do not really matter.

Currently free reports 8Gb of buffers/cache, however, system when approaching zero free memory becomes unresponsive for long time and sync; echo 3 > /proc/sys/vm/drop_caches does not change much. Why? I post output of free -m and also more detailed output of cat /proc/meminfo:

              total        used        free      shared  buff/cache   available
Mem:          15740        4508        2366        8453        8865        2474

MemTotal:       16118172 kB
MemFree:          528472 kB
MemAvailable:     475820 kB
Buffers:            1588 kB
Cached:          8939100 kB
SwapCached:            0 kB
Active:          6711540 kB
Inactive:        8440460 kB
Active(anon):    6621624 kB
Inactive(anon):  8402256 kB
Active(file):      89916 kB
Inactive(file):    38204 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:       6211412 kB
Mapped:          1534592 kB
Shmem:           8812568 kB
Slab:             203244 kB
SReclaimable:     106932 kB
SUnreclaim:        96312 kB
KernelStack:       18736 kB
PageTables:        93880 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8059084 kB
Committed_AS:   23933660 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:     1761344 kB
DirectMap2M:    14704640 kB
DirectMap1G:     1048576 kB
2

/proc/sys/vm/drop_caches does not have a use in system operations. Don't use it, only makes things slower.

Well, it does have some uses, but they tend to be corner cases. Testing storage with a cold cache, unusual virtual memory workloads. See previously on Server Fault: Why drop caches in Linux?


Even ignoring Cached as if it were zero, this system already has relatively high memory utilization. AnonPages + Shmem is 14 GB and changes, alone only 1 GB less than MemTotal. And indeed, add in other stuff and MemAvailable is 0.5 GB.

One guess at how much RAM would be enough is from the kernel, Committed_AS. Enough to not page out. Which can be a problematic metric, but it is one of the few that directly estimates physical RAM usage. From your meminfo output, about 23 GB, or 150% of MemTotal. Half again what you have might be fine for some workloads, but I would be uncomfortable on a system with no swap and suspected memory capacity issues.

Some totals add up to more than 100% because the virtual memory system is being both lazy and clever. But only so much it can do. Shared memory (presumably a database) and apps anonymous memory adding to nearly as much as the host risks miserable performance.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.