Skip to content

Commit f77d733

Browse files
committed
Spanner CI bench
1 parent 363da19 commit f77d733

3 files changed

Lines changed: 81 additions & 2 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Spanner Thread Count Benchmark
2+
run-name: "Spanner Thread Benchmark"
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
8+
env:
9+
SPANNER_JDBC_URL: "jdbc:cloudspanner://localhost:9010/projects/emulator-project/instances/test-instance/databases/test-db;autoConfigEmulator=true;dialect=POSTGRESQL"
10+
11+
jobs:
12+
benchmark:
13+
name: "${{ matrix.test_class }} threads=${{ matrix.thread_num }}"
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
test_class:
19+
- JdbcDatabaseConditionalMutationIntegrationTest
20+
- JdbcDatabaseMultipleClusteringKeyScanIntegrationTest
21+
thread_num: [1, 2, 3, 4, 5, 6]
22+
steps:
23+
- uses: actions/checkout@v6
24+
25+
- name: Install and start Spanner emulator
26+
run: |
27+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.asc] https://packages.cloud.google.com/apt cloud-sdk main" \
28+
| sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
29+
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg \
30+
| sudo tee /usr/share/keyrings/cloud.google.asc > /dev/null
31+
sudo apt-get update -qq
32+
sudo apt-get install -y -qq google-cloud-cli-spanner-emulator
33+
EMULATOR_DIR=/usr/lib/google-cloud-sdk/bin/cloud_spanner_emulator
34+
${EMULATOR_DIR}/gateway_main \
35+
--hostname 0.0.0.0 \
36+
--grpc_port 9010 \
37+
--http_port 9020 \
38+
--grpc_binary ${EMULATOR_DIR}/emulator_main \
39+
&
40+
until curl -sf http://localhost:9020/v1/projects/emulator-project/instances > /dev/null 2>&1; do sleep 1; done
41+
42+
- name: Set up JDK 8
43+
uses: actions/setup-java@v5
44+
with:
45+
java-version: 8
46+
distribution: temurin
47+
48+
- name: Setup Gradle
49+
uses: gradle/actions/setup-gradle@v5
50+
51+
- name: Run ${{ matrix.test_class }} with ${{ matrix.thread_num }} threads
52+
env:
53+
SCALARDB_INTEGRATION_TEST_THREAD_NUM: ${{ matrix.thread_num }}
54+
ORG_GRADLE_PROJECT_javaVersion: '8'
55+
ORG_GRADLE_PROJECT_javaVendor: 'temurin'
56+
ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVersion: '8'
57+
ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVendor: 'temurin'
58+
run: |
59+
./gradlew core:integrationTestJdbc \
60+
"-Dscalardb.jdbc.url=${SPANNER_JDBC_URL}" \
61+
--tests ${{ matrix.test_class }}
62+
63+
- name: Upload test report
64+
if: always()
65+
uses: actions/upload-artifact@v7
66+
with:
67+
name: benchmark_${{ matrix.test_class }}_threads_${{ matrix.thread_num }}
68+
path: core/build/reports/tests/

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseConditionalMutationIntegrationTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ protected int getThreadNum() {
2828
return 1;
2929
}
3030

31+
String envThreadNum = System.getenv("SCALARDB_INTEGRATION_TEST_THREAD_NUM");
32+
if (envThreadNum != null) {
33+
return Integer.parseInt(envThreadNum);
34+
}
35+
3136
return super.getThreadNum();
3237
}
3338

@@ -48,4 +53,4 @@ protected Column<?> getColumnWithRandomValue(
4853
protected boolean isConditionOnBlobColumnSupported() {
4954
return !JdbcTestUtils.isOracle(rdbEngine);
5055
}
51-
}
56+
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseMultipleClusteringKeyScanIntegrationTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ protected Properties getProperties(String testName) {
2626

2727
@Override
2828
protected int getThreadNum() {
29-
if (JdbcTestUtils.isOracle(rdbEngine) || JdbcTestUtils.isSpanner(rdbEngine)) {
29+
if (JdbcTestUtils.isOracle(rdbEngine)) {
3030
return 1;
3131
}
32+
33+
String envThreadNum = System.getenv("SCALARDB_INTEGRATION_TEST_THREAD_NUM");
34+
if (envThreadNum != null) {
35+
return Integer.parseInt(envThreadNum);
36+
}
37+
3238
return super.getThreadNum();
3339
}
3440

0 commit comments

Comments
 (0)