I would like to turn off the disk / storage cache on Raspbian. I have done a serie of benchmarks on the microSD (http://jgp.net/microsd-card-performance-raspberry-pi/) but some people recommended I do the benchmarks with out cache activated.

As a more general question, is there a way to choose how much cache you want?

migrated from raspberrypi.stackexchange.com Apr 2 '16 at 13:40

This question came from our site for users and developers of hardware and software for Raspberry Pi.

  • 1
    "some people recommended I do the benchmarks with out cache activated." -> Perhaps suggests an XY problem in that what you really want to do is clear the cache; see /proc/sys/vm/drop_caches. In any case, this is really a question about the linux kernel and has been appropriately migrated. – goldilocks Apr 2 '16 at 13:39

You could try setting the direct=true parameter in fio. See the man page open(2) on the equivalent creation flag:

O_DIRECT. Try to minimize cache effects of the I/O to and from this file. In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done directly to/from user-space buffers.

  • It appears that fio --direct is not documented anymore. It still works with --direct=0 or --direct=1, but does not seem to do much. – jgp Apr 2 '16 at 19:12
  • did you try adding the line direct=1 after the size= lines in the *.fio files? – meuh Apr 2 '16 at 19:18
  • Sorry -- it is documented, but it does not seem to affect the results on the platform (Raspberry Pi). – jgp Apr 2 '16 at 19:18
  • Yes on direct=1 - sorry - it does not seem to affect the results, I will have more (heavier) tests to see if it affects it. – jgp Apr 2 '16 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.