Title. Besides setting tmpfs to use 10GiB of it to store downloads.

  • kevincox
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Like anything it depends. If you are just mounting a tmpfs over .cache then probably not. It will likely harm performance overall because you will have an empty cache after every boot.

    If you are copying the existing files to the tmpfs and then doing the flushing them back to disk on shutdown then you are essentially “preaching” the data at startup. Done at an appropriate priority this can make initial accesses faster with minimal impact on startup time. However if you don’t have swap this may harm long-running performance as the kernel has to keep .cache in RAM even if caching other files and data would be more beneficial. If you do have swap then you are doing needless writes to swap to save this data that is already on disk. Overall it would probably be better to run some command that reads all of the data at bootup to warm up the page cache then let the kernel manage it for you.

    So in general no, this isn’t a great idea. The kernel will track what files are being used and cache them intelligently, using access patterns rather than a very simply policy like “is in .cache”. This really only helps if you need really consistent performance out of you cache folder, but in practice this will probably come at the cost of less predictably performance of other data.

    TL;DR The kernel caches your disk using the observed access patterns, unless you are putting significant ongoing effort into careful tuning it will probably do a better job than you will.