use of org.apache.ignite.IgniteFileSystem in project ignite by apache.
the class IgfsBenchmark method main.
/**
* @param args Commandline arguments
*/
public static void main(String[] args) {
Ignition.setClientMode(Boolean.getBoolean("clientMode"));
Ignite ignite = Ignition.start(System.getProperty("cfg", "default-config.xml"));
int wormUpCount = Integer.getInteger("wormup", 2);
int cycles = Integer.getInteger("cycles", 10);
final IgfsBenchmark fsTest = new IgfsBenchmark(System.getProperty("testDir", "/test"), Integer.getInteger("depth", 3), Integer.getInteger("subDirs", 10), Integer.getInteger("files", 10), Integer.getInteger("fileSize", 8) * 1024);
final IgniteFileSystem fs = ignite.fileSystem("igfs");
try {
for (int i = 0; i < wormUpCount; ++i) {
System.out.println("Wormup #" + i + " / " + wormUpCount);
fsTest.testWriteFile(fs);
fsTest.testReadFile(fs);
fsTest.testDeleteFile(fs);
}
} catch (Exception ex) {
System.err.println("Wormup error");
ex.printStackTrace(System.err);
Ignition.stop(false);
return;
}
List<Long> writeRes = new ArrayList<>(cycles);
List<Long> readRes = new ArrayList<>(cycles);
List<Long> infoRes = new ArrayList<>(cycles);
List<Long> listRes = new ArrayList<>(cycles);
List<Long> delRes = new ArrayList<>(cycles);
try {
for (int i = 0; i < cycles; ++i) {
System.out.println("Benchmark cycle #" + i + " / " + cycles);
writeRes.add(bench(new Runnable() {
@Override
public void run() {
fsTest.testWriteFile(fs);
}
}));
readRes.add(bench(new Runnable() {
@Override
public void run() {
fsTest.testReadFile(fs);
}
}));
infoRes.add(bench(new Runnable() {
@Override
public void run() {
fsTest.testInfoFile(fs);
}
}));
listRes.add(bench(new Runnable() {
@Override
public void run() {
fsTest.testListPathFile(fs);
}
}));
delRes.add(bench(new Runnable() {
@Override
public void run() {
fsTest.testDeleteFile(fs);
}
}));
}
System.out.println("\n");
System.out.println("Write " + avg(writeRes) + " +/- " + stdDev(writeRes, avg(writeRes)));
System.out.println("Read " + avg(readRes) + " +/- " + stdDev(readRes, avg(readRes)));
System.out.println("Info " + avg(infoRes) + " +/- " + stdDev(infoRes, avg(infoRes)));
System.out.println("List " + avg(listRes) + " +/- " + stdDev(listRes, avg(listRes)));
System.out.println("Delete " + avg(delRes) + " +/- " + stdDev(delRes, avg(delRes)));
} catch (Exception ex) {
System.err.println("Benchmark error");
ex.printStackTrace(System.err);
} finally {
Ignition.stop(false);
}
}
Aggregations