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

feat: add Quickperf for simple performance testing with JDBC #1619

Merged
merged 24 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a6907e
feat:Adding Quickperf for simple performance testing with JDBC
srozsnyai May 24, 2024
f776f5d
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
faad8f6
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
9cb1c2f
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
bcf1894
Update samples/quickperf/readme.md
srozsnyai Jul 1, 2024
2769587
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
4695030
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
c095e94
Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickper…
srozsnyai Jul 1, 2024
69b8dea
Updating based on review comments #1619
srozsnyai Jul 1, 2024
695246d
Merge branch 'quickperf' of https://github.com/srozsnyai/java-spanner…
srozsnyai Jul 1, 2024
4cec757
Updating based on review comments
srozsnyai Jul 1, 2024
fafc91e
Incorporating additional changes from review #1619
srozsnyai Jul 2, 2024
fda85f5
Split app into two classes to separate app driver and app following r…
srozsnyai Jul 2, 2024
60a355a
fixed compilation issues
srozsnyai Jul 2, 2024
10414f4
Update readme.md
srozsnyai Jul 16, 2024
7e068f0
Update readme.md
srozsnyai Jul 16, 2024
2080195
Update QuickPerf.java
srozsnyai Jul 16, 2024
9225c1b
Update ProgressTracker.java
srozsnyai Jul 16, 2024
228d59b
Merge branch 'main' into quickperf
olavloite Aug 20, 2024
83df96b
chore: add parent pom and run code formatter
olavloite Aug 20, 2024
b652ff8
chore: cleanup some warnings + simplify test setup
olavloite Aug 20, 2024
b129835
test: add test runner for quickperf
olavloite Aug 20, 2024
f1b6b1a
chore: remove some more warnings
olavloite Aug 20, 2024
71b6547
fix: include empty test file
olavloite Aug 20, 2024
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
3 changes: 3 additions & 0 deletions samples/quickperf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
.vscode
.DS_Store
9 changes: 9 additions & 0 deletions samples/quickperf/exampleconfigs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"project": "xxxx",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"instance": "xxx",
"database": "xxx",
"threads": 1,
"iterations": 100,
"query": "SELECT 1",
"writeMetricToFile": false
}
13 changes: 13 additions & 0 deletions samples/quickperf/exampleconfigs/users/groupmgt_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"project": "xxx",
"instance": "xxx",
"database": "users",
"threads": 4,
"iterations": 250,
"query": "INSERT INTO GroupMgmt (group_id, grpname) VALUES(?,?)",
"writeMetricToFile": false,
"queryParams": [
{"order": 1, "value": "#i"},
{"order": 2, "value": "#s"}
]
}
13 changes: 13 additions & 0 deletions samples/quickperf/exampleconfigs/users/loadtestusers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"project": "xxx",
"instance": "xxx",
"database": "users",
"threads": 1,
"iterations": 10,
"query": "SELECT users.user_id, membership.enrolled, GroupMgmt.grpname FROM users, GroupMgmt, membership WHERE users.user_id = ? AND users.user_id = membership.user_id AND GroupMgmt.group_id = membership.group_id",
"samplingQuery": "SELECT user_id FROM Users TABLESAMPLE RESERVOIR (100000 ROWS)",
"writeMetricToFile": false,
"queryParams": [
{"order": 1, "value": "#pi"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"project": "xxx",
"instance": "xxx",
"database": "users",
"threads": 1,
"iterations": 100,
"query": "INSERT INTO membership(user_id, group_id, enrolled) VALUES((SELECT user_id FROM Users TABLESAMPLE RESERVOIR (1 ROWS)), (SELECT group_id FROM GroupMgmt TABLESAMPLE RESERVOIR (1 ROWS)), CURRENT_TIMESTAMP())",
"writeMetricToFile": false
}
17 changes: 17 additions & 0 deletions samples/quickperf/exampleconfigs/users/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Generate Data
cd ../..

mvn -q exec:java -Dexec.mainClass="com.google.cloud.jdbc.quickperf.QuickPerf" \
-Dexec.args="-c exampleconfigs/users/users_config.json"

mvn -q exec:java -Dexec.mainClass="com.google.cloud.jdbc.quickperf.QuickPerf" \
-Dexec.args="-c exampleconfigs/users/groupmgt_config.json"

mvn -q exec:java -Dexec.mainClass="com.google.cloud.jdbc.quickperf.QuickPerf" \
-Dexec.args="-c exampleconfigs/users/membership_config.json"

# load test random users
mvn -q exec:java -Dexec.mainClass="com.google.cloud.jdbc.quickperf.QuickPerf" \
-Dexec.args="-c exampleconfigs/users/loadtestusers.json"
17 changes: 17 additions & 0 deletions samples/quickperf/exampleconfigs/users/users.ddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE GroupMgmt (
group_id INT64,
grpname STRING(MAX),
) PRIMARY KEY(group_id);

CREATE TABLE Users (
user_id INT64,
name STRING(MAX),
) PRIMARY KEY(user_id);

CREATE TABLE membership (
user_id INT64,
group_id INT64,
enrolled TIMESTAMP NOT NULL OPTIONS (
allow_commit_timestamp = true
),
) PRIMARY KEY(user_id, group_id);
13 changes: 13 additions & 0 deletions samples/quickperf/exampleconfigs/users/users_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"project": "xxx",
"instance": "xxx",
"database": "users",
"threads": 1,
"iterations": 1000,
"query": "INSERT INTO Users (user_id, name) VALUES(?,?)",
"writeMetricToFile": false,
"queryParams": [
{"order": 1, "value": "#i"},
{"order": 2, "value": "#s"}
]
}
141 changes: 141 additions & 0 deletions samples/quickperf/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.google.cloud.jdbc.quickperf</groupId>
<artifactId>jdbc-quickperf</artifactId>
<version>1.0-SNAPSHOT</version>

<name>jdbc-quickperf</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.34.0</version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: update to the latest version (26.38.0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated and moved to dependencyManagement

<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention is to list all compile time dependencies first, and then all test dependencies. So move this further down in the pom file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to test dependency group

</dependency>
<dependency>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.34.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be here. Importing a pom is something that you should only do in the dependencyManagement section above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed - its already in the dependencyManagement

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-jdbc</artifactId>
<!-- <version>2.11.5</version> -->
<version>2.16.0</version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove version here. That will make sure that you get the version of the JDBC driver that is in the libraries-bom.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
</dependency>
<!-- Required for unit tests -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
olavloite marked this conversation as resolved.
Show resolved Hide resolved
<artifactId>spring-boot</artifactId>
<version>3.2.5</version>
</dependency>

</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you can safely remove this whole pluginManagement section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed plugin management

parent pom) -->
<plugins>
<!-- clean lifecycle, see
https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see
https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see
https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>

</plugins>
</pluginManagement>
</build>
</project>
Loading
Loading