From c7b405226508a4e121c617da4ac297341ee444b2 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Mon, 13 Mar 2023 18:38:59 +0000 Subject: [PATCH 1/5] PERF-3888 Add low-priority background operation to execution control sinusoidal workload --- .../execution/SinusoidalReadWrites.yml | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/src/workloads/execution/SinusoidalReadWrites.yml b/src/workloads/execution/SinusoidalReadWrites.yml index 8119c758b3..877894ba56 100644 --- a/src/workloads/execution/SinusoidalReadWrites.yml +++ b/src/workloads/execution/SinusoidalReadWrites.yml @@ -9,6 +9,9 @@ Description: | to effectively stop work on one actor while the other reaches its peak. We then alternate for a couple repetitions. + Simultaneously, we will run the TTL monitor in the background to test that it + is deprioritized when the system is under load. + In this workload, we try to ensure that reads and writes do not overlap much. Keywords: - sinusoidal @@ -16,19 +19,26 @@ Keywords: - insertMany - find - CrudActor +- ttl dbname: &dbname mixed_sinusoidal DocumentCount: &NumDocs 500 CollectionCount: &NumColls 1 -NumPhases: &NumPhases 2 +NumPhases: &NumPhases 3 + Document: &doc a: {^RandomInt: {min: 0, max: *NumDocs}} b: {^RandomString: {length: 16}} + +ExpiredDocument: &expiredDoc + expireDate: {^Date: "1970-01-01"} # Instantly expire the document + x: 999 + Clients: Default: QueryOptions: - maxPoolSize: 1001 + maxPoolSize: 1002 ActorTemplates: - TemplateName: WritesActorWithSleepTemplate @@ -47,10 +57,12 @@ ActorTemplates: Repeat: 6 CollectionCount: *NumColls Operations: - - OperationName: insertOne + - OperationName: insertMany OperationMetricsName: WriteDocs OperationCommand: - Document: *doc + Documents: # insert regular and expired docs + - *doc + - *expiredDoc ThrowOnFailure: false - TemplateName: ReadsActorWithSleepTemplate Config: @@ -75,37 +87,56 @@ ActorTemplates: ThrowOnFailure: false Actors: - Name: Setup - Type: Loader + Type: AdminCommand Threads: 1 Phases: OnlyActiveInPhases: Active: [0] NopInPhasesUpTo: *NumPhases PhaseConfig: - # Have 500 documents ready at start Repeat: 1 - BatchSize: 100 + Database: admin + Operations: + - OperationName: AdminCommand + OperationCommand: + setParameter: 1 + ttlMonitorSleepSecs: 1 + SleepAfter: 60 seconds # Wait 60 seconds so that the new ttl sleep config is active. + + +- Name: InsertData + Type: Loader + Threads: 1 + Phases: + OnlyActiveInPhases: + Active: [1] + NopInPhasesUpTo: *NumPhases + PhaseConfig: + # Add a large set of expired documents at start to make sure TLL monitor doesn't catch up in future phases. + Repeat: 1 + BatchSize: 10_000 Threads: 1 - DocumentCount: *NumDocs + DocumentCount: 200_000 Database: *dbname CollectionCount: *NumColls - Document: *doc + Document: *expiredDoc Indexes: - - keys: {a: 1} + - keys: {expireDate: 1} + options: {expireAfterSeconds: 0} - ActorFromTemplate: TemplateName: WritesActorWithSleepTemplate TemplateParameters: Name: {^Parameter: {Name: "WritingName", Default: WritingActor_50_50}} Threads: {^Parameter: {Name: "WritingThreads", Default: 500}} - ActivePhases: [1] + ActivePhases: [2] - ActorFromTemplate: TemplateName: ReadsActorWithSleepTemplate TemplateParameters: Name: {^Parameter: {Name: "ReadingName", Default: ReadsActor_50_50}} Threads: {^Parameter: {Name: "ReadingThreads", Default: 500}} - ActivePhases: [1] + ActivePhases: [2] AutoRun: - When: From f80633d51897738ac49c9705f33a2f802b9b3179 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Tue, 21 Mar 2023 15:05:05 +0000 Subject: [PATCH 2/5] add updates and indexes to workload --- .../execution/SinusoidalReadWrites.yml | 73 +++++++++++++++++-- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/src/workloads/execution/SinusoidalReadWrites.yml b/src/workloads/execution/SinusoidalReadWrites.yml index 877894ba56..407d4352f9 100644 --- a/src/workloads/execution/SinusoidalReadWrites.yml +++ b/src/workloads/execution/SinusoidalReadWrites.yml @@ -28,8 +28,9 @@ CollectionCount: &NumColls 1 NumPhases: &NumPhases 3 Document: &doc - a: {^RandomInt: {min: 0, max: *NumDocs}} - b: {^RandomString: {length: 16}} + a: {^RandomInt: {min: 0, max: 100000}} + b: {^RandomString: {length: 1000}} + c: 0 ExpiredDocument: &expiredDoc expireDate: {^Date: "1970-01-01"} # Instantly expire the document @@ -38,7 +39,7 @@ ExpiredDocument: &expiredDoc Clients: Default: QueryOptions: - maxPoolSize: 1002 + maxPoolSize: 1503 ActorTemplates: - TemplateName: WritesActorWithSleepTemplate @@ -53,7 +54,6 @@ ActorTemplates: NopInPhasesUpTo: *NumPhases PhaseConfig: Duration: 1 minute - SleepAfter: 30 seconds Repeat: 6 CollectionCount: *NumColls Operations: @@ -62,8 +62,40 @@ ActorTemplates: OperationCommand: Documents: # insert regular and expired docs - *doc + - *doc + - *doc + - *doc + - *doc + - *expiredDoc + - *expiredDoc - *expiredDoc + - *expiredDoc + - *expiredDoc + ThrowOnFailure: false + +- TemplateName: UpdatesActorWithSleepTemplate + Config: + Name: {^Parameter: {Name: "Name", Default: UpdatesActorWithSleep}} + Type: CrudActor + Database: *dbname + Threads: {^Parameter: {Name: "Threads", Default: 100}} + Phases: + OnlyActiveInPhases: + Active: {^Parameter: {Name: "ActivePhases", Default: [1]}} + NopInPhasesUpTo: *NumPhases + PhaseConfig: + SleepBefore: 1 minute + Duration: 2 minutes + Repeat: 6 + CollectionCount: *NumColls + Operations: + - OperationName: updateMany + OperationCommand: + Filter: {a: {$gt: {^RandomInt: { min: 0, max: 100000}}}} + Update: {$set: {c: { ^RandomInt: { min: 0, max: 100000 }}}} + OperationMetricsName: UpdateDocs ThrowOnFailure: false + - TemplateName: ReadsActorWithSleepTemplate Config: Name: {^Parameter: {Name: "Name", Default: ReadsActorWithSleep}} @@ -76,15 +108,16 @@ ActorTemplates: NopInPhasesUpTo: *NumPhases PhaseConfig: SleepBefore: 30 seconds - Duration: 1 minute + Duration: 90 seconds Repeat: 6 CollectionCount: *NumColls Operations: - OperationName: find OperationCommand: - Filter: { a: { ^RandomInt: { min: 0, max: *NumDocs } } } + Filter: {a: {^RandomInt: { min: 0, max: 100000}}} OperationMetricsName: ReadDocs ThrowOnFailure: false + Actors: - Name: Setup Type: AdminCommand @@ -104,7 +137,7 @@ Actors: SleepAfter: 60 seconds # Wait 60 seconds so that the new ttl sleep config is active. -- Name: InsertData +- Name: InsertTTLData Type: Loader Threads: 1 Phases: @@ -124,6 +157,25 @@ Actors: - keys: {expireDate: 1} options: {expireAfterSeconds: 0} +- Name: InsertUpdateData + Type: Loader + Threads: 1 + Phases: + OnlyActiveInPhases: + Active: [1] + NopInPhasesUpTo: *NumPhases + PhaseConfig: + # Add a large number of regular documents with an index on 'a' + Repeat: 1 + BatchSize: 10_000 + Threads: 1 + DocumentCount: 100_000 + Database: *dbname + CollectionCount: *NumColls + Document: *doc + Indexes: + - keys: {a: 1, c: 1} + - ActorFromTemplate: TemplateName: WritesActorWithSleepTemplate TemplateParameters: @@ -131,6 +183,13 @@ Actors: Threads: {^Parameter: {Name: "WritingThreads", Default: 500}} ActivePhases: [2] +- ActorFromTemplate: + TemplateName: UpdatesActorWithSleepTemplate + TemplateParameters: + Name: {^Parameter: {Name: "UpdatingName", Default: UpdatesActor_50_50}} + Threads: {^Parameter: {Name: "UpdatingThreads", Default: 500}} + ActivePhases: [2] + - ActorFromTemplate: TemplateName: ReadsActorWithSleepTemplate TemplateParameters: From d46197c2b9c80ec647fa8d8b2f85485daded9986 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Tue, 21 Mar 2023 20:37:59 +0000 Subject: [PATCH 3/5] reduce threads in workload --- .../execution/SinusoidalReadWrites.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/workloads/execution/SinusoidalReadWrites.yml b/src/workloads/execution/SinusoidalReadWrites.yml index 407d4352f9..5ad5b27831 100644 --- a/src/workloads/execution/SinusoidalReadWrites.yml +++ b/src/workloads/execution/SinusoidalReadWrites.yml @@ -39,7 +39,7 @@ ExpiredDocument: &expiredDoc Clients: Default: QueryOptions: - maxPoolSize: 1503 + maxPoolSize: 303 ActorTemplates: - TemplateName: WritesActorWithSleepTemplate @@ -54,7 +54,6 @@ ActorTemplates: NopInPhasesUpTo: *NumPhases PhaseConfig: Duration: 1 minute - Repeat: 6 CollectionCount: *NumColls Operations: - OperationName: insertMany @@ -86,13 +85,12 @@ ActorTemplates: PhaseConfig: SleepBefore: 1 minute Duration: 2 minutes - Repeat: 6 CollectionCount: *NumColls Operations: - OperationName: updateMany OperationCommand: - Filter: {a: {$gt: {^RandomInt: { min: 0, max: 100000}}}} - Update: {$set: {c: { ^RandomInt: { min: 0, max: 100000 }}}} + Filter: {a: {$gt: 50000}} + Update: {$set: {c: {^RandomInt: {min: 0, max: 100000}}}} OperationMetricsName: UpdateDocs ThrowOnFailure: false @@ -109,12 +107,11 @@ ActorTemplates: PhaseConfig: SleepBefore: 30 seconds Duration: 90 seconds - Repeat: 6 CollectionCount: *NumColls Operations: - OperationName: find OperationCommand: - Filter: {a: {^RandomInt: { min: 0, max: 100000}}} + Filter: {a: {^RandomInt: {min: 0, max: 100000}}} OperationMetricsName: ReadDocs ThrowOnFailure: false @@ -169,7 +166,7 @@ Actors: Repeat: 1 BatchSize: 10_000 Threads: 1 - DocumentCount: 100_000 + DocumentCount: 10_000 Database: *dbname CollectionCount: *NumColls Document: *doc @@ -180,21 +177,21 @@ Actors: TemplateName: WritesActorWithSleepTemplate TemplateParameters: Name: {^Parameter: {Name: "WritingName", Default: WritingActor_50_50}} - Threads: {^Parameter: {Name: "WritingThreads", Default: 500}} + Threads: {^Parameter: {Name: "WritingThreads", Default: 100}} ActivePhases: [2] - ActorFromTemplate: TemplateName: UpdatesActorWithSleepTemplate TemplateParameters: Name: {^Parameter: {Name: "UpdatingName", Default: UpdatesActor_50_50}} - Threads: {^Parameter: {Name: "UpdatingThreads", Default: 500}} + Threads: {^Parameter: {Name: "UpdatingThreads", Default: 100}} ActivePhases: [2] - ActorFromTemplate: TemplateName: ReadsActorWithSleepTemplate TemplateParameters: Name: {^Parameter: {Name: "ReadingName", Default: ReadsActor_50_50}} - Threads: {^Parameter: {Name: "ReadingThreads", Default: 500}} + Threads: {^Parameter: {Name: "ReadingThreads", Default: 100}} ActivePhases: [2] AutoRun: From 77182d2f020d0a17306b672c4f3a1590ca3323e1 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Thu, 23 Mar 2023 13:25:12 +0000 Subject: [PATCH 4/5] only update one document per thread --- src/workloads/execution/SinusoidalReadWrites.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workloads/execution/SinusoidalReadWrites.yml b/src/workloads/execution/SinusoidalReadWrites.yml index 5ad5b27831..bebc1f8cb5 100644 --- a/src/workloads/execution/SinusoidalReadWrites.yml +++ b/src/workloads/execution/SinusoidalReadWrites.yml @@ -87,9 +87,9 @@ ActorTemplates: Duration: 2 minutes CollectionCount: *NumColls Operations: - - OperationName: updateMany + - OperationName: updateOne OperationCommand: - Filter: {a: {$gt: 50000}} + Filter: {a: {^RandomInt: {min: 0, max: 100000}}} Update: {$set: {c: {^RandomInt: {min: 0, max: 100000}}}} OperationMetricsName: UpdateDocs ThrowOnFailure: false From 73125de99fbe8e73812bc20f5671d6e2a5c656b5 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Fri, 24 Mar 2023 18:17:08 +0000 Subject: [PATCH 5/5] introduce more iteractions of read and update actors --- .../execution/SinusoidalReadWrites.yml | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/workloads/execution/SinusoidalReadWrites.yml b/src/workloads/execution/SinusoidalReadWrites.yml index bebc1f8cb5..23a381ede0 100644 --- a/src/workloads/execution/SinusoidalReadWrites.yml +++ b/src/workloads/execution/SinusoidalReadWrites.yml @@ -39,7 +39,7 @@ ExpiredDocument: &expiredDoc Clients: Default: QueryOptions: - maxPoolSize: 303 + maxPoolSize: 403 ActorTemplates: - TemplateName: WritesActorWithSleepTemplate @@ -53,7 +53,8 @@ ActorTemplates: Active: {^Parameter: {Name: "ActivePhases", Default: [1]}} NopInPhasesUpTo: *NumPhases PhaseConfig: - Duration: 1 minute + SleepBefore: 10 seconds + Repeat: 3 CollectionCount: *NumColls Operations: - OperationName: insertMany @@ -72,9 +73,9 @@ ActorTemplates: - *expiredDoc ThrowOnFailure: false -- TemplateName: UpdatesActorWithSleepTemplate +- TemplateName: ReadsActorWithSleepTemplate Config: - Name: {^Parameter: {Name: "Name", Default: UpdatesActorWithSleep}} + Name: {^Parameter: {Name: "Name", Default: ReadsActorWithSleep}} Type: CrudActor Database: *dbname Threads: {^Parameter: {Name: "Threads", Default: 100}} @@ -83,20 +84,19 @@ ActorTemplates: Active: {^Parameter: {Name: "ActivePhases", Default: [1]}} NopInPhasesUpTo: *NumPhases PhaseConfig: - SleepBefore: 1 minute - Duration: 2 minutes + SleepBefore: 15 seconds + Repeat: 3 CollectionCount: *NumColls Operations: - - OperationName: updateOne + - OperationName: find OperationCommand: Filter: {a: {^RandomInt: {min: 0, max: 100000}}} - Update: {$set: {c: {^RandomInt: {min: 0, max: 100000}}}} - OperationMetricsName: UpdateDocs + OperationMetricsName: ReadDocs ThrowOnFailure: false -- TemplateName: ReadsActorWithSleepTemplate +- TemplateName: UpdatesActorWithSleepTemplate Config: - Name: {^Parameter: {Name: "Name", Default: ReadsActorWithSleep}} + Name: {^Parameter: {Name: "Name", Default: UpdatesActorWithSleep}} Type: CrudActor Database: *dbname Threads: {^Parameter: {Name: "Threads", Default: 100}} @@ -105,14 +105,15 @@ ActorTemplates: Active: {^Parameter: {Name: "ActivePhases", Default: [1]}} NopInPhasesUpTo: *NumPhases PhaseConfig: - SleepBefore: 30 seconds - Duration: 90 seconds + SleepBefore: 20 seconds + Repeat: 3 CollectionCount: *NumColls Operations: - - OperationName: find + - OperationName: updateOne OperationCommand: Filter: {a: {^RandomInt: {min: 0, max: 100000}}} - OperationMetricsName: ReadDocs + Update: {$set: {c: {^RandomInt: {min: 0, max: 100000}}}} + OperationMetricsName: UpdateDocs ThrowOnFailure: false Actors: @@ -162,7 +163,7 @@ Actors: Active: [1] NopInPhasesUpTo: *NumPhases PhaseConfig: - # Add a large number of regular documents with an index on 'a' + # Add a large number of regular documents with an index on 'a' and 'c' Repeat: 1 BatchSize: 10_000 Threads: 1 @@ -181,17 +182,17 @@ Actors: ActivePhases: [2] - ActorFromTemplate: - TemplateName: UpdatesActorWithSleepTemplate + TemplateName: ReadsActorWithSleepTemplate TemplateParameters: - Name: {^Parameter: {Name: "UpdatingName", Default: UpdatesActor_50_50}} - Threads: {^Parameter: {Name: "UpdatingThreads", Default: 100}} + Name: {^Parameter: {Name: "ReadingName", Default: ReadsActor_50_50}} + Threads: {^Parameter: {Name: "ReadingThreads", Default: 200}} ActivePhases: [2] - ActorFromTemplate: - TemplateName: ReadsActorWithSleepTemplate + TemplateName: UpdatesActorWithSleepTemplate TemplateParameters: - Name: {^Parameter: {Name: "ReadingName", Default: ReadsActor_50_50}} - Threads: {^Parameter: {Name: "ReadingThreads", Default: 100}} + Name: {^Parameter: {Name: "UpdatingName", Default: UpdatesActor_50_50}} + Threads: {^Parameter: {Name: "UpdatingThreads", Default: 100}} ActivePhases: [2] AutoRun: