Linux Write Caching

about | archive


[ 2010-July-07 11:31 ]

I just spent a couple days trying to understand the performance of a small test program that constantly overwrites a file, treating it like a circular buffer. The key is understanding how Linux caches dirty pages in memory and writes them back. The brief summary is that Linux attempts to write dirty pages out in the background, without blocking the process doing the writing. However, once there are enough dirty pages, the process will be blocked, actively pages out to disk. The details are described elsewhere, but I will briefly summarize what I learned here. This may not be completely correct, because I didn't look at the code in any detail. Note: All the variables are files in /proc/sys/vm that are adjustable.

References

Other Random Notes