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

PERF-5441 Adds the time_series_lastpoint_high_cardinality workload. #1218

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
25 changes: 25 additions & 0 deletions docs/generated/workloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,31 @@ currently supported lastpoint aggregate pipelines that are tested here include:



## [TimeSeriesLastpointHighCardinality](https://www.github.com/mongodb/genny/blob/master/src/workloads/query/TimeSeriesLastpointHighCardinality.yml)
### Owner
@mongodb/query-integration



### Description
This test exercises the behavior of lastpoint-type queries on time-series collections _with high
group cardinality_. The currently supported lastpoint aggregate pipelines that are tested here
include:
1. a \$sort on a meta field (both ascending and descending) and time (descending) and \$group
with \_id on the meta field and only \$first accumulators.
2. a \$sort on a meta field (both ascending and descending) and time (ascending) and \$group
with \_id on the meta field and only \$last accumulators.
3. any of the above pipelines with a preceding match predicate on a meta field.

This workload is a companion workload of [TimeSeriesLastpoint](#timeserieslastpoint) but focuses on the run-time
benefits of related optimizations by the high group cardinality of 100,000 sensorIds.



### Keywords
timeseries, aggregate, group, sort, lastpoint


## [TimeSeriesSort](https://www.github.com/mongodb/genny/blob/master/src/workloads/query/TimeSeriesSort.yml)
### Owner
@mongodb/query
Expand Down
94 changes: 32 additions & 62 deletions src/phases/query/TimeSeriesLastpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,57 @@ Description: |
CreateIndex:
Repeat: 1
Database: &db test
Operations:
- OperationName: RunCommand
OperationMetricsName: CreateIndex
OperationCommand:
createIndexes:
{ ^Parameter: { Name: "Collection", Default: "Collection0" } }
indexes:
- {
key: { ^Parameter: { Name: "IndexPattern", Default: {} } },
name: { ^Parameter: { Name: "IndexName", Default: "" } },
}
Operation:
yun-soo marked this conversation as resolved.
Show resolved Hide resolved
OperationName: RunCommand
OperationMetricsName: CreateIndex
OperationCommand:
createIndexes: &coll { ^Parameter: { Name: "Collection", Default: "Collection0" } }
indexes:
- key: { ^Parameter: { Name: "IndexPattern", Default: {} } }
name: { ^Parameter: { Name: "IndexName", Default: "" } }

#
# Queries defined here assumes that the actor is 'CrudActor'.
#

RunLastPointQuery:
Repeat: 10
Repeat: { ^Parameter: { Name: "Repeat", Default: "10" } }
Database: *db
Collection: *coll
Operations:
- OperationMetricsName: RunLastPointQuery
OperationName: RunCommand
OperationName: aggregate
OperationCommand:
aggregate:
&coll { ^Parameter: { Name: "IndexPattern", Default: "Collection0" } }
pipeline:
Pipeline:
[
&sortStage {
$sort:
&sortPattern {
^Parameter: { Name: "SortPattern", Default: {} },
},
},
&groupStage {
$group: { ^Parameter: { Name: "GroupPattern", Default: {} } },
},
&sortStage { $sort: &sortPattern { ^Parameter: { Name: "SortPattern", Default: {} } } },
&groupStage { $group: { ^Parameter: { Name: "GroupPattern", Default: {} } } },
]
cursor:
&batchSize {
batchSize: { ^Parameter: { Name: "BatchSize", Default: 100 } },
}
# In cases when we cannot optimize for a covered index sort, allow for external sorting.
allowDiskUse: true
# This predicate should select 90% of documents.
- OperationMetricsName: RunLastPointQueryWithLargePredicate
OperationName: RunCommand
OperationName: aggregate
OperationCommand:
aggregate: *coll
pipeline:
Pipeline:
[
{ $match: { "metadata.sensorId": { $gt: 10 } } },
*sortStage,
*groupStage,
]
cursor: *batchSize
# In cases when we cannot optimize for a covered index sort, allow for external sorting.
allowDiskUse: true
# This predicate should select 10% of documents.
- OperationMetricsName: RunLastPointQueryWithSmallPredicate
OperationName: RunCommand
OperationName: aggregate
OperationCommand:
aggregate: *coll
pipeline:
Pipeline:
[
{ $match: { "metadata.sensorId": { $lt: 10 } } },
*sortStage,
*groupStage,
]
cursor: *batchSize
# In cases when we cannot optimize for a covered index sort, allow for external sorting.
allowDiskUse: true
# Test the lastpoint optimization with $top or $bottom.
- OperationMetricsName: RunLastPointQueryWithTopOrBottom
OperationName: RunCommand
OperationName: aggregate
OperationCommand:
aggregate: *coll
pipeline:
Pipeline:
[
{
$group:
Expand All @@ -92,20 +70,16 @@ RunLastPointQuery:
},
},
]
cursor: *batchSize
# In cases when we cannot optimize for a covered index sort, allow for external sorting.
allowDiskUse: true

DropIndex:
Repeat: 1
Database: *db
Operations:
- OperationMetricsName: DropIndex
OperationName: RunCommand
OperationCommand:
dropIndexes:
{ ^Parameter: { Name: "Collection", Default: "Collection0" } }
index: { ^Parameter: { Name: "IndexName", Default: "" } }
Operation:
OperationMetricsName: DropIndex
OperationName: RunCommand
OperationCommand:
dropIndexes: { ^Parameter: { Name: "Collection", Default: "Collection0" } }
index: { ^Parameter: { Name: "IndexName", Default: "" } }

QuiesceActor:
Name: { ^Parameter: { Name: "Name", Default: "QuiesceActor" } }
Expand All @@ -114,12 +88,8 @@ QuiesceActor:
Database: { ^Parameter: { Name: "Database", Default: admin } }
Phases:
OnlyActiveInPhases:
Active:
{
^Parameter:
{ Name: "Active", Default: [2, 5, 8, 11, 14, 17, 18, 21] },
}
NopInPhasesUpTo: { ^Parameter: { Name: "MaxPhases", Default: 23 } }
Active: { ^Parameter: { Name: "Active", Default: [3, 6, 9, 12, 15, 18, 21, 24] } }
NopInPhasesUpTo: { ^Parameter: { Name: "MaxPhases", Default: -1 } }
PhaseConfig:
SleepBefore: 1 seconds
SleepAfter: 1 seconds
Expand Down
Loading