Skip to content

Commit b6bbd8f

Browse files
srozsnyaiolavloite
andauthored
feat: add Quickperf for simple performance testing with JDBC (googleapis#1619)
* feat:Adding Quickperf for simple performance testing with JDBC * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/ProgressTracker.java Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/QuickPerf.java Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/QuickPerf.java Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/readme.md Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/ProgressTracker.java Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/ProgressTracker.java Co-authored-by: Knut Olav Løite <[email protected]> * Update samples/quickperf/src/main/java/com/google/cloud/jdbc/quickperf/ProgressTracker.java Co-authored-by: Knut Olav Løite <[email protected]> * Updating based on review comments googleapis#1619 * Updating based on review comments * Incorporating additional changes from review googleapis#1619 * Split app into two classes to separate app driver and app following review feedback googleapis#1619 * fixed compilation issues * Update readme.md fixed markdown issues for indented bullet points * Update readme.md removed -Dexec.args from readme * Update QuickPerf.java separated thread init (for sampling) from thread execution * Update ProgressTracker.java added InterruptedException handling * chore: add parent pom and run code formatter * chore: cleanup some warnings + simplify test setup * test: add test runner for quickperf * chore: remove some more warnings * fix: include empty test file --------- Co-authored-by: Knut Olav Løite <[email protected]>
1 parent 6881512 commit b6bbd8f

File tree

23 files changed

+1684
-0
lines changed

23 files changed

+1684
-0
lines changed

.github/workflows/quickperf.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# Github action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
on:
17+
pull_request:
18+
name: quickperf
19+
jobs:
20+
quickperf:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-java@v4
25+
with:
26+
distribution: temurin
27+
java-version: 17
28+
- name: Run tests
29+
run: mvn test
30+
working-directory: samples/quickperf

samples/quickperf/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
.vscode
3+
.DS_Store
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"project": "xxxx",
3+
"instance": "xxx",
4+
"database": "xxx",
5+
"threads": 1,
6+
"iterations": 100,
7+
"query": "SELECT 1",
8+
"writeMetricToFile": false
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"project": "xxx",
3+
"instance": "xxx",
4+
"database": "users",
5+
"threads": 4,
6+
"iterations": 250,
7+
"query": "INSERT INTO GroupMgmt (group_id, grpname) VALUES(?,?)",
8+
"writeMetricToFile": false,
9+
"queryParams": [
10+
{"order": 1, "value": "#i"},
11+
{"order": 2, "value": "#s"}
12+
]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"project": "xxx",
3+
"instance": "xxx",
4+
"database": "users",
5+
"threads": 1,
6+
"iterations": 10,
7+
"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",
8+
"samplingQuery": "SELECT user_id FROM Users TABLESAMPLE RESERVOIR (100000 ROWS)",
9+
"writeMetricToFile": false,
10+
"queryParams": [
11+
{"order": 1, "value": "#pi"}
12+
]
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"project": "xxx",
3+
"instance": "xxx",
4+
"database": "users",
5+
"threads": 1,
6+
"iterations": 100,
7+
"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())",
8+
"writeMetricToFile": false
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Generate Data
4+
cd ../..
5+
6+
mvn -q compile
7+
8+
mvn -q exec:java -Dexec.args="-c exampleconfigs/users/users_config.json"
9+
10+
mvn -q exec:java -Dexec.args="-c exampleconfigs/users/groupmgt_config.json"
11+
12+
mvn -q exec:java -Dexec.args="-c exampleconfigs/users/membership_config.json"
13+
14+
# load test random users
15+
mvn -q exec:java -Dexec.args="-c exampleconfigs/users/loadtestusers.json"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CREATE TABLE GroupMgmt (
2+
group_id INT64,
3+
grpname STRING(MAX),
4+
) PRIMARY KEY(group_id);
5+
6+
CREATE TABLE Users (
7+
user_id INT64,
8+
name STRING(MAX),
9+
) PRIMARY KEY(user_id);
10+
11+
CREATE TABLE membership (
12+
user_id INT64,
13+
group_id INT64,
14+
enrolled TIMESTAMP NOT NULL OPTIONS (
15+
allow_commit_timestamp = true
16+
),
17+
) PRIMARY KEY(user_id, group_id);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"project": "xxx",
3+
"instance": "xxx",
4+
"database": "users",
5+
"threads": 1,
6+
"iterations": 1000,
7+
"query": "INSERT INTO Users (user_id, name) VALUES(?,?)",
8+
"writeMetricToFile": false,
9+
"queryParams": [
10+
{"order": 1, "value": "#i"},
11+
{"order": 2, "value": "#s"}
12+
]
13+
}

samples/quickperf/java.header

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
^/\*$
2+
^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$
3+
^ \*$
4+
^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$
5+
^ \* you may not use this file except in compliance with the License\.$
6+
^ \* You may obtain a copy of the License at$
7+
^ \*$
8+
^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$
9+
^ \*$
10+
^ \* Unless required by applicable law or agreed to in writing, software$
11+
^ \* distributed under the License is distributed on an "AS IS" BASIS,$
12+
^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
13+
^ \* See the License for the specific language governing permissions and$
14+
^ \* limitations under the License\.$
15+
^ \*/$

0 commit comments

Comments
 (0)