bench: add separate-process tenant benchmarks#95715
bench: add separate-process tenant benchmarks#95715craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
d3e241d to
badfb0f
Compare
yuzefovich
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz)
pkg/bench/foreachdb.go line 101 at r1 (raw file):
_, tenantDB := serverutils.StartTenant(b, s, base.TestTenantArgs{ TenantName: "benchtenant", TenantID: roachpb.MustMakeTenantID(10),
I initially used UseDatabase option with "cluster:"+tenantName+"/bench" value, but this made BenchmarkPgbench fail. Removing UseDatabase seems to work for all benchmarks.
pkg/bench/foreachdb.go line 105 at r1 (raw file):
// The benchmarks sometime hit the default span limit, so we increase it. // NOTE(andrei): Benchmarks drop the tables they're creating, so I'm not sure
I haven't tried running the benchmarks without this, so I dunno whether it is still relevant.
pkg/bench/bench_test.go line 1195 at r1 (raw file):
defer log.Scope(b).Close(b) ForEachDB(b, func(b *testing.B, db *sqlutils.SQLRunner) { db.Exec(b, `CREATE TABLE bench.abc (a INT PRIMARY KEY, b INT, c INT, INDEX(b), UNIQUE INDEX(c))`)
I don't understand why the in-memory tenant cockroach benchmarks didn't fail for the cases where bench. prefix was missing - perhaps it's due to explicitly specifying the DB name for OpenDBConn? If I did use similar value when starting a separate-process tenant via UseDatabase parameter, the benchmarks missing bench. prefix still failed 🤷♂️
badfb0f to
00a69e5
Compare
|
@knz could you please take a look at this? |
knz
left a comment
There was a problem hiding this comment.
Reviewed 2 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/bench/bench_test.go line 1195 at r1 (raw file):
perhaps it's due to explicitly specifying the DB name for OpenDBConn?
yes that would be my understanding as well.
If I did use similar value when starting a separate-process tenant via UseDatabase parameter, the benchmarks missing bench. prefix still failed 🤷♂️
I'm not sure I understand the operation mode. How do you "start a separate-process tenant with a UseDatabase parameter"?
pkg/bench/bench_test.go line 1198 at r2 (raw file):
defer log.Scope(b).Close(b) ForEachDB(b, func(b *testing.B, db *sqlutils.SQLRunner) { db.Exec(b, `CREATE TABLE bench.abc (a INT PRIMARY KEY, b INT, c INT, INDEX(b), UNIQUE INDEX(c))`)
I'm not sure introducing this bench. prefix everywhere is the right way to go. It makes the SQL longer and (slightly) harder to read and update.
If you can't insert the db name in the connection string, you can execute a USE or SET database statement at the beginning of the benchmark.
Some time ago we merged a change to run all benchmarks in `pkg/bench` against an in-memory tenant. Recently we introduced a local fastpath for in-process in-memory tenants which will resemble how things will look once we get to UA for single-tenant clusters. However, it is also interesting to measure how we perform with separate-process tenants (which is how we run serverless), so this commit introduces that additional config. Release note: None
00a69e5 to
01a70b0
Compare
yuzefovich
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz)
pkg/bench/bench_test.go line 1195 at r1 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
perhaps it's due to explicitly specifying the DB name for OpenDBConn?
yes that would be my understanding as well.
If I did use similar value when starting a separate-process tenant via UseDatabase parameter, the benchmarks missing bench. prefix still failed 🤷♂️
I'm not sure I understand the operation mode. How do you "start a separate-process tenant with a UseDatabase parameter"?
I specified base.TestTenantArgs.UseDatabase argument, but only I included "cluster:"+tenantName+"/bench" in there. The correct way is to just use bench there which is what this commit does. This is probably the way to go. (But it shows that I'm a complete newbie with all of this :) )
pkg/bench/bench_test.go line 1198 at r2 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
I'm not sure introducing this
bench.prefix everywhere is the right way to go. It makes the SQL longer and (slightly) harder to read and update.If you can't insert the db name in the connection string, you can execute a
USEorSET databasestatement at the beginning of the benchmark.
Fixed.
knz
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/bench/bench_test.go line 1195 at r1 (raw file):
Previously, yuzefovich (Yahor Yuzefovich) wrote…
I specified
base.TestTenantArgs.UseDatabaseargument, but only I included"cluster:"+tenantName+"/bench"in there. The correct way is to just usebenchthere which is what this commit does. This is probably the way to go. (But it shows that I'm a complete newbie with all of this :) )
To be honest the idea that TestTenantArgs has a "UseDatabase" field is utterly confusing to me. The database is a property of the client connection, not of the tenant! And the way this particular field is plumbed through obscures that fact.
But yes what you did here is correct.
|
I'm plenty confused too since I had the same mental model that the DB should be specified on the connection, and not instantiating args to create a tenant. TFTR! bors r+ |
|
Build succeeded: |
Some time ago we merged a change to run all benchmarks in
pkg/benchagainst an in-memory tenant. Recently we introduced a local fastpath for in-process in-memory tenants which will resemble how things will look once we get to UA for single-tenant clusters. However, it is also interesting to measure how we perform with separate-process tenants (which is how we run serverless), so this commit introduces that additional config.Epic: CRDB-14837
Release note: None