Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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

It's not related to SWAP.

To prove my answer do this simple trick

Run top and note the value of 'cached'

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 ~/test

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

share|improve this answer
    
and I can influence this anyhow, e.g. limit it or disable completely? –  Kumala Oct 10 '12 at 13:51
1  
Why do you want to do that?! what shall you do with?! its about how file system cache in phyiscal memory. –  user61928 Oct 10 '12 at 13:56
    
Cause most of the filesystem is a DB, the DB has its own cache, so I assume it would be good to limit this part somehow. –  Kumala Oct 10 '12 at 13:59
    
You can do it with some search but i don't advice you. This will limit the performance of th FS –  user61928 Oct 10 '12 at 14:02

the Linux kernel will use available memory for disk caching, unless it's required by a running program.

This is considered good; say you have 4 GB RAM, and your programs are using only 1 GB. The other 3 GB are going to waste. Despite the "feel-good" impression from knowing you're only using 25% of your memory, the counterpart is that the other 75% is going unused. So the kernel uses that for caching files which significantly improves performance. It's automatic; unlike older operating systems you don't need to decide how much to devote to disk cache, or manually configure it.

"The Linux disk cache is very unobtrusive. It uses spare memory to greatly increase disk access speeds, and without taking any memory away from applications. A fully used store of ram on Linux is efficient hardware use, not a warning sign."

This is such a common question that there's an entire website devoted to it:

http://www.linuxatemyram.com

The website even has a way to empty the disk cache so you can then run some applications and see how much faster they are with the cache enabled :)

share|improve this answer
    
Love the answer, but due to lack in reputation I can't upgrade it (yet). Sorry. –  Kumala Oct 10 '12 at 14:18
    
Don't worry, I'm just glad to be of help. Hope the information is useful! –  roadmr Oct 10 '12 at 15:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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