Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jedis and Lettuce benchmarks #1

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
06574ea
Add Jedis and Lettuce benchmarks
jonathanl-bq Sep 7, 2023
5990767
Start ignoring .gradle files
jonathanl-bq Sep 8, 2023
6ae93f5
Update gitignore and remove generated files from git
acarbonetto Oct 3, 2023
8203c4d
Update gitignore and remove generated files from git
acarbonetto Sep 8, 2023
e517744
Update gitignore and remove generated files from git
acarbonetto Sep 8, 2023
2a11e9a
Add benchmarks for GET non-existing
jonathanl-bq Sep 8, 2023
cbb0dcb
Revert "Update gitignore and remove generated files from git"
acarbonetto Sep 8, 2023
5f51a5b
fix redis-rs submodules
acarbonetto Sep 8, 2023
52df672
Randomize commands in Java benchmarks
jonathanl-bq Sep 13, 2023
84f0efc
rename chooseAction to randomAction
jonathanl-bq Sep 14, 2023
1983974
Add a Java benchmarking app (#7)
acarbonetto Sep 20, 2023
6c1fb45
Add Readme and update install_and_test script to runJava
acarbonetto Sep 20, 2023
46d0cf6
Add Readme and update install_and_test script to runJava
acarbonetto Sep 20, 2023
d526f96
Combine java pipeline and java benchmarks (#8)
Yury-Fridlyand Sep 22, 2023
436da8f
Add sync and async clients both to tests. (#12)
Yury-Fridlyand Sep 25, 2023
016f5f6
Move duplicated logic in benchmark JS scripts to a single file, and c…
acarbonetto Sep 25, 2023
e57c1ff
Add dataSize option to java benchmark. (#11)
Yury-Fridlyand Sep 26, 2023
8664d05
Rename jabushka to javababushka (#14)
acarbonetto Sep 26, 2023
b15f93e
Add missing renames. (#17)
Yury-Fridlyand Sep 27, 2023
1bab56a
Add option to run tests on multiple clients in concurrency (#16)
Yury-Fridlyand Oct 5, 2023
d99d27a
Update redis-rs to match main branch
acarbonetto Oct 6, 2023
540f49a
Create clients only once per iteration (#19)
acarbonetto Oct 6, 2023
65090b4
Updated ClientCount to client_count for uniformity.
SanHalacogluImproving Oct 17, 2023
8a0449d
Convert client count to snake case for rust benchmark. (#27)
SanHalacogluImproving Oct 18, 2023
c3d235a
Add json reporting. (#10)
Yury-Fridlyand Oct 20, 2023
fe9bb98
Merge remote-tracking branch 'upstream/main' into java_benchmarks
Yury-Fridlyand Oct 25, 2023
d533b7f
Typo fix.
Yury-Fridlyand Oct 25, 2023
9cbc9c2
Typo fix.
Yury-Fridlyand Oct 25, 2023
b00a205
Merge branch 'java_benchmarks' of github.com:Bit-Quill/babushka into …
Yury-Fridlyand Oct 25, 2023
a62fe92
fix java install_and_test script variables
acarbonetto Nov 6, 2023
30f2f62
Merge branch 'main' into java_benchmarks
acarbonetto Nov 6, 2023
05590b0
Java benchmarks clusters (#34)
acarbonetto Nov 14, 2023
bcf188c
Clean up timer
acarbonetto Nov 14, 2023
b50d57e
Java client jni netty (#32)
Yury-Fridlyand Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- babushka-core/**
- submodules/**
- "java/**"
- ".github/workflows/java.yml"
- ".github/workflows/java.yml"

# Run only most latest job on a branch and cancel previous ones
concurrency:
Expand Down Expand Up @@ -41,12 +41,11 @@ jobs:
distribution: "temurin"
java-version: ${{ matrix.java }}

- name: Install and run protoc (protobuf)
- name: Install protoc (protobuf)
run: |
sudo apt update
sudo apt install -y protobuf-compiler
mkdir -p java/client/src/main/java/org/babushka/javababushka/generated
protoc -Iprotobuf=babushka-core/src/protobuf/ --java_out=java/client/src/main/java/org/babushka/javababushka/generated babushka-core/src/protobuf/*.proto

- name: Build rust part
working-directory: java
run: cargo build
Expand Down
42 changes: 0 additions & 42 deletions .vscode/launch.json

This file was deleted.

37 changes: 0 additions & 37 deletions .vscode/settings.json

This file was deleted.

41 changes: 0 additions & 41 deletions .vscode/tasks.json

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/csharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int num_of_concurrent_tasks
{"num_of_tasks", num_of_concurrent_tasks},
{"data_size", data_size},
{"tps", tps},
{"clientCount", clients.Length},
{"client_count", clients.Length},
{"is_cluster", "false"}
};
result = result
Expand Down
38 changes: 35 additions & 3 deletions benchmarks/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ runAllBenchmarks=1
runPython=0
runNode=0
runCsharp=0
runJava=0
runRust=0
concurrentTasks="1 10 100 1000"
dataSize="100 4000"
clientCount="1"
chosenClients="all"
host="localhost"
port=6379
tlsFlag="--tls"
javaTlsFlag="-tls"

function runPythonBenchmark(){
# generate protobuf files
Expand Down Expand Up @@ -68,6 +71,12 @@ function runCSharpBenchmark(){
dotnet run --configuration Release --resultsFile=../$1 --dataSize $2 --concurrentTasks $concurrentTasks --clients $chosenClients --host $host --clientCount $clientCount $tlsFlag $portFlag
}

function runJavaBenchmark(){
cd ${BENCH_FOLDER}/../java
echo "./gradlew run --args=\"-resultsFile ${BENCH_FOLDER}/$1 -dataSize \"$2\" -concurrentTasks \"$concurrentTasks\" -clientCount \"$clientCount\" -clients $chosenClients -host $host $javaPortFlag $javaTlsFlag $javaClusterFlag\""
./gradlew run --args="-resultsFile \"${BENCH_FOLDER}/$1\" -dataSize \"$2\" -concurrentTasks \"$concurrentTasks\" -clients \"$chosenClients\" -host $host $javaPortFlag -clientCount \"$clientCount\" $javaTlsFlag $javaClusterFlag"
}

function runRustBenchmark(){
rustConcurrentTasks=
for value in $concurrentTasks
Expand Down Expand Up @@ -109,7 +118,7 @@ function resultFileName() {

function Help() {
echo Running the script without any arguments runs all benchmarks.
echo Pass -node, -csharp, -python as arguments in order to run the node, csharp, or python benchmarks accordingly.
echo Pass -node, -csharp, -python, -java as arguments in order to run the node, csharp, python, or java benchmarks accordingly.
echo Multiple such flags can be passed.
echo Pass -no-csv to skip analysis of the results.
echo
Expand Down Expand Up @@ -185,6 +194,21 @@ do
runAllBenchmarks=0
runNode=1
;;
-java)
runAllBenchmarks=0
runJava=1
chosenClients="Babushka"
;;
-lettuce)
runAllBenchmarks=0
runJava=1
chosenClients="lettuce_async"
;;
-jedis)
runAllBenchmarks=0
runJava=1
chosenClients="Jedis"
;;
-csharp)
runAllBenchmarks=0
runCsharp=1
Expand All @@ -205,12 +229,15 @@ do
-no-csv) writeResultsCSV=0 ;;
-no-tls)
tlsFlag=
javaTlsFlag=
;;
-is-cluster)
clusterFlag="--clusterModeEnabled"
javaClusterFlag="-clusterModeEnabled"
;;
-port)
portFlag="--port "$2
javaPortFlag="-port "$2
shift
;;
esac
Expand Down Expand Up @@ -242,6 +269,13 @@ do
runCSharpBenchmark $csharpResults $currentDataSize
fi

if [ $runAllBenchmarks == 1 ] || [ $runJava == 1 ];
then
javaResults=$(resultFileName java $currentDataSize)
resultFiles+=$javaResults" "
runJavaBenchmark $javaResults $currentDataSize
fi

if [ $runAllBenchmarks == 1 ] || [ $runRust == 1 ];
then
rustResults=$(resultFileName rust $currentDataSize)
Expand All @@ -250,8 +284,6 @@ do
fi
done



flushDB

if [ $writeResultsCSV == 1 ];
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/node/node_benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function run_clients(
num_of_tasks: num_of_concurrent_tasks,
data_size,
tps,
clientCount: clients.length,
client_count: clients.length,
is_cluster,
...set_latency_results,
...get_existing_latency_results,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/python/python_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def run_clients(
"num_of_tasks": num_of_concurrent_tasks,
"data_size": data_size,
"tps": tps,
"clientCount": len(clients),
"client_count": len(clients),
"is_cluster": is_cluster,
},
**get_existing_latency_results,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async fn perform_benchmark(args: Args) {
Value::Number((number_of_operations as i64 * 1000 / stopwatch.elapsed_ms()).into()),
);
results_json.insert(
"clientCount".to_string(),
"client_count".to_string(),
Value::Number(args.client_count.into()),
);
results_json.insert(
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/utilities/csv_exporter.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/python3

import csv
import json
import os
Expand All @@ -12,7 +14,7 @@
"is_cluster",
"num_of_tasks",
"data_size",
"clientCount",
"client_count",
"tps",
"get_non_existing_p50_latency",
"get_non_existing_p90_latency",
Expand All @@ -39,7 +41,7 @@

json_file_name = os.path.basename(json_file_full_path)

languages = ["csharp", "node", "python", "rust"]
languages = ["csharp", "node", "python", "rust", "java"]
language = next(
(language for language in languages if language in json_file_name), None
)
Expand Down
1 change: 0 additions & 1 deletion java/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[env]
BABUSHKA_NAME = { value = "javababushka", force = true }
BABUSHKA_VERSION = "0.1.0"

3 changes: 2 additions & 1 deletion java/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[package]
name = "javababushka"
version = "0.0.0"
Expand All @@ -16,6 +15,8 @@ babushka = { path = "../babushka-core" }
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] }
logger_core = {path = "../logger_core"}
tracing-subscriber = "0.3.16"
jni = "0.21.1"
log = "0.4.20"

[profile.release]
lto = true
Expand Down
5 changes: 2 additions & 3 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You can run benchmarks using `./gradlew run`. You can set arguments using the ar

```shell
./gradlew run --args="-help"
./gradlew run --args="-resultsFile=output.csv -dataSize \"100 1000\" -concurrentTasks \"10 100\" -clients all -host localhost -port 6279 -clientCount \"1 5\" -tls"
./gradlew run --args="-resultsFile=output.json -dataSize \"100 1000\" -concurrentTasks \"10 100\" -clients all -host localhost -port 6279 -clientCount \"1 5\" -tls"
```

The following arguments are accepted:
Expand All @@ -44,7 +44,6 @@ The following arguments are accepted:

### Troubleshooting

* Connection Timeout:
* Connection Timeout:
* If you're unable to connect to redis, check that you are connecting to the correct host, port, and TLS configuration.
* Only server-side certificates are supported by the TLS configured redis.

21 changes: 15 additions & 6 deletions java/benchmarks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'io.freefair.lombok'
}

repositories {
Expand All @@ -9,6 +10,8 @@ repositories {
}

dependencies {
implementation project(':client')

// Use JUnit test framework.
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'

Expand All @@ -18,6 +21,10 @@ dependencies {
implementation 'io.lettuce:lettuce-core:6.2.6.RELEASE'
implementation 'commons-cli:commons-cli:1.5.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'

compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
}

// Apply a specific Java toolchain to ease working on different environments.
Expand All @@ -30,12 +37,14 @@ java {
application {
// Define the main class for the application.
mainClass = 'javababushka.benchmarks.BenchmarkingApp'
applicationDefaultJvmArgs += "-Djava.library.path=${projectDir}/../target/release:${projectDir}/../target/debug"
}

tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
jvmArgs "-Djava.library.path=${projectDir}/../target/release:${projectDir}/../target/debug"
}
Loading
Loading