Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class ParallelDelete extends Object
Our backup directories contain parallel directories with many hard links. The performance of deleting more than one of the directories can be improved by deleting from them in parallel.
Also performs the task with three threads:
Iterate filesystem -> Delete entries -> Verbose Output
(Calling Thread) (New Thread) (New Thread)
Verifying this is, in fact, true. This is measured with a copy of the backups from one of our managed servers. The system RAM was limited to 128 MB to better simulate backup server hardware. ext3 benchmarks on Maxtor 250 GB 7200 RPM SATA. reiserfs benchmarks on WD 80 GB 7200 IDE.
+---------------------+---------------------+
| ext3 | reiserfs |
+-----------+---------+----------+----------+----------+----------+
| # Deleted | | parallel | rm -rf | parallel | rm -rf |
+-----------+---------+----------+----------+----------+----------+
| 1/13 | | TODO | TODO | TODO | TODO |
| 2/13 | | TODO | TODO | TODO | TODO |
| 3/13 | | TODO | TODO | TODO | TODO |
| 4/13 | | TODO | TODO | TODO | TODO |
| 8/13 | | TODO | TODO | TODO | TODO |
+-----------+---------+----------+----------+----------+----------+
| | User | 61.99 | 2.61 | 63.29 | 3.00 |
| 13/13 | System | 89.90 | 48.01 | 180.69 | 113.26 |
| | Elapsed | 10:38:53 | 10:23.79 | 8:26.71 | 33:13.52 |
| | % CPU | 23% | 8% | 48% | 5% |
+-----------+---------+----------+----------+----------+----------+
TODO: Once benchmarks finished for other # Deleted, adjust threshold between
rm and parallel in FailoverFileReplicationManager
TODO: Should it use a provided ExecutorService instead of making own Threads?
TODO: Concurrent deletes would be possible. Is there any advantage?| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Deletes multiple directories in parallel (but not concurrently).
|
static void |
parallelDelete(List<File> directories,
PrintStream verboseOutput,
boolean dryRun)
Recursively deletes all of the files in the provided directories.
|
public static void main(String[] args)
public static void parallelDelete(List<File> directories, PrintStream verboseOutput, boolean dryRun) throws IOException
IOExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.