Skip to content

Commit 1a46bfe

Browse files
committed
chore: regen protos
1 parent 61af71a commit 1a46bfe

File tree

64 files changed

+8551
-1239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+8551
-1239
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
33
"version": "8.0.0",
4-
"rollForward": "latestMinor",
4+
"rollForward": "latestMajor",
55
"allowPrerelease": false
66
}
77
}

drivers/spanner-ado-net/spanner-ado-net-benchmarks/deploy.txt

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,135 @@
11

2+
# SpannerLib, 10 clients - TPCC
3+
4+
gcloud run deploy spannerlib-dotnet-benchmark-tpcc \
5+
--region=europe-north1 \
6+
--no-allow-unauthenticated --no-cpu-throttling \
7+
--min-instances=1 --max-instances=1 \
8+
--cpu=4 --memory=2Gi \
9+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=10 \
10+
--base-image dotnet8 \
11+
--source .
12+
13+
# SpannerLib, 10 clients - TPCC - No internal retries
14+
15+
gcloud run deploy spannerlib-dotnet-benchmark-tpcc-no-internal-retries \
16+
--region=europe-north1 \
17+
--no-allow-unauthenticated --no-cpu-throttling \
18+
--min-instances=1 --max-instances=1 \
19+
--cpu=4 --memory=2Gi \
20+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=10,RETRY_ABORTS_INTERNALLY=false,CLIENT_TYPE=SpannerLibNoRetries \
21+
--base-image dotnet8 \
22+
--source .
23+
24+
# ClientLib, 10 clients - TPCC
25+
26+
gcloud run deploy spannerlib-dotnet-benchmark-tpcc-client-lib \
27+
--region=europe-north1 \
28+
--no-allow-unauthenticated --no-cpu-throttling \
29+
--min-instances=1 --max-instances=1 \
30+
--cpu=4 --memory=2Gi \
31+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=10,CLIENT_TYPE=ClientLib \
32+
--base-image dotnet8 \
33+
--source .
34+
35+
36+
37+
# SpannerLib, 50 clients - PointQuery
38+
39+
gcloud run deploy spannerlib-dotnet-benchmark-point-query \
40+
--region=europe-north1 \
41+
--no-allow-unauthenticated --no-cpu-throttling \
42+
--min-instances=1 --max-instances=1 \
43+
--cpu=4 --memory=2Gi \
44+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=PointQuery \
45+
--base-image dotnet8 \
46+
--source .
47+
48+
# ClientLib, 50 clients - PointQuery
49+
50+
gcloud run deploy spannerlib-dotnet-benchmark-point-query-client-lib \
51+
--region=europe-north1 \
52+
--no-allow-unauthenticated --no-cpu-throttling \
53+
--min-instances=1 --max-instances=1 \
54+
--cpu=4 --memory=2Gi \
55+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=PointQuery,CLIENT_TYPE=ClientLib \
56+
--base-image dotnet8 \
57+
--source .
58+
59+
# SpannerLib, 50 clients - Scalar
60+
61+
gcloud run deploy spannerlib-dotnet-benchmark-scalar \
62+
--region=europe-north1 \
63+
--no-allow-unauthenticated --no-cpu-throttling \
64+
--min-instances=1 --max-instances=1 \
65+
--cpu=4 --memory=2Gi \
66+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=Scalar \
67+
--base-image dotnet8 \
68+
--source .
69+
70+
# ClientLib, 50 clients - Scalar
71+
72+
gcloud run deploy spannerlib-dotnet-benchmark-scalar-client-lib \
73+
--region=europe-north1 \
74+
--no-allow-unauthenticated --no-cpu-throttling \
75+
--min-instances=1 --max-instances=1 \
76+
--cpu=4 --memory=2Gi \
77+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=Scalar,CLIENT_TYPE=ClientLib \
78+
--base-image dotnet8 \
79+
--source .
80+
81+
# SpannerLib, 50 clients - PointDML
82+
83+
gcloud run deploy spannerlib-dotnet-benchmark-point-dml \
84+
--region=europe-north1 \
85+
--no-allow-unauthenticated --no-cpu-throttling \
86+
--min-instances=1 --max-instances=1 \
87+
--cpu=4 --memory=2Gi \
88+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=PointDml \
89+
--base-image dotnet8 \
90+
--source .
91+
92+
93+
# ClientLib, 50 clients - PointDML
94+
95+
gcloud run deploy spannerlib-dotnet-benchmark-point-dml-client-lib \
96+
--region=europe-north1 \
97+
--no-allow-unauthenticated --no-cpu-throttling \
98+
--min-instances=1 --max-instances=1 \
99+
--cpu=4 --memory=2Gi \
100+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=50,TRANSACTION_TYPE=PointDml,CLIENT_TYPE=ClientLib \
101+
--base-image dotnet8 \
102+
--source .
103+
104+
105+
# SpannerLib, 50 clients - LargeQuery
106+
107+
gcloud run deploy spannerlib-dotnet-benchmark-large-query \
108+
--region=europe-north1 \
109+
--no-allow-unauthenticated --no-cpu-throttling \
110+
--min-instances=1 --max-instances=1 \
111+
--cpu=4 --memory=2Gi \
112+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=5,TRANSACTION_TYPE=LargeQuery \
113+
--base-image dotnet8 \
114+
--source .
115+
116+
# ClientLib, 50 clients - LargeQuery
117+
118+
gcloud run deploy spannerlib-dotnet-benchmark-large-query-client-lib \
119+
--region=europe-north1 \
120+
--no-allow-unauthenticated --no-cpu-throttling \
121+
--min-instances=1 --max-instances=1 \
122+
--cpu=4 --memory=2Gi \
123+
--set-env-vars=NUM_WAREHOUSES=100,NUM_CLIENTS=5,TRANSACTION_TYPE=LargeQuery,CLIENT_TYPE=ClientLib \
124+
--base-image dotnet8 \
125+
--source .
126+
127+
128+
129+
130+
131+
132+
2133
gcloud run deploy spannerlib-dotnet-benchmark-tpcc \
3134
--region=europe-north1 \
4135
--no-allow-unauthenticated --no-cpu-throttling \

