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 ?