3 ms·
> Disk cache can always be given back to applications immediately This is not true, there is a cost to freeing the cache pages and allocating them to the other
by __turbobrew__ 3y ago
> Disk cache can always be given back to applications immediately
This is not true, there is a cost to freeing the cache pages and allocating them to the other program. I have seen some very regressive performance patterns around pages getting thrashed back and forth between programs and the page cache, especially in containers which are memory limited. You throw memory maps into the mix and things can get really bad really fast.
- blueflow 3y agoCan you elaborate further?
- __turbobrew__ 3y agoThere is a fast path and slow path to reclaiming cached pages. There are ways to measure the impact using ebpf probes. If you are interested in going deeper I recommend looking at the memory section of this book: https://www.brendangregg.com/blog/2020-07-15/systems-performance-2nd-edition.html https://www.brendangregg.com/blog/2020-07-15/systems-perform...
- mnw21cam 3y agoThat's why Linux does keep a certain amount of RAM actually-free, so that it can hand over some pages immediately. If the amount of actually-free RAM goes below a certain amount, then it will pre-emptively evict a load of cache pages.