// preload keys if requested
System.out.println();
if (config.preload) {
System.out.println("Preloading data store...");
for(int i=0; i < config.poolsize; i++) {
client.callProcedure(new NullCallback(),
"STORE.upsert",
String.format(processor.KeyFormat, i),
processor.generateForStore().getStoreValue());
}
client.drain();
System.out.println("Preloading complete.\n");
}
System.out.print(HORIZONTAL_RULE);
System.out.println(" Starting Benchmark");
System.out.println(HORIZONTAL_RULE);
// Run the benchmark loop for the requested warmup time
// The throughput may be throttled depending on client configuration
System.out.println("Warming up...");
final long warmupEndTime = System.currentTimeMillis() + (1000l * config.warmup);
while (warmupEndTime > System.currentTimeMillis()) {
// Decide whether to perform a GET or PUT operation
if (rand.nextDouble() < config.getputratio) {
// Get a key/value pair using inbuilt select procedure, asynchronously
client.callProcedure(new NullCallback(), "STORE.select", processor.generateRandomKeyForRetrieval());
}
else {
// Put a key/value pair using inbuilt upsert procedure, asynchronously
final PayloadProcessor.Pair pair = processor.generateForStore();
client.callProcedure(new NullCallback(), "STORE.upsert", pair.Key, pair.getStoreValue());
}
}
// reset the stats after warmup
fullStatsContext.fetchAndResetBaseline();