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

Conversation

hengfengli
Copy link
Collaborator

This adds the support to run TPCC benchmarking with the following runners:

  • PGAdapter + PG JDBC
  • Spanner JDBC

In addition, we enabled the client library's metrics and added a OpenTelemetry metric in the benchmark runner to record roundtrip latencies.

olavloite and others added 30 commits February 22, 2024 11:38
The signature of the public constructor for ProxyServer was accidentally
changed in version 0.27.0. This re-instantes the constructor with the
same signature.
Copy link
Collaborator

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

I have not looked into the actual TPC-C implementation, but I assume that it is still the same as the original. The main question that I have is 'Can we use java.sql.PreparedStatement (that works for both JDBC drivers) and remove the use of the simple query mode for the PostgreSQL JDBC driver.

row =
paramQueryRow(
connection,
(tpccConfiguration.isLockScannedRanges() ? "/*@ lock_scanned_ranges=exclusive */" : "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we don't seem to add the lock_scanned_ranges hint to all queries. E.g. the query on line 368 does not add the hint. Is that intentional?
Would it otherwise make sense to move the logic for conditionally adding the hint to a query/DML statement into the paramQueryRow and similar methods, so it is easier to maintain and make sure all queries use the hint when the option has been enabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is the purpose of lock_scanned_ranges hint? I did not know we need to add it to all queries/DMLs.

I moved the logic to paramQueryRow, executeParamStatement, and also a few places using executeParamQuery.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The hint is a potential optimization in a use-case like this. Whether it actually improves throughput or not, is currently not clear to me, but in theory it might. Adding this hint makes Spanner behave more like a 'traditional' database in case of lock conflicts; instead of optimistically only taking a read-lock, it will instruct Spanner to take an exclusive write lock.

And now that I think of it: I was the one who only added this in some places.... I added it where the standard implementation would use select ... for update. Which is where we would potentially want to add this. Sorry for the confusion. Let's just leave it as is for now, and optimize this in a follow-up PR (if necessary).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, probably, it's not quite right to use exclusive lock to every query and DML. I will create a PR to revert this change.

benchmarks/tpcc/src/main/resources/application.properties Outdated Show resolved Hide resolved
benchmarks/tpcc/src/main/resources/application.properties Outdated Show resolved Hide resolved
@olavloite olavloite merged commit 6ea9343 into GoogleCloudPlatform:postgresql-dialect May 22, 2024
32 checks passed
@hengfengli hengfengli deleted the support-tpcc-benchmark branch May 23, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants