"localhost",
6666,
RequestFormatType.VOLDEMORT_V1,
RequestRoutingType.NORMAL);
RequestHandlerFactory factory = ServerTestUtils.getSocketRequestHandlerFactory(repository);
AbstractSocketService socketService = ServerTestUtils.getSocketService(useNio,
factory,
6666,
50,
50,
1000);
socketService.start();
PerformanceTest socketWriteTest = new PerformanceTest() {
@Override
public void doOperation(int i) {
byte[] bytes = String.valueOf(i).getBytes();
ByteArray key = new ByteArray(bytes);
socketStore.put(key, new Versioned<byte[]>(bytes), null);
}
};
System.out.println("###########################################");
System.out.println("Performing socket write test.");
socketWriteTest.run(numRequests, numThreads);
socketWriteTest.printStats();
System.out.println();
PerformanceTest socketReadTest = new PerformanceTest() {
@Override
public void doOperation(int i) {
try {
socketStore.get(TestUtils.toByteArray(String.valueOf(i)), null);
} catch(Exception e) {
System.out.println("Failure on i = " + i);
e.printStackTrace();
}
}
};
System.out.println("Performing socket read test.");
socketReadTest.run(numRequests, 1);
socketReadTest.printStats();
System.out.println();
System.out.println();
socketStore.close();
storeFactory.close();
socketService.stop();
/** * Do HTTP tests ** */
repository.addLocalStore(new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeName));
HttpService httpService = new HttpService(null,
null,