how to knock a page out of file cache

birdsong david.birdsong at
Wed Oct 21 07:27:30 CEST 2009

Can anyone recommend a way to read a file ensuring that it is not
coming from file cache on Linux?

I'm trying to write a metric script for measuring http connect + read
times from a web server over localhost.  I want to plot both file
cache read times and non-cached files.

I thought of simply opening and writing to the file to dirty it's
pages, but there no guarantee that pdflush will have already written
the dirty pages to disk -pretty sure it depends on all the dirty ratio
and intervals.

Does anybody know of a system call that will 'knock' the file out of
file cache?  Can madvise or fadvise do this?

I know this is mostly a unix question, but I'm asking in the context
of how to do this in python.

More information about the Python-list mailing list