Java file moves high performance

I am writing a multimedia transcoding server in which I will need to move files in the file system, and so far I am in a dilemma of whether it is possible to replace java renameTo with something else that will give me better performance. I was considering using exec ("mv file1 file2"), but that would be my last bet. Has anyone had a similar experience or can he help me find a solution?

+4
source share
3 answers

First of all, renameTo most likely just terminates the system call.

Secondly, moving a file is not related to copying any data from the file itself (at least on unix). All that happens is removing the link from the old directory and adding the link from the new directory. I don’t think you will find performance improvements here.

+8
source

I do not think that using standard methods for a file has a (mentioned) performance limitation, since most of these JVMtoOS functions already carry their own calls.

The only case when you need exec is if you want to do something with different rights than the program, or use a special tool to copy / move the file. (for example, smart-move when connecting ntfs connections)

+1
source

If renaming is a significant performance bottleneck, you need to improve your hardware, as this is your main drawback. Software is a trivial part of the time spent and optimizing it, which will make little difference.

What is your disk integration? How is it optimized for recording?

0
source

All Articles