use of voldemort.store.mysql.MysqlStorageConfiguration in project voldemort by voldemort.
the class MysqlBuildPerformanceTest method main.
public static void main(String[] args) throws FileNotFoundException, IOException {
if (args.length != 3)
Utils.croak("USAGE: java " + MysqlBuildPerformanceTest.class.getName() + "serverPropsFile storeName jsonSequenceDataFile");
String serverPropsFile = args[0];
String storeName = args[1];
String jsonDataFile = args[2];
final Store<ByteArray, byte[], byte[]> store = new MysqlStorageConfiguration(new VoldemortConfig(new Props(new File(serverPropsFile)))).getStore(TestUtils.makeStoreDefinition(storeName), TestUtils.makeSingleNodeRoutingStrategy());
final AtomicInteger obsoletes = new AtomicInteger(0);
Path jsonFilePath = new Path(jsonDataFile);
FileStatus jsonFileStatus = jsonFilePath.getFileSystem(new Configuration()).listStatus(jsonFilePath)[0];
final SequenceFileRecordReader<BytesWritable, BytesWritable> reader = new SequenceFileRecordReader<BytesWritable, BytesWritable>(new Configuration(), new FileSplit(jsonFilePath, 0, jsonFileStatus.getLen(), (String[]) null));
PerformanceTest readWriteTest = new PerformanceTest() {
@Override
public void doOperation(int index) throws Exception {
try {
BytesWritable key = new BytesWritable();
BytesWritable value = new BytesWritable();
reader.next(key, value);
store.put(new ByteArray(ByteUtils.copy(key.get(), 0, key.getSize())), Versioned.value(ByteUtils.copy(value.get(), 0, value.getSize())), null);
} catch (ObsoleteVersionException e) {
obsoletes.incrementAndGet();
}
}
};
readWriteTest.run(1000, 1);
System.out.println("MySQl write throuhput with one thread:");
readWriteTest.printStats();
}
Aggregations