Skip to content

Commit

Permalink
Spotless apply
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Oct 10, 2023
1 parent 0b4a5bf commit 4117580
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javababushka.benchmarks.clients.LettuceClient;
import javababushka.benchmarks.clients.LettuceAsyncClient;
import javababushka.benchmarks.clients.LettuceClient;
import org.apache.commons.cli.CommandLine;
Expand Down Expand Up @@ -228,13 +227,13 @@ public RunConfiguration() {
concurrentTasks = List.of(10, 100);
clients =
new ClientName[] {
// ClientName.BABUSHKA,
ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC
// ClientName.BABUSHKA,
ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC
};
host = "localhost";
port = 6379;
clientCount = new int[] {1, 2};
tls = false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import java.util.concurrent.Future;

/**
* A Redis client with async capabilities
*/
/** A Redis client with async capabilities */
public interface AsyncClient extends Client {

long DEFAULT_TIMEOUT = 1000;
Expand All @@ -16,4 +14,4 @@ public interface AsyncClient extends Client {
<T> T waitForResult(Future<T> future);

<T> T waitForResult(Future<T> future, long timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import javababushka.benchmarks.utils.ConnectionSettings;

/**
* A Redis client interface
*/
/** A Redis client interface */
public interface Client {
void connectToRedis();

Expand All @@ -13,4 +11,4 @@ public interface Client {
default void closeConnection() {}

String getName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import java.util.concurrent.TimeUnit;
import javababushka.benchmarks.utils.ConnectionSettings;

/**
* A Lettuce client with async capabilities
* see: https://lettuce.io/
*/
/** A Lettuce client with async capabilities see: https://lettuce.io/ */
public class LettuceAsyncClient implements AsyncClient {

RedisClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import io.lettuce.core.api.sync.RedisStringCommands;
import javababushka.benchmarks.utils.ConnectionSettings;

/**
* A Lettuce client with sync capabilities
* see: https://lettuce.io/
*/
/** A Lettuce client with sync capabilities see: https://lettuce.io/ */
public class LettuceClient implements SyncClient {

RedisClient client;
Expand Down Expand Up @@ -53,4 +50,4 @@ public void closeConnection() {
public String getName() {
return "Lettuce";
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package javababushka.benchmarks.clients;

/**
* A Redis client with sync capabilities
*/
/** A Redis client with sync capabilities */
public interface SyncClient extends Client {
void set(String key, String value);

String get(String key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javababushka.benchmarks.clients.AsyncClient;
import javababushka.benchmarks.BenchmarkingApp;
import javababushka.benchmarks.clients.AsyncClient;
import javababushka.benchmarks.clients.Client;
import javababushka.benchmarks.clients.SyncClient;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.tuple.Pair;

/**
* Class to calculate latency on client-actions
*/
/** Class to calculate latency on client-actions */
public class Benchmarking {
static final double PROB_GET = 0.8;
static final double PROB_GET_EXISTING_KEY = 0.8;
Expand Down Expand Up @@ -234,27 +232,27 @@ public static Pair<ChosenAction, Long> measurePerformance(
ChosenAction.GET_EXISTING,
async
? () ->
((AsyncClient) client)
.asyncGet(generateKeySet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
((AsyncClient) client)
.asyncGet(generateKeySet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).get(generateKeySet()));
actions.put(
ChosenAction.GET_NON_EXISTING,
async
? () ->
((AsyncClient) client)
.asyncGet(generateKeyGet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
((AsyncClient) client)
.asyncGet(generateKeyGet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).get(generateKeyGet()));
actions.put(
ChosenAction.SET,
async
? () ->
((AsyncClient) client)
.asyncSet(generateKeySet(), value)
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
((AsyncClient) client)
.asyncSet(generateKeySet(), value)
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).set(generateKeySet(), value));

return getLatency(actions);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package javababushka.benchmarks.utils;

/**
* enum for actions
*/
/** enum for actions */
public enum ChosenAction {
GET_NON_EXISTING,
GET_EXISTING,
SET
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package javababushka.benchmarks.utils;

/**
* Redis-client settings
*/
/** Redis-client settings */
public class ConnectionSettings {
public String host;
public int port;
Expand All @@ -13,4 +11,4 @@ public ConnectionSettings(String host, int port, boolean useSsl) {
this.port = port;
this.useSsl = useSsl;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package javababushka.benchmarks.utils;

/**
* Raw timing results in nanoseconds
*/
/** Raw timing results in nanoseconds */
public class LatencyResults {
public final double avgLatency;
public final long p50Latency;
Expand All @@ -18,4 +16,4 @@ public LatencyResults(
this.p99Latency = p99Latency;
this.stdDeviation = stdDeviation;
}
}
}

0 comments on commit 4117580

Please sign in to comment.