Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 95915  / 3 Years ago, tue, july 27, 2021, 6:46:12

When running top, I get:



top - 09:10:52 up 18:37,  1 user,  load average: 1.56, 1.33, 1.15
Tasks: 39 total, 1 running, 38 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.6%sy, 1.0%ni, 92.5%id, 5.8%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4194304k total, 3045460k used, 1148844k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 2256128k cached


See the part: 2256128k cached? What exactly does that mean?



I am comparing two VPS from two provider, this one always has a large amount there (70% of the used memory) and the other VPS provider always shows 0.


More From » memory

 Answers
6

That number before cached is the amount of physical memory that is being used by cache buffers for your filesystems.



It's not actually related to SWAP, despite being on the "Swap:" line.



To verify my answer with a little experiment try the following:



Run top and note the value of 'cached'. Now run



dd if=/dev/zero of=~/trick bs=1M count=128


if you run top again you'll notice that 'cached' has grown by 128M



Now remove the file



rm ~/trick


Run top again and you'll see 'cached' has dropped by 128M



So for Mem:



total = used + free and



used = <all apps> + buffers + cached



(where buffers is basically metadata for the cached). A bit confusing of a UI.


[#35032] Wednesday, July 28, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
edseager

Total Points: 185
Total Questions: 105
Total Answers: 102

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;