drivers/spanner-ado-net/spanner-ado-net-benchmarks/spanner-ado-net-benchmarks.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Alpha.Google.Cloud.Spanner.DataProvider" Version="1.0.0-alpha.20251003170157" />
14+
<PackageReference Include="Alpha.Google.Cloud.Spanner.DataProvider" Version="1.0.0-alpha.20251205155619" />
15+
<PackageReference Include="Google.Cloud.Monitoring.V3" Version="3.16.0" />
1516
<PackageReference Include="Google.Cloud.Spanner.Data" Version="5.7.0" />
1617
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
1718
</ItemGroup>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Google.Cloud.Spanner.DataProvider.Benchmarks.tpcc;
2+
3+
public abstract class AbstractRunner
4+
{
5+
public abstract Task RunAsync(CancellationToken cancellationToken);
6+
7+
public abstract Task RunTransactionAsync(CancellationToken cancellationToken);
8+
}
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
using System.Data.Common;
2+
using System.Diagnostics;
3+
using Google.Cloud.Spanner.DataProvider.Benchmarks.tpcc.loader;
4+
5+
namespace Google.Cloud.Spanner.DataProvider.Benchmarks.tpcc;
6+
7+
public class BasicsRunner : AbstractRunner
8+
{
9+
private readonly Stats _stats;
10+
private readonly DbConnection _connection;
11+
private readonly Program.BenchmarkType _benchmarkType;
12+
private readonly int _numWarehouses;
13+
private readonly int _numDistrictsPerWarehouse;
14+
private readonly int _numCustomersPerDistrict;
15+
private readonly int _numItems;
16+
17+
internal BasicsRunner(
18+
Stats stats,
19+
DbConnection connection,
20+
Program.BenchmarkType benchmarkType,
21+
int numWarehouses,
22+
int numDistrictsPerWarehouse = 10,
23+
int numCustomersPerDistrict = 3000,
24+
int numItems = 100_000)
25+
{
26+
_stats = stats;
27+
_connection = connection;
28+
_benchmarkType = benchmarkType;
29+
_numWarehouses = numWarehouses;
30+
_numDistrictsPerWarehouse = numDistrictsPerWarehouse;
31+
_numCustomersPerDistrict = numCustomersPerDistrict;
32+
_numItems = numItems;
33+
}
34+
35+
public override async Task RunAsync(CancellationToken cancellationToken)
36+
{
37+
while (!cancellationToken.IsCancellationRequested)
38+
{
39+
await RunTransactionAsync(cancellationToken);
40+
var delay = Random.Shared.Next(10, 100);
41+
await Task.Delay(delay, cancellationToken);
42+
}
43+
}
44+
45+
public override async Task RunTransactionAsync(CancellationToken cancellationToken)
46+
{
47+
switch (_benchmarkType)
48+
{
49+
case Program.BenchmarkType.PointQuery:
50+
await PointQueryAsync(cancellationToken);
51+
break;
52+
case Program.BenchmarkType.Scalar:
53+
await ScalarAsync(cancellationToken);
54+
break;
55+
case Program.BenchmarkType.LargeQuery:
56+
await LargeQueryAsync(cancellationToken);
57+
break;
58+
case Program.BenchmarkType.PointDml:
59+
await PointDmlAsync(cancellationToken);
60+
break;
61+
default:
62+
throw new NotSupportedException($"Transaction type {_benchmarkType} is not supported.");
63+
}
64+
}
65+
66+
private async Task PointQueryAsync(CancellationToken cancellationToken)
67+
{
68+
var watch = Stopwatch.StartNew();
69+
await using var command = CreatePointReadCommand();
70+
var numRows = 0;
71+
await using var reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
72+
while (await reader.ReadAsync(cancellationToken).ConfigureAwait(false))
73+
{
74+
for (var col = 0; col < reader.FieldCount; col++)
75+
{
76+
_ = reader.GetValue(col);
77+
}
78+
numRows++;
79+
}
80+
if (numRows != 1)
81+
{
82+
throw new InvalidOperationException("Unexpected number of rows returned: " + numRows);
83+
}
84+
watch.Stop();
85+
_stats.RegisterOperationLatency(Program.BenchmarkType.PointQuery, watch.Elapsed.TotalMilliseconds);
86+
}
87+
88+
private async Task ScalarAsync(CancellationToken cancellationToken)
89+
{
90+
var watch = Stopwatch.StartNew();
91+
await using var command = CreatePointReadCommand();
92+
var item = await command.ExecuteScalarAsync(cancellationToken);
93+
if (item == null)
94+
{
95+
throw new InvalidOperationException("No row returned");
96+
}
97+
watch.Stop();
98+
_stats.RegisterOperationLatency(Program.BenchmarkType.Scalar, watch.Elapsed.TotalMilliseconds);
99+
}
100+
101+
private async Task PointDmlAsync(CancellationToken cancellationToken)
102+
{
103+
var warehouseId = DataLoader.ReverseBitsUnsigned((ulong)Random.Shared.Next(_numWarehouses));
104+
var districtId = DataLoader.ReverseBitsUnsigned((ulong)Random.Shared.Next(_numDistrictsPerWarehouse));
105+
var customerId = DataLoader.ReverseBitsUnsigned((ulong)Random.Shared.Next(_numCustomersPerDistrict));
106+
107+
var watch = Stopwatch.StartNew();
108+
await using var command = _connection.CreateCommand();
109+
command.CommandText = "update customer set c_data=$1 where w_id=$2 and d_id=$3 and c_id=$4";
110+
AddParameter(command, "p1", DataLoader.RandomString(500));
111+
AddParameter(command, "p2", warehouseId);
112+
AddParameter(command, "p3", districtId);
113+
AddParameter(command, "p4", customerId);
114+
var updated = await command.ExecuteNonQueryAsync(cancellationToken);
115+
if (updated != 1)
116+
{
117+
throw new InvalidOperationException("Unexpected affected rows: " + updated);
118+
}
119+
watch.Stop();
120+
_stats.RegisterOperationLatency(Program.BenchmarkType.PointDml, watch.Elapsed.TotalMilliseconds);
121+
}
122+
123+
private async Task LargeQueryAsync(CancellationToken cancellationToken)
124+
{
125+
await using var command = _connection.CreateCommand();
126+
command.CommandText = "select * from customer limit $1 offset $2";
127+
AddParameter(command, "p1", 100_000L);
128+
AddParameter(command, "p2", Random.Shared.Next(1, 1001));
129+
await using var reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
130+
// Fetch the first row outside the measurement to ensure a fair comparison between clients that delay the
131+
// query execution to the first read, and those that don't.
132+
await reader.ReadAsync(cancellationToken).ConfigureAwait(false);
133+
134+
var watch = Stopwatch.StartNew();
135+
while (await reader.ReadAsync(cancellationToken).ConfigureAwait(false))
136+
{
137+
for (var col = 0; col < reader.FieldCount; col++)
138+
{
139+
_ = reader.GetValue(col);
140+
}
141+
}
142+
watch.Stop();
143+
_stats.RegisterOperationLatency(Program.BenchmarkType.LargeQuery, watch.Elapsed.TotalMilliseconds);
144+
}
145+
146+
private DbCommand CreatePointReadCommand()
147+
{
148+
var warehouseId = DataLoader.ReverseBitsUnsigned((ulong)Random.Shared.Next(_numWarehouses));
149+
var itemId = DataLoader.ReverseBitsUnsigned((ulong)Random.Shared.Next(_numItems));
150+
151+
var command = _connection.CreateCommand();
152+
command.CommandText = "select * from stock where s_i_id=$1 and w_id=$2";
153+
AddParameter(command, "p1", itemId);
154+
AddParameter(command, "p2", warehouseId);
155+
156+
return command;
157+
}
158+
159+
private void AddParameter(DbCommand command, string name, object value)
160+
{
161+
var itemParameter = command.CreateParameter();
162+
itemParameter.ParameterName = name;
163+
itemParameter.Value = value;
164+
command.Parameters.Add(itemParameter);
165+
}
166+
167+
}

0 commit comments

Comments
 (0)