- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hello!
Based on your description, you are very likely observing the effects of the negative lookup cache in your NFS client. When you do an "ls" on a non-existing file on EC2-1, the local NFS client will cache the non-existence of this file for a number of seconds. The exact timeout depends on your exact NFS mount options but by default is in the 30 second range. The file that was created by EC2-2 does exist immediately on EFS after EC2-2 created it, it's existence is just hidden by the cache on EC2-1.
There are few ways around this problem, each of them with a different tradeoff:
* You can mount your file system with "lookupcache=pos" to disable negative lookup caching. The benefit is that your use case will work without further changes. The disadvantage is if your application frequently accesses non-existing files, you may see a performance degradation.
* You can do a readdir on the directory containing the file which will return the new file and invalidate any negative caches in that directory. This is what you are observing in your post when do you an "ls" on the directory. Readdir operations are relatively expensive and I would not recommend this if your have to do this frequently or if your directory contains more than a handful of files.
* You can try to structure your application so that it never accesses a file unless it knows it exists.
This was solved using the noac option. This sums up the options nicely.
For others who may read this thread in the future.
The 'noac' mount option resolves the issue by disabling all caching, while 'lookupcache=pos' is more targeted and only disables negative dentry caching. For this specific issue, 'lookupcache=pos' is preferred as it will have less performance impact.
Contenus pertinents
- demandé il y a un an
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 4 ans