Here's the scenario: We have a NAS with datasets that need to be copied to a local disk for faster processing. Datasets are from 2 to 15GB and each dataset in its own folder on the NAS.
To copy to the local disk, I call:
FileUtils.copyDirectory(nasDir, localDiskDir);
Where the two parameters are File
instances.
The nasDir
is a network-mapped SMB drive. When using Java to copy the dataset, the max transfer speed tops at about 8MB/s. The same copy using Windows Explorer or Nautilus, depending on the server, reaches up to 34-35MB/s sustained.
Does anyone have an idea of why that is, and, cherry on the cake, how to copy a directory through java faster? Even if we're 5-10% slower than native would be acceptable, the current difference, though, indicates a significant performance degradation somewhere.
EDIT: initially thought it may be related to the Apache Commons I/O library, but testing with https://docs.oracle.com/javase/tutorial/essential/io/examples/Copy.java reveals it to be a more fundamental problem at some level.