Skip to content

Commit

Permalink
Minor updates for review comments
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Nov 9, 2023
1 parent 45d7f6e commit a8c2735
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public interface AsyncClient extends Client {

long DEFAULT_TIMEOUT = 1000;
long DEFAULT_TIMEOUT = 1000; // Milliseconds

Future<?> asyncSet(String key, String value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

/** Benchmarking app for reporting performance of various redis-rs Java-clients */
/** Benchmarking app for reporting performance of various Redis Java-clients */
public class BenchmarkingApp {

// main application entrypoint
Expand Down Expand Up @@ -63,8 +63,8 @@ public static void main(String[] args) {
testClientSetGet(LettuceAsyncClient::new, runConfiguration, true);
}
break;
case BABUSHKA:
System.out.println("Babushka not yet configured");
case BABUSHKA_ASYNC:
System.out.println("Babushka async not yet configured");
break;
}
}
Expand Down Expand Up @@ -149,20 +149,16 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce
return Stream.of(
ClientName.JEDIS,
ClientName.JEDIS_ASYNC,
ClientName.BABUSHKA,
// ClientName.BABUSHKA_ASYNC,
ClientName.BABUSHKA_ASYNC,
ClientName.LETTUCE,
ClientName.LETTUCE_ASYNC);
case ALL_ASYNC:
return Stream.of(
ClientName.JEDIS_ASYNC,
// ClientName.BABUSHKA_ASYNC,
ClientName.BABUSHKA_ASYNC,
ClientName.LETTUCE_ASYNC);
case ALL_SYNC:
return Stream.of(
ClientName.JEDIS,
// ClientName.BABUSHKA,
ClientName.LETTUCE);
return Stream.of(ClientName.JEDIS, ClientName.LETTUCE);
default:
return Stream.of(e);
}
Expand Down Expand Up @@ -213,7 +209,6 @@ public enum ClientName {
JEDIS_ASYNC("Jedis async"),
LETTUCE("Lettuce"),
LETTUCE_ASYNC("Lettuce async"),
BABUSHKA("Babushka"),
BABUSHKA_ASYNC("Babushka async"),
ALL("All"),
ALL_SYNC("All sync"),
Expand Down Expand Up @@ -256,7 +251,7 @@ public RunConfiguration() {
clients =
new ClientName[] {
// ClientName.BABUSHKA_ASYNC,
ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC
ClientName.LETTUCE_ASYNC
};
host = "localhost";
port = 6379;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import javababushka.benchmarks.BenchmarkingApp;
import javababushka.benchmarks.Client;
import javababushka.benchmarks.SyncClient;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.tuple.Pair;

public class Benchmarking {
Expand Down Expand Up @@ -184,6 +183,7 @@ public static void testClientSetGet(

tasksCompleted++;
iterationIncrement = iterationCounter.getAndIncrement();
clientIndex = iterationIncrement % clients.size();
}
System.out.println(
"Tasks " + taskNumDebugging + " completed " + tasksCompleted + " tasks");
Expand Down Expand Up @@ -248,7 +248,7 @@ public static void testClientSetGet(
public static Map<ChosenAction, Operation> getActionMap(
Client client, int dataSize, boolean async) {

String value = RandomStringUtils.randomAlphanumeric(dataSize);
String value = "0".repeat(dataSize);
Map<ChosenAction, Operation> actions = new HashMap<>();
actions.put(
ChosenAction.GET_EXISTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class LettuceAsyncClientIT {
private static LettuceAsyncClient otherLettuceClient;

@BeforeAll
static void initializeJedisClient() {
static void initializeLettuceClient() {
lettuceClient = new LettuceAsyncClient();
lettuceClient.connectToRedis();

Expand Down Expand Up @@ -47,12 +47,12 @@ public void testResourceSetGet() {
try {
lettuceClient.waitForResult(setResult);
} catch (Exception e) {
fail("Can SET redis result without Exception");
fail("SET result failed with exception " + e);
}
try {
otherLettuceClient.waitForResult(otherSetResult);
} catch (Exception e) {
fail("Can SET other redis result without Exception");
fail("SET result on other client failed with exception " + e);
}

RedisFuture getResult = lettuceClient.asyncGet(key);
Expand All @@ -62,13 +62,13 @@ public void testResourceSetGet() {
try {
result = (String) lettuceClient.waitForResult(getResult);
} catch (Exception e) {
fail("Can GET redis result without Exception");
fail("GET result failed with exception " + e);
}

try {
otherResult = (String) otherLettuceClient.waitForResult(otherGetResult);
} catch (Exception e) {
fail("Can GET other redis result without Exception");
fail("GET result on other client failed with exception " + e);
}

assertEquals(value, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LettuceClientIT {
private static LettuceClient lettuceClient;

@BeforeAll
static void initializeJedisClient() {
static void initializeLettuceClient() {
lettuceClient = new LettuceClient();
lettuceClient.connectToRedis();
}
Expand Down

0 comments on commit a8c2735

Please sign in to comment.