I have a directory (
/srv/data) with a large number (20,000,000) with a number of small (4-40KB) files. These files are all located in subdirectories of
/srv/data, where the concatenation of the subdirectory names and file names form UUIDs. For example, the UUID
833ac041-28c4-4ea4-9bac-81fe781732b4 would maps to the path
/srv/data/83/3a/c0/41-28c4-4ea4-9bac-81fe781732b4. Using 2 hex digits for each subdirectory level gives a fan-out of 255. E.g., there are 255 directories in
/srv/data, each with up to 255 subdirectories, and each of these with up to 255 subdirectories.
Is it possible to tell the kernel to give caching preferences to these files, or to a subset of these files?
E.g., "Hey Linux, cache as many files as you can from
/srv/data. If you can't fit it all in memory, cache as much as you can and don't worry about any files outside of this directory. If you can fit it all in memory, then feel free to use whatever is left to cache files outside of this directory."