-
Notifications
You must be signed in to change notification settings - Fork 50
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
Changes from 1 commit
6a6907e
f776f5d
faad8f6
9cb1c2f
bcf1894
2769587
4695030
c095e94
69b8dea
695246d
4cec757
fafc91e
fda85f5
60a355a
10414f4
7e068f0
2080195
9225c1b
228d59b
83df96b
b652ff8
b129835
f1b6b1a
71b6547
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
.vscode | ||
.DS_Store |
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 | ||
} |
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"} | ||
] | ||
} |
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 | ||
} |
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" |
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); |
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"} | ||
] | ||
} |
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: update to the latest version (26.38.0) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that you can safely remove this whole There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed