I am well aware on how to drop (e.g. /sbin/sysctl vm.drop_caches=3 ) caches in Linux, but for benchmarking I'd like to do the reverse, fill up the caches up to 100% RAM if possible. How would I do that pragmatically?
Asked
Active
Viewed 2,005 times
0
-
6Try just reading all the bits in the file system until cache usage seems to high water-mark: `find / -type f -exec md5sum {} \;` – MadHatter Aug 29 '13 at 10:11
-
2-exec cat {} >>/dev/null would use less CPU – symcbean Aug 29 '13 at 10:17
-
Grumble. Not only are you a CPU cheapskate, you're right, as well. – MadHatter Aug 29 '13 at 10:29
-
1Why are you commenting instead of clicking answer button to give a proper answer I can mark up as the right one? =) – Dima Aug 29 '13 at 11:49
1 Answers
0
Do you want to fill cache or do you want to cache specific data?
The system automatically will fill cache as the system is used, filling it with whatever is needed, and expire those pages as it becomes more useful to either cache something else or use the memory as part of an active process.
If you want to cache specific data so it is in ram ready for fast use, the act of reading it from disk once is normally enough, assuming it doesn't get pushed out of cache by something else before you need it again.

user10489
- 584
- 1
- 3
- 14