use of voldemort.store.memory.CacheStorageConfiguration in project voldemort by voldemort.
the class CacheStorageEnginePerformanceTest method main.
public static void main(String[] args) {
if (args.length != 3)
Utils.croak("USAGE: java " + CacheStorageEnginePerformanceTest.class.getName() + " num-threads num-requests read-fraction");
int numThreads = Integer.parseInt(args[0]);
int numRequests = Integer.parseInt(args[1]);
double readPercent = Double.parseDouble(args[2]);
final int valueRange = numRequests / 10;
final int mod = 100;
final int readMax = (int) readPercent * mod;
final Store<ByteArray, byte[], byte[]> store = new CacheStorageConfiguration(null).getStore(TestUtils.makeStoreDefinition("test"), TestUtils.makeSingleNodeRoutingStrategy());
final AtomicInteger obsoletes = new AtomicInteger(0);
PerformanceTest readWriteTest = new PerformanceTest() {
@Override
public void doOperation(int index) throws Exception {
try {
byte[] bytes = Integer.toString(index % valueRange).getBytes();
ByteArray key = new ByteArray(bytes);
if (index % mod < readMax)
store.get(key, null);
else
store.put(key, new Versioned<byte[]>(bytes), null);
} catch (ObsoleteVersionException e) {
obsoletes.incrementAndGet();
}
}
};
readWriteTest.run(numRequests, numThreads);
System.out.println("Cache storage engine performance test results:");
readWriteTest.printStats();
System.out.println("Number of obsolete puts: " + obsoletes.get());
}
Aggregations