You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -6,6 +6,7 @@ It simulates real-world usage patterns by generating random data using robust BS
6
6
7
7
This tool is a complete refactor of the previous Python version, offering:
8
8
***Single Binary:** No complex dependencies or Python environment setup.
9
+
***Interactive Web UI:** A beautiful dashboard for configuring and running workloads and monitoring live telemetry.
9
10
***High Concurrency:** Utilizes Go goroutines ("Active Workers") to generate massive load with minimal client-side resource usage.
10
11
***Configuration as Code:** Fully configurable via a simple `config.yaml` file or Environment Variables.
11
12
***Extensive Data Support:** Supports all standard MongoDB BSON data types (ObjectId, Decimal128, Date, Binary, etc.) and realistic data generation via `gofakeit` (supporting complex nested objects and arrays).
@@ -19,7 +20,7 @@ This tool is a complete refactor of the previous Python version, offering:
19
20
20
21
**Option 1: Download Release**
21
22
22
-
Navigate to the [Releases] page and download the .tar.gz file matching your operating system.
23
+
Navigate to the Releases page and download the .tar.gz file matching your operating system.
23
24
24
25
1. Download and Extract
25
26
@@ -36,7 +37,7 @@ tar -xzvf plgm-darwin-arm64.tar.gz
36
37
This project includes a `Makefile` to simplify building and packaging.
If you are preparing binaries for other users (or other servers), use the main build command. This will compile binaries for Linux and Mac and automatically package them into .tar.gz files in the `bin/` folder.
51
54
52
-
To run the application, you need a configuration file. Depending on whether you want to run the built-in test or your own custom workload, you may also need to create resource folders.
55
+
```bash
56
+
# Generate all release packages
57
+
make build
58
+
59
+
# Output:
60
+
# bin/plgm-linux-amd64.tar.gz
61
+
# bin/plgm-darwin-amd64.tar.gz
62
+
# bin/plgm-darwin-arm64.tar.gz
63
+
```
64
+
65
+
### 2. Configuration
66
+
67
+
To run the application you need a configuration file. Depending on whether you want to run the built-in workload or your own custom, you may also need to create resource folders.
53
68
54
69
**Step A: Get the Config**
55
70
56
-
Download the [`config.yaml`](./config.yaml) and adjust the `uri` to point to your MongoDB instance.
71
+
Download the [`config.yaml`](./config.yaml) and make the necessary adjustments.
72
+
73
+
### 3. Choose Your Interface
74
+
75
+
`plgm` can be run completely headless via the CLI, or via a rich interactive Web Dashboard.
76
+
77
+
***Run via CLI (Headless):**
78
+
```bash
79
+
./bin/plgm
80
+
```
81
+
***Run via Web UI:**
82
+
```bash
83
+
./bin/plgm --webui
84
+
```
85
+
86
+
## The Interactive UI
87
+
88
+
`plgm` features a completely embedded Web UI. It allows you to configure your database connection, upload custom workload schemas, adjust operation ratios, and monitor real-time throughput and latency without ever touching a YAML file. It has the same functionality as the CLI version, but with an awesome UI.
89
+
90
+
#### 1. Starting the UI
91
+
To launch the UI, simply pass the `--webui` flag. The application will start a secure local server and automatically open your default web browser listening on port 9999. You can also set a custom port instead, as shown in the example below:
92
+
93
+
```bash
94
+
./bin/plgm --webui
95
+
# Or, set a custom port:
96
+
./bin/plgm --webui --webui-port=32000
97
+
```
98
+
99
+
#### 2. Configuration
100
+
The UI provides an intuitive tabbed interface to configure every aspect of your workload.
101
+
102
+
***Connection:** Set your URI, read preferences, and connection pooling limits. Passwords are never logged and are safely managed via session storage.
***Workload & Mix:** Upload your own custom `collections.json` and `queries.json` files directly through the browser, and use visual inputs to ensure your Find/Insert/Update/Delete ratios total exactly 100%. You can also run the default workload by clicking the `Use built-in Default Workload` checkbox.
***Live Telemetry:** Watch throughput (Ops/sec) and average latency (ms) stream in real-time across four distinct operation categories.
125
+
***Workload Anatomy:** A live-updating donut chart proves that your database is accurately executing the exact operation ratios you configured.
126
+
***Crosshair Sync:** Hovering over a spike on the Throughput chart will instantly highlight the exact same moment in time on the Latency chart.
127
+
128
+
#### 4. The "Time Machine" Scrubber
129
+
If you are running a long benchmark, you might miss a sudden latency spike. The UI stores a running history buffer of the benchmark data.
130
+
131
+
Simply grab the **Time Machine** slider above the charts and drag it to the left to pause the live feed and "scrub" backward in time. All line charts, sparklines, and numeric values will perfectly synchronize to show you the exact state of the database at that specific historical second. Click **Back to Live** to resume real-time monitoring.
132
+
133
+

