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

chore: support TPCC benchmark #1699

Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ee4dba9
chore: add tpcc benchmark
olavloite Nov 18, 2023
5e42b8a
chore: add config options
olavloite Nov 20, 2023
0c17dbf
chore: add more config options
olavloite Nov 20, 2023
0c8c7a2
feat: enable otel for tpc-c benchmark
olavloite Nov 23, 2023
856318a
fix: re-instante public constructor for ProxyServer
olavloite Nov 23, 2023
ec0e41e
fix: improve error handling and output
olavloite Nov 24, 2023
8f20143
feat: print num threads
olavloite Nov 24, 2023
30aae7b
feat: print duration
olavloite Nov 24, 2023
dabc1d5
feat: add option for disabling retries
olavloite Nov 24, 2023
e350506
feat: add optimization options
olavloite Nov 24, 2023
d9e7a67
feat: add option for lock_scanned_ranges
olavloite Nov 25, 2023
f107342
feat: lock_scanned_ranges in payment and delivery
olavloite Nov 25, 2023
ed14061
docs: add more options
olavloite Nov 25, 2023
023eff9
feat: improve data loader
olavloite Nov 25, 2023
f377f47
feat: make data loader compatible with new column names
olavloite Nov 27, 2023
bbea2cf
fix: wait for stock before order_lines
olavloite Nov 27, 2023
99ad398
feat: make OpenTelemetry configurable
olavloite Nov 27, 2023
f68c3b1
fix: delivery works with new data model
olavloite Nov 27, 2023
d7563c7
chore: update default args
olavloite Dec 1, 2023
d2129bc
Fix some issues to make it run.
hengfengli Jan 29, 2024
4e5cbbb
Remove the use of prepared statements.
hengfengli Jan 29, 2024
c923120
Add cloud spanner jdbc runner.
hengfengli Jan 29, 2024
f3fe3ae
Add opentelemetry metrics.
hengfengli Feb 22, 2024
a2d8800
Fix the merge error.
hengfengli Feb 22, 2024
6f9d5ff
Support cloud spanner JDBC runner and latency metrics
hengfengli Feb 26, 2024
a2a27ea
Merge branch 'postgresql-dialect' of github.com:hengfengli/pgadapter …
hengfengli Mar 7, 2024
d8d382b
Add gitignore and fix an issue.
hengfengli Mar 13, 2024
58027c1
Merge branch 'postgresql-dialect' of github.com:hengfengli/pgadapter …
hengfengli Mar 18, 2024
7e25b57
Enable client lib's opentelemetry metrics
hengfengli Mar 19, 2024
e46a60a
Enable the opentelemetry metrics in benchmarking.
hengfengli Apr 23, 2024
6dab453
Merge branch 'postgresql-dialect' of github.com:hengfengli/pgadapter …
hengfengli Apr 23, 2024
3fc68d4
Change to use options to choose a runner.
hengfengli Apr 30, 2024
8cf5c77
Add copyrights.
hengfengli Apr 30, 2024
78d3e6c
Add the benchmark runner's metric - roundtrip_latencies.
hengfengli May 1, 2024
d4f03b6
Fix some issues.
hengfengli May 1, 2024
6c50264
Remove the space in .gitignore.
hengfengli May 1, 2024
7a029cd
Remove the duplicated function.
hengfengli May 1, 2024
dace5ab
Set the default benchmark runner and update docs.
hengfengli May 1, 2024
d701faf
Merge branch 'postgresql-dialect' of github.com:hengfengli/pgadapter …
hengfengli May 6, 2024
826bca0
Update dependency versions.
hengfengli May 6, 2024
853b149
Fix some comments.
hengfengli May 16, 2024
9fcfc24
Fix a format issue.
hengfengli May 16, 2024
b490b6e
Update queryRow and executeQuery to use PreparedStatement.
hengfengli May 16, 2024
454dc78
Update execute to use PreparedStatement.
hengfengli May 17, 2024
09641ba
Refactor the executeParamStatement.
hengfengli May 17, 2024
c53058b
Refactor the paramQueryRow.
hengfengli May 17, 2024
6de9266
Increase the stats for aborted exception from Spanner JDBC.
hengfengli May 17, 2024
74868b1
Fix comments.
hengfengli May 22, 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 benchmarks/tpcc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tpcc-log.log
tpcc-log.log*.gz

87 changes: 87 additions & 0 deletions benchmarks/tpcc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# TPC-C Benchmark Application for PGAdapter and Cloud Spanner

This application implements the standard TPC-C benchmark and runs it against PGAdapter and a Cloud
Spanner database. It is a Java Spring Boot application. See [src/main/resources/application.properties](src/main/resources/application.properties)
for a full list of configuration options.

## Running

The application automatically starts PGAdapter together with the benchmark application. Supply the
Cloud Spanner database and your credentials using the below command. The `tpcc.benchmark-threads`
argument determines the number of threads that will execute test transactions in parallel.

```shell
mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-threads=8
--spanner.project=my-project
--spanner.instance=my-instance
--spanner.database=my-database
--pgadapter.credentials=/path/to/credentials.json
"
```

### Load data

```shell
mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-duration=PT600s
--tpcc.warehouses=10
--tpcc.benchmark-threads=1
--tpcc.load-data=true
--tpcc.truncate-before-load=false
--tpcc.run-benchmark=false
--tpcc.use-read-only-transactions=false
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
hengfengli marked this conversation as resolved.
Show resolved Hide resolved
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--pgadapter.disable-internal-retries=false
"
```

### Run benchmark

Currently, we support two options of benchmark runners: `pgadapter` and `spanner_jdbc`.

Run with the default benchmark runner (PGAdapter with PG JDBC):

```shell
mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-duration=PT600s
--tpcc.warehouses=10
--tpcc.benchmark-threads=1
--tpcc.load-data=false
--tpcc.truncate-before-load=false
--tpcc.run-benchmark=true
--tpcc.benchmark-runner=pgadapter
--tpcc.use-read-only-transactions=true
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--pgadapter.disable-internal-retries=true
"
```

Run with the benchmark runner (Spanner JDBC):

```shell
mvn spring-boot:run -Dspring-boot.run.arguments="
--tpcc.benchmark-duration=PT600s
--tpcc.warehouses=10
--tpcc.benchmark-threads=1
--tpcc.load-data=false
--tpcc.truncate-before-load=false
--tpcc.run-benchmark=true
--tpcc.benchmark-runner=spanner_jdbc
--tpcc.use-read-only-transactions=true
--tpcc.lock-scanned-ranges=false
--spanner.project=appdev-soda-spanner-staging
--spanner.instance=knut-test-ycsb
--spanner.database=tpcc2
--pgadapter.credentials=/home/loite/appdev-soda-spanner-staging.json
--pgadapter.disable-internal-retries=true
"
```
98 changes: 98 additions & 0 deletions benchmarks/tpcc/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.google.cloud.spanner</groupId>
<artifactId>pgadapter-tpcc-benchmark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>PGAdapter tpcc benchmark</name>
<description>tpcc Benchmark Runner for PGAdapter</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.38.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
<version>1.37.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- Add the PostgreSQL JDBC driver -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
</dependency>
<!-- Add the Cloud Spanner JDBC driver -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-jdbc</artifactId>
<version>2.17.0</version>
hengfengli marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<!-- Add PGAdapter as a dependency, so we can start it in-process -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-pgadapter</artifactId>
<version>0.33.1-SNAPSHOT</version>
hengfengli marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>1.35.0</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
<version>1.35.0</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
<version>1.35.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.21.1</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading
Loading