I am using RandomAccessFile to write data to a file. I am running performance test on my code on solaris machine.
If provide a shorter path for the file lets say "/tmp/", the records are written in expected time in sync with the requests I am sending through my client program.
But when I provide a longer path like /tmp/javaranch/saloon/home/greenhorns/random/access/file", it takes lot of time to write record in time. Even if the client has stopped producing data, the server keeps on writing records (client puts records in a queue and leaves) for next few minutes.
This behaviour is mainly visible in Unix machine. On windows machine I am not able to see any significant delay in writing.
Interesting. Have you tried it with different Java classes (i.e. FileWriter or FileOutputStream) to see if it is a Java problem or a Unix problem?
What flavor of Unix are you using? What filesystem is the drive? Is the drive local or on the network? How much free space does the drive have?
Prafull Prashant wrote:One information which I wanted to share is I am opening the file in "rwd" mode. Can this create a problem? because when I opened the file in "rw" mode performance improved a lot.
"rwd" = Open for reading and writing, as with "rw", and also require that every update to the file's content be written synchronously to the underlying storage device.