redisBenchmark();
}
public static void redisBenchmark() {
int connections = 100;
RedisPool pool = new RedisPool("localhost", 6379, connections);
ExecutorService exec = Executors.newFixedThreadPool(connections);
int rounds = 200_000;
int perThread = rounds / connections;
CompletableFuture[] futures = new CompletableFuture[connections];
Long start = System.currentTimeMillis();
for (int i = 0; i < connections; i++) {
futures[i] = CompletableFuture.runAsync(() -> {
pool.safelyDo(jedis -> {
for(int j = 0; j < perThread; j++) {
jedis.set("key" + Math.random(), RandomStringUtils.random(50));
}
});
}, exec);