Re: How does disk caching work?

From: Jim C. Nasby (jim_at_nasby.net)
Date: 04/19/04

  • Next message: Jim C. Nasby: "Re: command piped into bzip not using all available CPU"
    Date: Sun, 18 Apr 2004 21:20:43 -0500
    To: Uwe Doering <gemini@geminix.org>
    
    

    On Sat, Apr 17, 2004 at 09:41:19AM +0200, Uwe Doering wrote:
    > The disk i/o buffers you refer to (the 'Buf' column in 'top') are the
    > actual interface between the VM system and the disk device drivers. For
    > file and directory data, sets of VM pages get referred by and assigned
    > to disk i/o buffers. There they are dealt with by a kernel daemon
    > process that does the actual synchronization between VM and disks.
    > That's where the soft updates algorithm is implemented, for instance.
    >
    > In case of file and directory data, once the data has been written out
    > to disk (if the memory pages were "dirty") the respective disk i/o
    > buffer gets released immediately and can be recycled for other purposes,
    > since it just referred to memory pages that continue to exist within the
    > VM system.
    >
    > Meta data (inodes etc.) is a different matter, though. There is no VM
    > representation for this, so for disk i/o they have to be cached in extra
    > memory allocated for this purpose. A disk i/o buffer then refers to
    > this memory range and tries to keep it around for as long as possible.
    > A classical cache algorithm like LRU recycles these buffers and memory
    > allocations eventually.
    >
    > As usual, the actual implementation is even more complex, but I think
    > you got a picture of how it works.

    Yes, much clearer now, thanks!

    A few questions if I may...

    What's a good way to tune amount of space dedicated to IO buffers?

    What impact will vm_min|max_cache have on system performance? Is there
    any advantage to setting it fairly high?

    The machine I'm tuning is a dual Opteron box with 4G of ram, a mirror
    and a 6 disk RAID10. It's running PostgreSQL.

    -- 
    Jim C. Nasby, Database Consultant                  jim@nasby.net
    Member: Triangle Fraternity, Sports Car Club of America
    Give your computer some brain candy! www.distributed.net Team #1828
    Windows: "Where do you want to go today?"
    Linux: "Where do you want to go tomorrow?"
    FreeBSD: "Are you guys coming, or what?"
    _______________________________________________
    freebsd-performance@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-performance
    To unsubscribe, send any mail to "freebsd-performance-unsubscribe@freebsd.org"
    

  • Next message: Jim C. Nasby: "Re: command piped into bzip not using all available CPU"

    Relevant Pages

    • Proposed Assembler Commands
      ... ACM Automatically Clear Memory ... BKCRDR Backspace Card Reader ... BKSPD Backspace Disk ... EIAO Execute In Any Order ...
      (sci.electronics.design)
    • Re: Att. Alex Nichol -VM cont.
      ... I find documentation that says a 4kb page in memory is written to the hard ... manner that a 4kb memory page is equal to a 4kb cluster written on the disk". ... So where is the basis for saying since 4kb paging in memory that 4kb clusters ...
      (microsoft.public.windowsxp.general)
    • Re: Slow performance
      ... Leaving your computer on 24/7 means that if any programme has a memory ... The Disk Defragmenter report shows you have minimal free disk space. ... select Properties, General, Advanced and check the box before Compress ... Volume fragmentation ...
      (microsoft.public.windowsxp.perform_maintain)
    • Re: Slow performance
      ... I realize that the pagefile usage is excessive and I need to reduce memory ... I've never messed with those settings before. ... Peak are greatly in excess of the installed RAM. ... The Disk Defragmenter report shows you have minimal free disk space. ...
      (microsoft.public.windowsxp.perform_maintain)
    • Re: teaching a child - console or GUI
      ... I use a RDBMS to reuse existing code and optimizations. ... >>And loading them in a system under load (with constant disk io) is worse ... quality stuff), and quality power supply, quality memory etc. ... > lists of pointers on disk, extract files of frequent search fields in ...
      (comp.lang.pascal.delphi.misc)