NodeEnvironment nodeEnvironment = new NodeEnvironment(settings, environment);
ByteBufferCache byteBufferCache = new ByteBufferCache(settings);
ShardId shardId = new ShardId(new Index("index"), 1);
String type = args.length > 0 ? args[0] : "ram";
Store store;
if (type.equalsIgnoreCase("ram")) {
store = new RamStore(shardId, settings, null);
} else if (type.equalsIgnoreCase("simple-fs")) {
store = new SimpleFsStore(shardId, settings, new SimpleFsIndexStore(shardId.index(), settings, null, nodeEnvironment), byteBufferCache);
} else if (type.equalsIgnoreCase("mmap-fs")) {
store = new NioFsStore(shardId, settings, new NioFsIndexStore(shardId.index(), settings, null, nodeEnvironment), byteBufferCache);
} else if (type.equalsIgnoreCase("nio-fs")) {
store = new MmapFsStore(shardId, settings, new MmapFsIndexStore(shardId.index(), settings, null, nodeEnvironment), byteBufferCache);
} else if (type.equalsIgnoreCase("memory")) {
store = new ByteBufferStore(shardId, settings, null, byteBufferCache);
} else {
throw new IllegalArgumentException("No type store [" + type + "]");
}
System.out.println("Using Store [" + store + "]");
store.deleteContent();
SimpleStoreBenchmark simpleStoreBenchmark = new SimpleStoreBenchmark(store)
.numberStaticFiles(5).staticFileSize(new ByteSizeValue(5, ByteSizeUnit.MB))
.dynamicFileSize(new ByteSizeValue(1, ByteSizeUnit.MB))
.readerThreads(5).readerIterations(10)
.writerThreads(2).writerIterations(10)
.build();
simpleStoreBenchmark.run();
store.close();
}