forked from mongodb/genny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PERF-2360: Add new workload for untargeted sharded $lookup (mongodb#491)
- Loading branch information
1 parent
e8cc83e
commit 3cd5bf0
Showing
1 changed file
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
SchemaVersion: 2018-07-01 | ||
Owner: "@mongodb/query" | ||
Description: | | ||
This test exercises the behavior of $lookup against a sharded foreign collection. | ||
The workload consists of the following phases: | ||
1. Creating empty sharded collections distributed across all shards in the cluster. | ||
2. Populating collections with data. | ||
3. Fsync. | ||
4. Running untargeted $lookup from a sharded collection. | ||
Actors: | ||
- Name: CreateShardedCollections | ||
Type: AdminCommand | ||
Threads: 1 | ||
Phases: | ||
- Repeat: 1 | ||
Database: admin | ||
Operations: | ||
# Shard Collection0 and Collection1 using hashed sharding to ensure that the chunks are evenly | ||
# distributed across the shards. | ||
- OperationMetricsName: EnableSharding | ||
OperationName: AdminCommand | ||
OperationCommand: | ||
enableSharding: &Database test | ||
- OperationMetricsName: ShardLocalCollection | ||
OperationName: AdminCommand | ||
OperationCommand: | ||
shardCollection: test.Collection0 | ||
key: {shardKey: hashed} | ||
numInitialChunks: &NumChunks 6 | ||
- OperationMetricsName: ShardForeignCollection | ||
OperationName: AdminCommand | ||
OperationCommand: | ||
shardCollection: test.Collection1 | ||
key: {shardKey: hashed} | ||
numInitialChunks: *NumChunks | ||
# Disable the balancer so that it can't skew results while the $lookups are running. | ||
- OperationMetricsName: DisableBalancer | ||
OperationName: AdminCommand | ||
OperationCommand: | ||
balancerStop: 1 | ||
- &Nop {Nop: true} | ||
- *Nop | ||
- *Nop | ||
|
||
- Name: LoadInitialData | ||
Type: Loader | ||
Threads: 1 | ||
Phases: | ||
- *Nop | ||
- Repeat: 1 | ||
BatchSize: 1000 | ||
Threads: 1 | ||
DocumentCount: &NumDocs 3000 | ||
Database: *Database | ||
CollectionCount: 2 # Loader will populate 'Collection0' then 'Collection1'. | ||
Document: | ||
shardKey: {^RandomInt: {min: 1, max: 100}} | ||
date: &Date {^RandomDate: {min: "2020-01-01", max: "2021-01-01"}} | ||
int: {^RandomInt: {min: 1, max: 100}} | ||
- *Nop | ||
- *Nop | ||
|
||
- Name: Quiesce | ||
Type: RunCommand | ||
Threads: 1 | ||
Phases: | ||
- *Nop | ||
- *Nop | ||
- Repeat: 1 | ||
Database: admin | ||
Operations: | ||
- OperationName: RunCommand | ||
OperationCommand: | ||
fsync: 1 | ||
- *Nop | ||
|
||
- Name: RunLookups | ||
Type: RunCommand | ||
Database: *Database | ||
Phases: | ||
- *Nop | ||
- *Nop | ||
- *Nop | ||
- Repeat: 10 # Untargeted $lookup from sharded collection to sharded collection | ||
Database: *Database | ||
Operations: | ||
- OperationMetricsName: UntargetedLookupShardedToSharded | ||
OperationName: RunCommand | ||
OperationCommand: | ||
aggregate: Collection0 | ||
pipeline: | ||
[{ | ||
$lookup: { | ||
from: Collection1, | ||
let: {localInt: "$int"}, | ||
pipeline: [{ | ||
$match: { | ||
$expr: { | ||
$and: [ | ||
{$eq: ["$int", "$$localInt"]}, | ||
{$lte: ["$date", *Date]} | ||
] | ||
} | ||
} | ||
}], | ||
as: matches | ||
} | ||
}] | ||
# To get meaningful results, the entire result set should fit in a single batch. This should | ||
# be possible since both collections are small. | ||
cursor: {batchSize: *NumDocs} | ||
|
||
AutoRun: | ||
- When: | ||
mongodb_setup: | ||
$eq: shard-lite-all-feature-flags |