Skip to content

Commit b6a286a

Browse files
author
Amit Chauhan
committed
switched to latest yb smart driver. Also added loadBalance=true
1 parent 71dc921 commit b6a286a

File tree

3 files changed

+24
-90
lines changed

3 files changed

+24
-90
lines changed

README.md

Lines changed: 22 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ YB Workload Simulator is a Java application that simulates workloads against Yug
1010
* [Code setup and Installation](#code-setup-and-installation)
1111
* [Build the jar file](#build-the-jar-file)
1212
* [Additional parameters for YCQL workloads](#additional-parameters-for-ycql-workloads)
13-
* [How to build your own workload](#how-to-build-your-own-workload)
1413
* [Start a read and write workload](#start-a-read-and-write-workload)
15-
* [Create your own workload .java file](#create-your-own-workload-java-file)
14+
* [Create your own workload](#create-your-own-workload)
1615

1716
## Download the jar
1817

@@ -79,36 +78,12 @@ By default, workload simulator uses "Yugabyte Smart Driver". You can run the App
7978
-Dspring.profiles.active=pgdriver
8079
```
8180
82-
### Run the application on a YugabyteDB Managed cluster
81+
### Run the application on a YugabyteDB Managed cluster (Aeon)
82+
YugabyteDB smart driver doesn't connect to YugabyteDB Aeon cluster if you are running your app from your laptop. You will need to run the app from a machine which has VPC peered with Yugabyte Aeon VPC.
8383
84-
1. To connect the application to your cluster, ensure that you have downloaded the cluster SSL certificate and your computer is added to the IP allow list. Refer to [Before you begin](https://docs.yugabyte.com//preview/develop/build-apps/cloud-add-ip/).
84+
#### Workaround:
85+
If you need to run app against YugabyteDB Aeon on laptop, you can use the postgres driver. Please see "Run the application using postgres driver"
8586
86-
1. To start the application against a running YugabyteDB Managed cluster, use the following command:
87-
88-
```sh
89-
java -Dnode=<host name> \
90-
-Ddbname=<dbname> \
91-
-Ddbuser=<dbuser> \
92-
-Ddbpassword=<dbpassword> \
93-
-Dssl=true \
94-
-Dsslmode=verify-full \
95-
-Dsslrootcert=<path-to-cluster-certificate> \
96-
-jar ./yb-workload-sim-0.0.2.jar
97-
```
98-
99-
Replace the following:
100-
101-
* `host name` - the host name of your YugabyteDB cluster. For YugabyteDB Managed, select your cluster on the Clusters page, and click Settings. The host is displayed under Connection Parameters.
102-
103-
* `dbname` - the name of the database you are connecting to (the default is yugabyte).
104-
105-
* `dbuser` and `dbpassword` - the username and password for the YugabyteDB database. Use the credentials in the credentials file you downloaded when you created your cluster.
106-
107-
* `path-to-cluster-certificate` with the path to the cluster certificate on your computer.
108-
109-
1. To view the application UI, navigate to `http://localhost:8080`.
110-
111-
Additional parameters for YugabyteDB Managed to start/stop nodes and scale cluster can be provided in UI by clicking settings gear option on right hand side.
11287
11388
## Code setup and Installation
11489
@@ -134,31 +109,12 @@ A jar file gets created at : <yb-workload-sim>/target/yb-workload-simulator.jar.
134109
-Dspring.data.cassandra.sslcertpath=<path-to-root-cert> [ex. /Users/username/root.crt]
135110
```
136111
137-
## How to build your own workload
138-
139-
1. Download the latest archive from the [releases](https://github.com/YugabyteDB-Samples/yb-workload-simulator/releases) page and unzip the file.
140-
141-
1. From the root of your project run the following maven command:
142-
143-
```sh
144-
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
145-
```
146-
147-
A jar file gets created at `<yb-workload-sim>/target/yb-simu-base-app.jar`
148-
149-
You can also get the jar file in VS Code by right clicking the "WorkloadSimulationApplication.java" file and selecting Run Java.
150-
151-
![image](https://user-images.githubusercontent.com/78859174/196289685-74854a5a-1cb5-4b50-81b9-08534bab9a25.png)
152-
153-
Verify the name of the jar file in the target directory, and use the name of that file wherever you see `yb-workload-sim-0.0.2.jar`.
154-
155-
![image](https://user-images.githubusercontent.com/78859174/196288218-13d499ee-a401-4b25-b95c-6e42c64a9824.png)
156112
157113
## Start a read and write workload
158114
159115
To view the application UI, navigate to <http://localhost:8080>
160116
161-
1. In the application UI, click the hamburger icon at the top of the page beside **Active Workloads for Generic**.
117+
1. In the application UI, click the hamburger icon at the top of the page beside **Active Workloads**.
162118
163119
1. Select the **Usable Operations** tab.
164120
@@ -172,42 +128,19 @@ To view the application UI, navigate to <http://localhost:8080>
172128
173129
The Latency and Throughput charts show the workload running on the cluster.
174130
175-
## Create your own workload .java file
176-
177-
To create your workload file, do the following:
178-
179-
1. Copy the `GenericWorkload.java` file into a file with a new name. The file in this example is named "InstructionsWorkload.java".
180-
181-
![image](https://user-images.githubusercontent.com/78859174/196455986-2a4df344-26dc-4fbc-a153-e3b66a71cb6e.png)
182-
183-
There are 3 "FIX ME" sections to change the name of the class after you copy and paste the "GenericWorkload.java" file.
184-
185-
![image](https://user-images.githubusercontent.com/78859174/196456157-fd832363-496b-4b25-ba38-1d9826013517.png)
186-
187-
![image](https://user-images.githubusercontent.com/78859174/196456219-19325cf8-5ac7-400f-830f-ff1ba155b8b5.png)
188-
189-
![image](https://user-images.githubusercontent.com/78859174/196456330-4d10f7cd-8931-4f19-b664-5a58b702cbe0.png)
190-
191-
1. To be able to call the new workload, you have to modify the `WorkloadConfig.java` file in [src/main/java/com/yugabyte/simulation/config/](src/main/java/com/yugabyte/simulation/config/).
192-
193-
![image](https://user-images.githubusercontent.com/78859174/196456659-71160757-e5f5-44fc-9b0a-c87897e27292.png)
194-
195-
![image](https://user-images.githubusercontent.com/78859174/196456775-84b931c4-fccf-4abc-aaeb-d3541ad8327d.png)
196-
197-
1. Run the "WorkloadSimulationApplication.java" as a java file.
198-
199-
![image](https://user-images.githubusercontent.com/78859174/196457069-5f47b875-51a2-48cc-ae48-cf8991cc93ea.png)
200-
201-
![image](https://user-images.githubusercontent.com/78859174/196457185-dfe2ee07-f1ba-4abf-9f59-718fdeb024df.png)
202-
203-
A new "jar" file gets created in your target directory.
204-
205-
![image](https://user-images.githubusercontent.com/78859174/196457412-60f5adc1-aec1-4a14-b8ea-f63fd64a7acb.png)
206-
207-
1. You should be able to run the code with the following command (code from line 136 above):
208-
209-
![image](https://user-images.githubusercontent.com/78859174/196458425-88c0951f-c17e-41bb-98ec-d1fba7983128.png)
210-
211-
1. Navigate to <http://localhost:8080> and you will see the IP address of the machine you are using:
212-
213-
![image](https://user-images.githubusercontent.com/78859174/196458637-30acf3d6-7fed-49f1-a64e-f38447acc975.png)
131+
## Create your own workload
132+
It is very easy to bring in your Data Model and run simulations against it.
133+
1. Navigate to following directory: src/main/java/com/yugabyte/simulation/service
134+
2. Clone one of existing workloads (ex. QuikShipWorkload) and create your workload java file (example: MyAwesomeWorkload.java ).
135+
3. In this new java file, add your DDL and simulation you wish to run.
136+
4. Add a new entry for this new workload in WorkloadConfig.java file
137+
```sh
138+
@Bean(name="MyAwesomeWorkload")
139+
public WorkloadSimulation myAwesomeWorkload(){
140+
return new MyAwesomeWorkload();
141+
}
142+
```
143+
5. When running the workload override the default workload
144+
```sh
145+
-Dspring.workload=MyAwesomeWorkload
146+
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<dependency>
5050
<groupId>com.yugabyte</groupId>
5151
<artifactId>jdbc-yugabytedb</artifactId>
52-
<version>42.3.5-yb-4</version>
52+
<version>42.7.3-yb-4</version>
5353
</dependency>
5454
<dependency>
5555
<groupId>com.zaxxer</groupId>

src/main/resources/application-ybdriver.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spring:
1919
portNumber: ${port:5433}
2020
databaseName: ${dbname:yugabyte}
2121
topologyKeys: "aws.us-west-2.*"
22+
loadBalance: true
2223
#additionalEndpoints: 127.0.0.2:5433,127.0.0.3:5433
2324
#ssl: ${ssl:false}
2425
#sslmode: ${sslmode:disable}

0 commit comments

Comments
 (0)