Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/quickperf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Github action job to test core java library features on
# downstream client libraries before they are released.
on:
pull_request:
name: quickperf
jobs:
quickperf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Run tests
run: mvn test
working-directory: samples/quickperf
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",
"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
}
15 changes: 15 additions & 0 deletions samples/quickperf/exampleconfigs/users/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Generate Data
cd ../..

mvn -q compile

mvn -q exec:java -Dexec.args="-c exampleconfigs/users/users_config.json"

mvn -q exec:java -Dexec.args="-c exampleconfigs/users/groupmgt_config.json"

mvn -q exec:java -Dexec.args="-c exampleconfigs/users/membership_config.json"

# load test random users
mvn -q exec:java -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"}
]
}
15 changes: 15 additions & 0 deletions samples/quickperf/java.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
^/\*$
^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$
^ \*$
^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$
^ \* you may not use this file except in compliance with the License\.$
^ \* You may obtain a copy of the License at$
^ \*$
^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$
^ \*$
^ \* Unless required by applicable law or agreed to in writing, software$
^ \* distributed under the License is distributed on an "AS IS" BASIS,$
^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
^ \* See the License for the specific language governing permissions and$
^ \* limitations under the License\.$
^ \*/$
10 changes: 10 additions & 0 deletions samples/quickperf/license-checks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpHeader">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
</module>
100 changes: 100 additions & 0 deletions samples/quickperf/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?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.0</version>
<name>jdbc-quickperf</name>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>sdk-platform-java-config</artifactId>
<version>3.34.0</version>
<relativePath/>
</parent>

<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.43.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>2.3.1</version>
</dependency>
<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>
</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.4.1</version>
</dependency>
<!-- Required for unit tests -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.20.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>3.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mainClass>com.google.cloud.jdbc.quickperf.QuickPerf</mainClass>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading