We are running our test environment on AWS and we use NFS (EBS file system) mounts across all the servers to access our files. Multiple java processes access files on this file system. Application server uses different consumers running on other systems to get files processed. And one such consumer converts or files to images, but the issue is that the application server can't access these files (file.exist() is false). Now the strange thing is that it can't access the first image of the file page (files with several pages), but it can access the second page and so on. Many time I observe, odd numbered page images are not accessible, but I can see that the image exists there. So, I think the image conversion process is still accessing the image while application server tries to access it, but the same issue doesn't surface to the even numbered page images. These images reside inside a nested folder, so the conversion process also creates the folder structure and then writes them into those folders. Any idea what may be the issue here? Anyone facing this issue with NFS shares on AWS?
Asked
Active
Viewed 988 times
1 Answers
1
It depends on the expected behaviour of your application
NFS works great with readonly systems or with programs that have a low demand on the timely updating of data
See this question for more details Alternative to File.exists() in Java
You might like to consider an alternative to NFS such as AWS EFS or the open source Gluster
-
Is this issue there with a CIFS mount too, because I changed my mount to CIFS, the issue is still there. I wonder if it is the EBS that is the root cause here. Btw, with the "ls" command the issue went away, we could finally get all the image files, but when I removed the "ls" before accessing a file in a cifs mount, it came back. – Mahesh H Viraktamath Sep 14 '16 at 08:30
-
1i doubt that it is related to EBS – Vorsprung Sep 14 '16 at 10:07
-
Ok, but I didn't get any references to the "caching" related issue in "CIFS". Is it there for CIFS too? – Mahesh H Viraktamath Sep 14 '16 at 10:13
-
1All network file systems use caching of some sort! You don't describe exactly how your system works but it is easy to imagine how a shared file system could be slower to update than programs trying to coordinate actions on different systems. That's why systems using queues are so popular – Vorsprung Sep 14 '16 at 10:30
-
Our system uses queues (RabbitMQ), so the app server tries to access the images only after our consumer processes a conversion and the app server gets the reply from it. – Mahesh H Viraktamath Sep 14 '16 at 10:36
-
if `ls` stops the problem from happening then maybe just adding this to your code ( or a java equivalent ) is the way to go. This will probably reread the directory information and so makes newly created files "appear". The other way is to use mount options to turn off caching but this is generally a bad idea – Vorsprung Sep 14 '16 at 11:57
-
Ok, last question - does it matter if the image resides under nested folders? We don't see this latency in files which reside in a single folder. – Mahesh H Viraktamath Sep 14 '16 at 12:58