For benchmarking purposes I want to force Apache 2 to load each requested file from disk instead of loading it from a cache in memory. From what I have read doing a sync followed by
echo 3 > /proc/sys/vm/drop_caches
lets me drop linux's cache. A subsequent request for a particular file will then not be served from linux's cache, but further requests for the same file will be served from linux's cache again. That is so because /proc/sys/vm/drop_caches doesn't disable caching, it only discards what has been cached up to that moment. I could probably drop the cache before each and every request, but I'd prefer another solution. Is there anything else I can do to ensure that apache loads each requested file from disk?
Why I want to do this: I know that in normal operation caching is enabled. But the server is not serving small and frequently accessed files such as html pages, small images, etc. Instead it is serving files which are mostly a couple of megabytes in size from a very large set of files. These files are accessed pretty uniformly and therefore each individual file is accessed very rarely. Thus in normal operation I expect that most accesses will not cause a cache hit but require the file to be loaded from disk. I have several sample files which I want to access using apache's ab benchmark to measure how many transactions per second the server is able to serve. Unfortunately I believe the results I am getting are way too optimistic because of caching. Therefore I want to disable Linux's disk caching and any caching Apache might do itself.
Update: the answer given so far tells me how to disable Apache's own caching, but I am still wondering if there is a way to disable the caching done by the linux kernel.