Skip to content

Commit 9eeece1

Browse files
Enabled capability to change default workload
1 parent 2060831 commit 9eeece1

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ The tool comes with a built-in default workload useful for immediate testing and
132132
./bin/genMongoLoad
133133
```
134134

135+
**Note about default workload:** genMongoLoad comes pre-configured with a [default collection](./resources/collections/default.json) and [default queries](./resources/queries/default.json). If you do not provide any parameters and leave the configuration setting default_workload: true, this default workload will be used.
136+
137+
If you wish to use a different default workload, you can replace these two files with your own default.json files in the same paths. This allows you to define a different collection and set of queries as the default workload.
138+
135139
**Note on config file usage:** If you do not specify the config file name (above example), genMongoLoad will use the [config.yaml](./config.yaml) by default. You can create separate configuration files if you wish and then pass it as an argument:
136140

137141
```bash

config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ debug: false
4343
# Workload Definition
4444
# ==============================================================================
4545

46-
# If true, loads the built-in "Flights" example (resources/collections/default.json).
46+
# If true, genMongoLoad will only run the default workload default (resources/collections/default.json).
4747
# If false, loads custom JSON files from the paths below.
48-
# Override via env: GENMONGOLOAD_DEFAULT_WORKLOAD
4948
default_workload: true
5049

5150
# Directories containing your custom JSON schema and query definitions.

internal/workloads/generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import (
1111

1212
// GenerateDocument creates a single document.
1313
func GenerateDocument(col config.CollectionDefinition, cfg *config.AppConfig) map[string]interface{} {
14-
if cfg.DefaultWorkload {
14+
if cfg.DefaultWorkload && col.Name == "flights" {
1515
return GenerateDefaultDocument(col)
1616
}
1717
return generateGenericDocument(col)
1818
}
1919

2020
// GenerateFallbackUpdate creates an update document when no configured query is found.
2121
func GenerateFallbackUpdate(col config.CollectionDefinition, cfg *config.AppConfig, rng *rand.Rand) map[string]interface{} {
22-
if cfg.DefaultWorkload {
22+
if cfg.DefaultWorkload && col.Name == "flights" {
2323
return GenerateDefaultUpdate(rng)
2424
}
2525
return generateGenericUpdate(col, rng)

0 commit comments

Comments
 (0)