How long does Linux (by default) cache information about files in the disk?
I'm testing whether some changes I made to some code are effective or not.
For this, I need to know how the file system cache normally works. I'm
assuming the default is what we're getting, since we probably haven't
tweaked anything interesting regarding this.
Essentially, if from my code I ask "does this file exist?", the answer
comes back in "x" milliseconds. If I ask again a few minutes later, the
answer comes back much, much quicker, so I'm guessing there's some caching
going on there.
How long should I wait if I want to test again, with the cache flushed, so
it'll take "long" again? (I want to see if I fixed a performance problem
in my web app, but I can only know that it's fixed if the info about files
existence isn't cached, because if it is, it does run fast)
I know this is not the most eloquent question, and the answer is probably
"it depends", I'm asking for a sane default. In other words, if I test
again in 3 hours, or 6, or whatever, can I count on it not being cached?
As far as I can tell... This is a Ubuntu server, kernel version:
3.9.3-x86-linode52, Ubuntu version: Ubuntu 12.04.3 LTS, hosted on Linode.
The file system is ext3
Thank you!
Daniel
No comments:
Post a Comment