Prevent backup reads from getting into linux page cache

backup, caching, linux, memory-management

Solution

- if you re using rsync there is the flag `--drop-cache` according to this question

- the nocache utility which

minimize the effect an application has on the Linux file system cache

Use case: backup processes that should not interfere with the present state of the cache.

- using dd there is direct I/O to bybass cache according to this question

- the dd also has the option `nocache` option check the command `info coreutils 'dd invocation'`for details

Problem

AFAIK all disk reads on linux get into the page cache. Is there a way to prevent reads (done by a backup process) to get in to the page cache? Imagine: - A server runs fine, since most operations don't need to touch the disk, since enough memory is available. - Now the backup process starts and does a lot of reading. The read bytes get into the memory (page cache) although nobody wants to read the same bytes again in the next hours. - The backup data fills up the memory and more important pages from the cache get dropped. - Server performance gets worse since more operations need to touch the disk, because the relevant pages were dropped from the cache. My preferred solution: - Tell linux that the reads done by the backup process don't need to be stored in the page cache.

Original source

Related problems