Score:1

cachefilesd - how to ensure file is copied from local cache?

se flag

I have setup cachefilesd and to check if it is correct I verified following:

  • cachefilesd service is running
  • NFS storage is mounted with -o fsc and able to see FSC set to yes in /proc/fs/nfsfs/volumes
  • when a file is copied from NFS I see new content added in /var/cache/fscache (this is setup in /etc/cachefilesd.conf

Now when I first copy a 4 Mb from the NFS and the time taken as per the time command comes something around 400-450 millsecs, then if I copy same file again the time is reduced to 50-60 millisecs. The reduced time made me happy that local cache is working as expected.

But when I turned off cachefilesd service and remounted the storage without -o fsc option, I still see the same behavior i.e the second time copying still takes the same amount of time. I believe when the cachefilesd was on the copy from local cache should have been more faster.

I checked a few sites where it was mentioned that there could be caching enabled on the NFS server itself and maybe that is why second time copy is faster even when cachefilesd was off.

So to test if the second time copying is from local cache I thought of introducing latency using the tc qdisc add dev eth0 root netem delay 400ms. (I ensure cachefilesd is on and NFS storage is mounted with -o fsc). Now with this I see the first time copy is taking much more time as expected for eg. 8-10 secs and to the surprise the second time copying take around 800 millisecs to 1 sec which is still high if the file is being copied from local cache. This behavior again matches when cachefilesd is off.

The questions:

  • Why does second time copy is taking so much time when cachefilesd is on and when latency is introduced ?
  • How to find if the file is copied from local cache ?

Any sort of hints will be very helpful.

Can anyone provide any sort of information ?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.