I’ve been having problems trying to tidy my library which is remotely stored on a NAS, connected with NFSv3 (Network File System, that is), under Linux.
The performance for write operations are awfully low (no, I’m not talking about some minutes to save a song; I’m talking about HOURS, REALLY, LITERALLY 2 or 3 hours). This issue can be kind of softened by connecting to the NAS by wire (but still using NFS). But my setup asks for a wireless connection, which is not a problem even for playing videos (not FullHD though).
Using the strace utility (strace -f -e open) I saw jaikoz opening files with the O_SYNC flag (synchronize every write access), which is a known performance killer for NFSv3 (don’t know about v4).
I tried all the java.io methods for “opening” files and I found that only java.io.RandomAccessFile with “rws” or “rwd” mode flags triggers the open syscall with O_SYNC flag.
Being a long time programmer, having both high- and low-level experience, I was left wondering why do we need that “sync” option. Usually only database coders should need it, and only for log file operations (for ACID properties, strictly speaking).
Still if you have a really good reason for keeping this sync option (namely “s” or “d” in “rws” or “rwd”), then please at lease offer some sort of configuration, be it through the UI, java property (-Dproperty=value), environment variable, direct configuration file manipulation; any kind will do. I’ll happily give up any consistency granted by sync in favor of a 100 fold increase in write performance.
Until there I’ll keep trying to find some workaround, like tracing every syscall to open and changing “rws” or “rwd” to “rw”, or instrumenting classes in JVM on the fly, whichever resolves the problem.