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

Java client jni netty #32

Merged
merged 50 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
035ef20
Add Java-client benchmarking app
acarbonetto Oct 10, 2023
0883985
spotless apply
acarbonetto Oct 10, 2023
d15ade1
Update on command line options
acarbonetto Oct 10, 2023
e3634ba
Update README
acarbonetto Oct 10, 2023
500a043
Spotless apply:
acarbonetto Oct 10, 2023
0bf1678
Update README example
acarbonetto Oct 11, 2023
12efc63
update commandline defaults for review comments
acarbonetto Oct 11, 2023
951aa8b
Remove TLS flag argument from option
acarbonetto Oct 11, 2023
adc0bb6
Add lettuce clients for benchmarking
acarbonetto Oct 10, 2023
9fc9022
Spotless apply
acarbonetto Oct 10, 2023
111fc26
Add Jedis clients
acarbonetto Oct 10, 2023
9236e9a
Add to app
acarbonetto Oct 10, 2023
49654c3
Add for-loop for data size list
acarbonetto Oct 10, 2023
b3284c1
Add TPS for all async items
acarbonetto Oct 11, 2023
8f1dfa5
spotless apply
acarbonetto Oct 11, 2023
7f690cf
Fix TPS calculations
acarbonetto Oct 11, 2023
d00a655
Accept TLS as a flag
acarbonetto Oct 11, 2023
b5e9a33
Merge branch 'java-client/add_benchmark_app' into java-client/add_jed…
acarbonetto Oct 11, 2023
3cee673
Merge branch 'java-client/add_jedis_client' into java-client/add_tps
acarbonetto Oct 11, 2023
8dcfec0
Start threads; then wait for results
acarbonetto Oct 12, 2023
a615f8a
Add java-jni client
acarbonetto Oct 18, 2023
73c448f
Handle Exceptions from client; add JniSyncClient fixes
acarbonetto Oct 19, 2023
79459f5
Clean up latency and add error checking
acarbonetto Oct 20, 2023
917dd0e
Merge remote-tracking branch 'origin/java_benchmarks' into java-clien…
Yury-Fridlyand Oct 24, 2023
9e62324
Minor fixes.
Yury-Fridlyand Oct 24, 2023
11a78a3
Fix result printing.
Yury-Fridlyand Oct 25, 2023
a2c2670
Add TPS.
Yury-Fridlyand Oct 25, 2023
4b9f8de
Remove duplicates. Reorganize and fix imports.
Yury-Fridlyand Oct 25, 2023
d6b72ac
Int ctor fix.
Yury-Fridlyand Oct 26, 2023
58f7b58
Iteration 1.
Yury-Fridlyand Oct 31, 2023
d145bdf
Iteration 2: connected!
Yury-Fridlyand Oct 31, 2023
0b03dc5
Iteration 3: `get` and `set`.
Yury-Fridlyand Nov 1, 2023
a3075d5
Iteration 4: benchmark.
Yury-Fridlyand Nov 1, 2023
5f10964
Iteration 5: some fixes.
Yury-Fridlyand Nov 2, 2023
e3f7596
Change number of threads in Benchmarking threadpool
jonathanl-bq Nov 2, 2023
49c9119
Revert "Change number of threads in Benchmarking threadpool"
jonathanl-bq Nov 2, 2023
dd7413b
Add more flushing rules and UT.
Yury-Fridlyand Nov 3, 2023
a70c907
Client clean up.
Yury-Fridlyand Nov 16, 2023
fbea007
Client optimizations. (#37)
Yury-Fridlyand Nov 16, 2023
bb9097b
Merge remote-tracking branch 'origin/java_benchmarks' into java-clien…
Yury-Fridlyand Nov 16, 2023
2f8f93a
Address PR feedback.
Yury-Fridlyand Nov 16, 2023
f0f0e79
Rename
Yury-Fridlyand Nov 17, 2023
06ca6b4
Rename2
Yury-Fridlyand Nov 17, 2023
33a09c0
Fix CI
Yury-Fridlyand Nov 17, 2023
444a28c
More fixes.
Yury-Fridlyand Nov 17, 2023
e11a0ee
Some changes.
Yury-Fridlyand Nov 17, 2023
29ba2a3
add null check
Yury-Fridlyand Nov 20, 2023
16a8680
autoflush
Yury-Fridlyand Nov 20, 2023
3f47ba2
Apply suggestions from code review
Yury-Fridlyand Nov 22, 2023
61baa41
minor changes
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
2 changes: 1 addition & 1 deletion .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SQL Java CI
name: Java CI

on:
pull_request:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
working-directory: ./python
run: |
python -m pip install --upgrade pip
pip install flake8 isort black mypy-protobuf
pip install flake8 isort black mypy-protobuf deadcode

- name: Lint with isort
working-directory: ./python
Expand All @@ -71,6 +71,11 @@ jobs:
run: |
black --target-version py36 --check --diff .

- name: Lint with deadcode
working-directory: .
run: |
deadcode . --ignore-definitions=InfoSection,Level,*protobuf*,*pytest*

- name: Start redis server
working-directory: ./python
run: redis-server &
Expand Down
5 changes: 5 additions & 0 deletions babushka-core/src/protobuf/redis_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ enum RequestType {
Decr=35;
IncrByFloat=36;
DecrBy=37;
HashGetAll=38;
HashMSet=39;
HashMGet=40;
HashIncrBy = 41;
HashIncrByFloat = 42;
}

message Command {
Expand Down
5 changes: 5 additions & 0 deletions babushka-core/src/socket_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ fn get_command(request: &Command) -> Option<Cmd> {
RequestType::IncrByFloat => Some(cmd("INCRBYFLOAT")),
RequestType::Decr => Some(cmd("DECR")),
RequestType::DecrBy => Some(cmd("DECRBY")),
RequestType::HashGetAll => Some(cmd("HGETALL")),
RequestType::HashMSet => Some(cmd("HMSET")),
RequestType::HashMGet => Some(cmd("HMGET")),
RequestType::HashIncrBy => Some(cmd("HINCRBY")),
RequestType::HashIncrByFloat => Some(cmd("HINCRBYFLOAT")),
}
}

Expand Down
8 changes: 5 additions & 3 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 Down Expand Up @@ -51,5 +53,5 @@
values = [json_object[field] for field in base_fields]
writer.writerow(values)

for json_file_full_path in sys.argv[1:-1]:
os.remove(json_file_full_path)
# for json_file_full_path in sys.argv[1:-1]:
Yury-Fridlyand marked this conversation as resolved.
Show resolved Hide resolved
# os.remove(json_file_full_path)
2 changes: 1 addition & 1 deletion benchmarks/utilities/fill_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function fill_database(
const sets = Array.from(Array(CONCURRENT_SETS).keys()).map(
async (index) => {
for (let i = 0; i < SIZE_SET_KEYSPACE / CONCURRENT_SETS; ++i) {
const key = (index * CONCURRENT_SETS + index).toString();
const key = (i * CONCURRENT_SETS + index).toString();
await client.set(key, data);
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/python/client_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ async def test_cluster_client(host: str = "localhost", port: int = 6379):

async def main():
set_console_logger(LogLevel.DEBUG)
# set_file_logger(LogLevel.DEBUG)
set_file_logger(LogLevel.DEBUG)
await test_standalone_client()
# await test_cluster_client()
await test_cluster_client()


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion java/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
BABUSHKA_NAME = { value = "BabushkaPy", force = true }
BABUSHKA_NAME = { value = "javababushka", force = true }
BABUSHKA_VERSION = "0.1.0"
2 changes: 2 additions & 0 deletions java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,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"
acarbonetto marked this conversation as resolved.
Show resolved Hide resolved

[profile.release]
lto = true
Expand Down
19 changes: 10 additions & 9 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ language api to enhance performance and limit cpu cycles at scale.

The Java client (javababushka) contains the following parts:

1. A Java client (lib folder): wrapper to rust-client
2. An examples script: to sanity test javababushka and similar java-clients against a redis host
3. A benchmark app: to performance benchmark test javababushka and similar java-clients against a redis host
1. A Java client (lib folder): wrapper to rust-client.
2. An examples script: to sanity test javababushka and similar java-clients against a redis host.
3. A benchmark app: to performance benchmark test javababushka and similar java-clients against a redis host.

## Building

Expand All @@ -29,20 +29,21 @@ These IDE plugins can auto-format code on file save or by single click:
You can run benchmarks using `./gradlew run`. You can set arguments using the args flag like:

```shell
./gradlew run --args="--clients lettuce"
./gradlew run --args="-help"
./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:
* `configuration`: Release or Debug configuration
* `resultsFile`: the results output file
* `concurrentTasks`: Number of concurrent tasks
* `concurrentTasks`: Number of concurrent tasks
* `clients`: one of: all|jedis|lettuce|babushka
* `clientCount`: Client count
* `host`: redis server host url
* `host`: redis server host url
* `port`: redis server port number
* `tls`: redis TLS configured

### Troubleshooting

* If you're unable to connect to redis (such as timeout), check your port or the TLS flag
* Only server-side certificates are supported by the TLS configured redis
* 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.
29 changes: 24 additions & 5 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 @@ -18,10 +19,25 @@ 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'

// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.24.3'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'

implementation group: 'io.netty', name: 'netty-handler', version: '4.1.100.Final'
// https://github.com/netty/netty/wiki/Native-transports
// Windows is not supported, because babushka does not support windows, because tokio does not support windows, because ... 42
implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.100.Final', classifier: 'linux-x86_64'
implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-x86_64'
implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.100.Final', classifier: 'osx-aarch_64'

//testImplementation group: 'org.slf4j', name: 'slf4j-reload4j', version: '2.0.9'
//testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.9'
acarbonetto marked this conversation as resolved.
Show resolved Hide resolved

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

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

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

This file was deleted.

Loading
Loading