I am running some experiments with I/O intensive applications and am trying to understand the effects of varying the kernel i/o buffer size, different elevator algorithms, a
The kernel does not buffer reads and writes the way you think... It maintains a "page cache" that holds pages from the disk. You do not get to manipulate its size (well, not directly, anyway); the kernel will always use all available free memory for the page cache.
You need to explain what you are really trying to do. If you want some control over how much data the kernel pre-fetches from disk, try a search for "linux readahead". (Hint: blockdev --setra XXX
)
If you want some control over how long the kernel will hold dirty pages before flushing them to disk, try a search for "linux dirty_ratio".
A specific application can also bypass the page cache completely by using O_DIRECT
, and it can exercise some control over it using fsync
, sync_file_range
, posix_fadvise
, and posix_madvise
. (O_DIRECT
and sync_file_range
are Linux-specific; the rest are POSIX.)
You will be able to ask a better question if you first educate yourself about the Linux VM subsystem, especially the page cache.