D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Bah! Disks! Bah!

 

Quoting Gordon Henderson <gordon+dcglug@xxxxxxxxxx>:

On Fri, 5 Feb 2010, Rob Beard wrote:

One thing I'm not entirely clear about is the buffers and cache.

For instance on your embedded system, it says...

Mem:    257208k total,   238644k used,    18564k free,     2516k buffers
Swap:        0k total,        0k used,        0k free,    35164k cached

So, about 2.5MB are used for buffers and about 3.5MB used for cache, I'm assuming they are separate? (so combined the buffers and cache are using about 6MB?)

35MB cached, not 3.5MB ...


Ahh yeah, I read it wrong.

What I'm wondering is if say, the cache is like the old SmartDrive cache on DOS where rather than writing directly do disc, it holds what it needs to write in a cache for a couple of seconds until the disk is pretty much idle to speed up writing?

If that is the case, what is the buffer for?

I'm under the impression (someone correct me if I'm wrong!) that
'cached' data belongs to the filesystem and "buffers" belong to the
underlying block device(s).

So the system has 35MB of files, cached in RAM and not on disk, and
2.5MB worth of buffered disk blocks that it can read from without
accessing the disk.

I see.

256MB in total, 140MB for the ramdisk, leaving what's effectively 144MB
of system RAM which the kernel, programs and program data has to live
in. Off that, some 38MB are being used for cache/buffers by the filing
system/OS.

I suspect in this instance, it doesn't know that the "disk" is RAM, so
it's effectively copied the ramdisk (ext2) into a filesystem cache -
although I imagine it's probably quicker to fetch the data from the
cache than the (ram)disk though as it probably has less code to
execute. (getting from a very simplified cache filesystem vs.
traversing an ext2 filesystem)

Yep, I presume not much difference in speed, but I guess every little helps. I suppose it's also simplier this way too not having to change things to disable the buffers.

Some of the files in the cache will be regularly executed executables -
cron jobs, etc. and some will be the aterisk config files, and php
source code files, images, etc. the web server reads, and so on. Also
the music on hold files and other audio files it has read out of the
flash drive...

Ahh, so the actual space occupied by Asterisk etc isn't much then I guess?

They may actually be every single file the system has read since boot
time, if it's never had to flush the cache since boot to make space for
something new... Wonder if there's a way to find out what files are in
the cache...


Not sure, I'm sure someone has written a tool to do that though.

Rob





--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html