134
+
135
+
136
+
## CLI
137
+
138
+
#### 1. Configuration
139
+
140
+
Once you have configured your connection settings and any other parameters, you can choose your workload.
59
141
60
142
***Mode 1: Default Workload (Easiest)**
61
143
@@ -71,7 +153,7 @@ Download the [`config.yaml`](./config.yaml) and adjust the `uri` to point to you
71
153
72
154
> **Important:** If you are running in Custom Mode, the application expects these folders to exist. If the folders are missing, `plgm` will revert to the embedded defaults to prevent a crash, but your custom test **will not run** until the files are in place.
73
155
74
-
###3. Run
156
+
#### 2. Run
75
157
76
158
Once configured, run the application:
77
159
@@ -80,21 +162,7 @@ Once configured, run the application:
80
162
./plgm-linux-amd64
81
163
```
82
164
83
-
**Cross-Compilation (Build for different OS)**
84
-
85
-
If you are preparing binaries for other users (or other servers), use the main build command. This will compile binaries for Linux and Mac and automatically package them into .tar.gz files in the `bin/` folder.
86
-
87
-
```bash
88
-
# Generate all release packages
89
-
make build
90
-
91
-
# Output:
92
-
# bin/plgm-linux-amd64.tar.gz
93
-
# bin/plgm-darwin-amd64.tar.gz
94
-
# bin/plgm-darwin-arm64.tar.gz
95
-
```
96
-
97
-
#### Usage
165
+
#### 3. CLI Usage
98
166
99
167
To view the full usage guide, including available flags and environment variables, run the help command:
100
168
@@ -111,21 +179,25 @@ Examples:
111
179
112
180
Flags:
113
181
-config string
114
-
Path to the configuration file (default "config.yaml")
182
+
Path to the configuration file (default "config.yaml")
115
183
-raw-injector
116
-
Enable Raw BSON Injector (High Performance Mode)
184
+
Enable Raw BSON Injector (High Performance Mode)
117
185
-raw-injector-batch int
118
-
Bulk batch size (ops per network round trip) (default 1000)
186
+
Bulk batch size (ops per network round trip) (default 1000)
119
187
-raw-injector-drop
120
-
Drop the collection before starting
188
+
Drop the collection before starting
121
189
-raw-injector-max-docs int
122
-
Maximum number of documents to operate on (default 10000000)
190
+
Maximum number of documents to operate on (default 10000000)
plgm comes with a built-in default workload useful for immediate testing and get you started right away.
261
+
## Default Workload
262
+
263
+
Regardless of rather you are running PLGM from CLI or UI, it comes with a built-in default workload useful for immediate testing and get you started right away.
187
264
```bash
188
265
# Edit config.yaml to set your URI, then run:
189
266
./bin/plgm
@@ -199,7 +276,7 @@ If you wish to use a different default workload, you can replace these two files
199
276
./bin/plgm /path/to/some/custom_config.yaml
200
277
```
201
278
202
-
### 3. Raw Injector Mode (High Performance Hardware Test) Workload
279
+
## Raw Injector Mode (High Performance Hardware Test) Workload
203
280
204
281
The **Raw Injector** is a specialized, ultra-high-performance engine built directly into `PLGM`. Instead of using the standard MongoDB driver structs (which consume CPU and memory for BSON marshaling), the Raw Injector pre-compiles raw BSON byte arrays and performs zero-allocation bitwise mutations in a tight loop.
205
282
@@ -209,7 +286,7 @@ Unlike the other workloads PLGM supports, this mode is not configurable. It was
209
286
210
287
***Important Note on Ops/Sec: In Raw Injector mode, the printed Ops/Sec refers to the number of documents processed, not the number of network commands. For example, if your batch size is 1,000, and plgm reports 50,000 Ops/Sec, it is executing 50 bulk network commands per second.***
211
288
212
-
####Configuration
289
+
### Configuration
213
290
214
291
You can configure the Raw Injector via `config.yaml` or directly via CLI flags/environment variables. These are the available options:
215
292
@@ -239,15 +316,15 @@ Environment variables:
239
316
PLGM_INJECTOR_COLLECTION Collection name
240
317
```
241
318
242
-
####Modes of Operation (type)
319
+
### Modes of Operation (type)
243
320
244
321
* insert: Floods the database with new documents. Automatically pre-splits chunks if sharding is enabled.
245
322
* find / update / delete: Operates on the existing data seeded by an insert run.
246
323
* upsert: Fires upsert commands, creating documents if they don't exist.
247
324
* mixed: Runs a randomized distribution of reads, inserts, updates, and deletes simultaneously.
248
325
249
326
250
-
####Running via CLI
327
+
### Running via CLI
251
328
You can bypass the YAML config entirely and trigger a raw injection test purely through flags:
252
329
253
330
##### Run a pure insert flood, dropping existing data, with 4KB documents
You will find additional workloads that you can use as references to benchmark your environment in cases where you prefer not to provide your own collection definitions and queries. However, if your goal is to test your application accurately, we strongly recommend creating collection definitions and queries that match those used by your application.
387
464
@@ -391,7 +468,7 @@ The additional collection and query definitions can be found here:
391
468
* [queries](./resources/queries/)
392
469
393
470
394
-
### 5. Workload Configuration & Loading
471
+
### Workload Configuration & Loading
395
472
396
473
You can supply your own collections and queries using the `PLGM_COLLECTIONS_PATH` and `PLGM_QUERIES_PATH` environment variables (or the corresponding config file fields).
397
474
@@ -443,8 +520,15 @@ You can override any setting in `config.yaml` using environment variables. This
443
520
|`direct_connection`|`PLGM_DIRECT_CONNECTION`| Force direct connection (bypass topology discovery) |`true`|
444
521
|`replicaset_name`|`PLGM_REPLICASET_NAME`| Replica Set name (required for sharded clusters/RS) |`rs0`|
445
522
|`read_preference`|`PLGM_READ_PREFERENCE`| By default, an application directs its read operations to the primary member in a replica set. You can specify a read preference to send read operations to secondaries. |`nearest`|
446
-
|`username`|`PLGM_USERNAME`| Database User |`admin`|
447
-
|***can not be set via config***|`PLGM_PASSWORD`| Database Password (if not set, plgm will prompt) |`password123`|
523
+
|`username`|`PLGM_USERNAME`| Database User |`admin`|
524
+
|***can not be set via config***|`PLGM_PASSWORD`| Database Password (if not set, plgm will prompt) |`password123`|
525
+
|**Web UI**||||
526
+
|`enabled`|`PLGM_WEBUI_ENABLED`| Force launch the Web UI |`true`|
527
+
|`port`|`PLGM_WEBUI_PORT`| Port for the Web UI |`9999`|
528
+
|**Metrics Export**||||
529
+
|`csv_export_enabled`||Continuously stream workload throughput metrics to a CSV file|`false`|
530
+
|`csv_export_append`||If true, appends to the file. If false, overwrites it.|`false`|
531
+
|`csv_export_path`||Path and metrics file name|`/tmp/plgm_metrics_export.csv`|
448
532
|**Workload Control**||||
449
533
|`concurrency`|`PLGM_CONCURRENCY`| Number of active worker goroutines |`50`|
450
534
|`duration`|`PLGM_DURATION`| Test duration (Go duration string) |`5m`, `60s`|
@@ -502,6 +586,7 @@ When executed, plgm performs the following steps:
502
586
4. **Reporting:**
503
587
* Outputs a real-time status report every N seconds (configurable).
504
588
* Prints a detailed summary table at the end of the run.
589
+
* Export output to csv (off by default)
505
590
506
591
### Sample Output
507
592
@@ -646,15 +731,15 @@ You can fine-tune plgm internal behavior by adjusting the parameters in `config.
646
731
#### Workload Type
647
732
By default, the tool comes preconfigured with the following workload distribution:
648
733
649
-
| Operation |Percentage |
734
+
| Operation |Percentage |
650
735
| :--- | :--- |
651
-
| Find| 50% |
652
-
| Update| 20% |
653
-
| Delete| 10% |
654
-
| Insert| 5% |
736
+
| Find| 50% |
737
+
| Update| 20% |
738
+
| Delete| 10% |
739
+
| Insert| 5% |
655
740
| Bulk Inserts | 5% |
656
-
| Aggregate| 5% |
657
-
| Transaction| 5% |
741
+
| Aggregate| 5% |
742
+
| Transaction| 5% |
658
743
659
744
You can modify any of the values above to run different types of workloads.
660
745
@@ -739,7 +824,7 @@ Because custom_params are directly injected into the MongoDB connection string,
739
824
740
825
Example config.yaml for TLS:
741
826
742
-
```YAML
827
+
```yaml
743
828
custom_params:
744
829
compressors: "none"
745
830
tls: true
@@ -752,3 +837,6 @@ Further configuration and examples specific to [Kubernetes environments setup wi
752
837
***Note: Ensure you remove tls: false from your URI if you are using tls: true in custom_params, as the MongoDB Go driver will return a fatal error if conflicting security parameters are provided.***
753
838
754
839
840
+
# Disclaimer
841
+
842
+
This application is not supported by Percona. It has been provided as a community contribution and is not covered under any Percona services agreement.
0 commit comments