From b497311b5edaa7cb09ac812cc0cec6a8eaba8eb8 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Thu, 23 Nov 2023 23:19:51 -0800 Subject: [PATCH 1/6] Java: update README.md file Signed-off-by: Andrew Carbonetto --- java/README.md | 139 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 112 insertions(+), 27 deletions(-) diff --git a/java/README.md b/java/README.md index f7c3216c2f..2a830cce4d 100644 --- a/java/README.md +++ b/java/README.md @@ -1,47 +1,132 @@ -# Summary - Java Wrapper +# Getting Started - Java Wrapper -This module contains a Java-client wrapper that connects to the `Babushka`-rust-client. The rust client connects to -redis, while this wrapper provides Java-language binding. The objective of this wrapper is to provide a thin-wrapper -language api to enhance performance and limit cpu cycles at scale. +## System Requirements -## Organization +The beta release of Babushka was tested on Intel x86_64 using Ubuntu 22.04.1, and macOS 14.1. -The Java client (javababushka) contains the following parts: +## Java supported version -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. +Tested on Aamzon Corretto version 11.0.21, and 17.0.3 -## Building +## Installation and Setup -You can assemble the Java clients benchmarks by compiling using `./gradlew build`. +### Install from Gradle -## Code style +At the moment, the beta release of Babushka mush be build from source. -Code style is enforced by spotless with Google Java Format. The build fails if code formatted incorrectly, but you can auto-format code with `./gradlew spotlessApply`. -Run this command before every commit to keep code in the same style. -These IDE plugins can auto-format code on file save or by single click: -* [For Intellij IDEA](https://plugins.jetbrains.com/plugin/18321-spotless-gradle) -* [For VS Code](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-spotless-gradle) +### Build from source -## Benchmarks +Software Dependencies + +- JDK 11+ +- git +- protoc (protobuf compiler) +- Gradle + +#### Prerequisites + +```bash +sudo apt update -y +sudo apt-get install openjdk-11-jdk +VERSION=8.3 +wget https://services.gradle.org/distributions/gradle-${VERSION}-bin.zip -P /tmp +sudo apt install -y protobuf-compiler +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source "$HOME/.cargo/env" +``` + +**Dependencies installation for MacOS** +Ensure that you have a minimum Java version of JDK 11 installed on your system: + +```bash + $ echo $JAVA_HOME +/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home + +$ java -version + openjdk version "11.0.1" 2018-10-16 + OpenJDK Runtime Environment 18.9 (build 11.0.1+13) + OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) +``` + +Ensure that you have a Gradle version 8 installed on your system: +```bash +$ gradle --version +------------------------------------------------------------ +Gradle 8.3 +------------------------------------------------------------ +``` + +#### Building and installation steps +Before starting this step, make sure you've installed all software requirments. +1. Clone the repository: + ```bash + VERSION=0.1.0 # You can modify this to other released version or set it to "main" to get the unstable branch + git clone --branch ${VERSION} https://github.com/aws/babushka.git + cd babushka + ``` +2. Initialize git submodule: + ```bash + git submodule update --init --recursive + ``` +3. Generate protobuf files: + ```bash + $ cd java/ + $ ./gradle :client:protobuf + BUILD SUCCESSFUL + ``` +4. Build the client library: + ```bash + $ cd java/ + $ ./gradle :client:build + BUILD SUCCESSFUL + ``` +5. Run tests: + ```bash + $ cd java/ + $ ./gradle :client:test + BUILD SUCCESSFUL + ``` + +Other useful gradle commands: +* `./gradle :client:test` to run client unit tests +* `./gradle :client:spotlessCheck` to check for codestyle issues +* `./gradle :client:spotlessApply` to apply codestyle recommendations +* `./gradle :benchmarks:run` to run performance benchmarks + +## Basic Examples + +### Standalone Redis: + +```java +import javababushka.Client; +import response.ResponseOuterClass.Response; + +public class RedisClient { + + Client testClient = new Client(); + + public RedisClient() { + testClient.asyncConnectToRedis("localhost", 6379, false, false).get(); // expect Ok + Response setResponse = testClient.asyncSet("name", "johnsmith").get(); // expect Ok + Response getResponse = testClient.asyncGet("name").get(); // expect "johnsmith" + } + +} +``` + +### Benchmarks You can run benchmarks using `./gradlew run`. You can set arguments using the args flag like: ```shell ./gradlew run --args="-help" +<<<<<<< Updated upstream ./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 java -host localhost -port 6279 -clientCount \"1 5\" -tls" +>>>>>>> Stashed changes ``` -The following arguments are accepted: -* `resultsFile`: the results output file -* `concurrentTasks`: Number of concurrent tasks -* `clients`: one of: all|jedis|lettuce|babushka -* `clientCount`: Client count -* `host`: redis server host url -* `port`: redis server port number -* `tls`: redis TLS configured - ### Troubleshooting * Connection Timeout: From 8d40db616923b4cd58fe70f2c32b46747eb3b466 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Thu, 23 Nov 2023 23:21:22 -0800 Subject: [PATCH 2/6] Java: update README.md file Signed-off-by: Andrew Carbonetto --- java/README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/java/README.md b/java/README.md index 2a830cce4d..20ee6b24a3 100644 --- a/java/README.md +++ b/java/README.md @@ -2,11 +2,11 @@ ## System Requirements -The beta release of Babushka was tested on Intel x86_64 using Ubuntu 22.04.1, and macOS 14.1. +The beta release of Babushka was tested on Intel x86_64 using Ubuntu 22.04.1, and amd64 using macOS 14.1. ## Java supported version -Tested on Aamzon Corretto version 11.0.21, and 17.0.3 +Tested on Amazon Corretto version 11.0.21, and 17.0.3 ## Installation and Setup @@ -16,7 +16,7 @@ At the moment, the beta release of Babushka mush be build from source. ### Build from source -Software Dependencies +Software Dependencies: - JDK 11+ - git @@ -25,6 +25,7 @@ Software Dependencies #### Prerequisites +**Dependencies installation for Ubuntu** ```bash sudo apt update -y sudo apt-get install openjdk-11-jdk @@ -36,8 +37,8 @@ source "$HOME/.cargo/env" ``` **Dependencies installation for MacOS** -Ensure that you have a minimum Java version of JDK 11 installed on your system: +Ensure that you have a minimum Java version of JDK 11 installed on your system: ```bash $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home @@ -87,7 +88,7 @@ Before starting this step, make sure you've installed all software requirments. BUILD SUCCESSFUL ``` -Other useful gradle commands: +Other useful gradle developer commands: * `./gradle :client:test` to run client unit tests * `./gradle :client:spotlessCheck` to check for codestyle issues * `./gradle :client:spotlessApply` to apply codestyle recommendations @@ -120,11 +121,7 @@ You can run benchmarks using `./gradlew run`. You can set arguments using the ar ```shell ./gradlew run --args="-help" -<<<<<<< Updated upstream -./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 java -host localhost -port 6279 -clientCount \"1 5\" -tls" ->>>>>>> Stashed changes +./gradlew run --args="-resultsFile=output -dataSize \"100 1000\" -concurrentTasks \"10 100\" -clients all -host localhost -port 6279 -clientCount \"1 5\" -tls" ``` ### Troubleshooting From 2864a6ec666747ea90367d81bd2ed39fb86a5826 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Mon, 27 Nov 2023 13:11:22 -0800 Subject: [PATCH 3/6] Update java readme Signed-off-by: Andrew Carbonetto --- java/README.md | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/java/README.md b/java/README.md index 20ee6b24a3..1a99ae9e21 100644 --- a/java/README.md +++ b/java/README.md @@ -6,7 +6,8 @@ The beta release of Babushka was tested on Intel x86_64 using Ubuntu 22.04.1, an ## Java supported version -Tested on Amazon Corretto version 11.0.21, and 17.0.3 +On Linux, tested on Temurin JDK version 11.0.21, and 17.0.9. +On MacOs, tested on Amazon Corretto version 11.0.21, and 17.0.3. ## Installation and Setup @@ -21,17 +22,14 @@ Software Dependencies: - JDK 11+ - git - protoc (protobuf compiler) -- Gradle +- Rust #### Prerequisites **Dependencies installation for Ubuntu** ```bash sudo apt update -y -sudo apt-get install openjdk-11-jdk -VERSION=8.3 -wget https://services.gradle.org/distributions/gradle-${VERSION}-bin.zip -P /tmp -sudo apt install -y protobuf-compiler +sudo apt install -y protobuf-compiler openjdk-11-jdk openssl gcc curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" ``` @@ -49,14 +47,6 @@ $ java -version OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) ``` -Ensure that you have a Gradle version 8 installed on your system: -```bash -$ gradle --version ------------------------------------------------------------- -Gradle 8.3 ------------------------------------------------------------- -``` - #### Building and installation steps Before starting this step, make sure you've installed all software requirments. 1. Clone the repository: @@ -72,27 +62,27 @@ Before starting this step, make sure you've installed all software requirments. 3. Generate protobuf files: ```bash $ cd java/ - $ ./gradle :client:protobuf + $ ./gradlew :client:protobuf BUILD SUCCESSFUL ``` 4. Build the client library: ```bash $ cd java/ - $ ./gradle :client:build + $ ./gradlew :client:build BUILD SUCCESSFUL ``` 5. Run tests: ```bash $ cd java/ - $ ./gradle :client:test + $ ./gradlew :client:test BUILD SUCCESSFUL ``` Other useful gradle developer commands: -* `./gradle :client:test` to run client unit tests -* `./gradle :client:spotlessCheck` to check for codestyle issues -* `./gradle :client:spotlessApply` to apply codestyle recommendations -* `./gradle :benchmarks:run` to run performance benchmarks +* `./gradlew :client:test` to run client unit tests +* `./gradlew :client:spotlessCheck` to check for codestyle issues +* `./gradlew :client:spotlessApply` to apply codestyle recommendations +* `./gradlew :benchmarks:run` to run performance benchmarks ## Basic Examples From d32d73c1ab8404f48be813521a06473afd418f9d Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Mon, 27 Nov 2023 13:12:33 -0800 Subject: [PATCH 4/6] Update java readme Signed-off-by: Andrew Carbonetto --- java/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/README.md b/java/README.md index 1a99ae9e21..60b58f9f45 100644 --- a/java/README.md +++ b/java/README.md @@ -34,7 +34,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" ``` -**Dependencies installation for MacOS** +**Dependencies for MacOS** Ensure that you have a minimum Java version of JDK 11 installed on your system: ```bash From eb00378c7b26b9281eca8d9b4b82db5a391d53c3 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Tue, 28 Nov 2023 11:48:25 -0800 Subject: [PATCH 5/6] Update java readme with disclaimer of WIP state Signed-off-by: Andrew Carbonetto --- java/README.md | 85 +++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 49 deletions(-) diff --git a/java/README.md b/java/README.md index 60b58f9f45..62bac19bc8 100644 --- a/java/README.md +++ b/java/README.md @@ -1,19 +1,15 @@ # Getting Started - Java Wrapper -## System Requirements +## Wrapper Status -The beta release of Babushka was tested on Intel x86_64 using Ubuntu 22.04.1, and amd64 using macOS 14.1. - -## Java supported version - -On Linux, tested on Temurin JDK version 11.0.21, and 17.0.9. -On MacOs, tested on Amazon Corretto version 11.0.21, and 17.0.3. +The Java client is currently a work in progress and offers no guarantees. The client must be built from source, and +we assume no responsibilities or performance guarantees. ## Installation and Setup ### Install from Gradle -At the moment, the beta release of Babushka mush be build from source. +At the moment, the Java client must be build from source. ### Build from source @@ -48,35 +44,34 @@ $ java -version ``` #### Building and installation steps -Before starting this step, make sure you've installed all software requirments. +The Java client is currently a work in progress and offers no guarantees. Users should build at their own risk. + +Before starting this step, make sure you've installed all software requirements. 1. Clone the repository: - ```bash - VERSION=0.1.0 # You can modify this to other released version or set it to "main" to get the unstable branch - git clone --branch ${VERSION} https://github.com/aws/babushka.git - cd babushka - ``` +```bash +VERSION=0.1.0 # You can modify this to other released version or set it to "main" to get the unstable branch +git clone --branch ${VERSION} https://github.com/aws/babushka.git +cd babushka +``` 2. Initialize git submodule: - ```bash - git submodule update --init --recursive - ``` +```bash +git submodule update --init --recursive +``` 3. Generate protobuf files: - ```bash - $ cd java/ - $ ./gradlew :client:protobuf - BUILD SUCCESSFUL - ``` +```bash +cd java/ +./gradlew :client:protobuf +``` 4. Build the client library: - ```bash - $ cd java/ - $ ./gradlew :client:build - BUILD SUCCESSFUL - ``` +```bash +cd java/ +./gradlew :client:build +``` 5. Run tests: - ```bash - $ cd java/ - $ ./gradlew :client:test - BUILD SUCCESSFUL - ``` +```bash +cd java/ +$ ./gradlew :client:test +``` Other useful gradle developer commands: * `./gradlew :client:test` to run client unit tests @@ -90,19 +85,18 @@ Other useful gradle developer commands: ```java import javababushka.Client; -import response.ResponseOuterClass.Response; +import javababushka.Client.SingleResponse; -public class RedisClient { +Client client = new Client(); - Client testClient = new Client(); +SingleResponse connect = client.asyncConnectToRedis("localhost", 6379); +connect.await().isSuccess(); - public RedisClient() { - testClient.asyncConnectToRedis("localhost", 6379, false, false).get(); // expect Ok - Response setResponse = testClient.asyncSet("name", "johnsmith").get(); // expect Ok - Response getResponse = testClient.asyncGet("name").get(); // expect "johnsmith" - } - -} +SingleResponse set = client.asyncSet("key", "foobar"); +set.await().isSuccess(); + +SingleResponse get = client.asyncGet("key"); +get.await().getValue() == "foobar"; ``` ### Benchmarks @@ -113,10 +107,3 @@ You can run benchmarks using `./gradlew run`. You can set arguments using the ar ./gradlew run --args="-help" ./gradlew run --args="-resultsFile=output -dataSize \"100 1000\" -concurrentTasks \"10 100\" -clients all -host localhost -port 6279 -clientCount \"1 5\" -tls" ``` - -### Troubleshooting - -* 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. - From 74cc4519a770e54a9ea3371466aa9719d07f87cc Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Wed, 29 Nov 2023 14:40:39 -0800 Subject: [PATCH 6/6] Update work in progress announcment Signed-off-by: Andrew Carbonetto --- java/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/README.md b/java/README.md index 62bac19bc8..400858a3a1 100644 --- a/java/README.md +++ b/java/README.md @@ -1,9 +1,11 @@ # Getting Started - Java Wrapper -## Wrapper Status +## Notice: Java Wrapper - Work in Progress -The Java client is currently a work in progress and offers no guarantees. The client must be built from source, and -we assume no responsibilities or performance guarantees. +We're excited to share that the Java client is currently in development! However, it's important to note that this client +is a work in progress and is not yet complete or fully tested. Your contributions and feedback are highly encouraged as +we work towards refining and improving this implementation. Thank you for your interest and understanding as we continue +to develop this Java wrapper. ## Installation and Setup