Skip to content

Commit 98f119c

Browse files
Rebranded application and updated code
1 parent aff0dcd commit 98f119c

File tree

10 files changed

+204
-204
lines changed

10 files changed

+204
-204
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ENV CGO_ENABLED=0
1313

1414
# Build the binary
1515
# We target main.go
16-
RUN go build -o genMongoLoad cmd/genMongoLoad/main.go
16+
RUN go build -o plgm cmd/plgm/main.go
1717

1818
# --- Stage 2: Runner ---
1919
# We use a tiny Alpine Linux image for the final container
@@ -22,7 +22,7 @@ FROM alpine:latest
2222
WORKDIR /app
2323

2424
# Copy the compiled binary from the builder stage
25-
COPY --from=builder /app/genMongoLoad .
25+
COPY --from=builder /app/plgm .
2626

2727
# Copy the config file so the app can read it
2828
COPY config.yaml .
@@ -31,4 +31,4 @@ COPY config.yaml .
3131
COPY resources/ resources/
3232

3333
# Command to run when the container starts
34-
CMD ["./genMongoLoad", "config.yaml"]
34+
CMD ["./plgm", "config.yaml"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# --- Variables ---
2-
APP_NAME := genMongoLoad
3-
SRC_DIR := cmd/genMongoLoad/main.go
2+
APP_NAME := plgm
3+
SRC_DIR := cmd/plgm/main.go
44
BIN_DIR := bin
55

66
# Get the latest git tag or commit hash.

README.md

Lines changed: 88 additions & 88 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626

2727
// Custom Help Output
2828
flag.Usage = func() {
29-
fmt.Fprintf(os.Stderr, "\ngenMongoLoad: A Workload Generator for MongoDB Clusters\n")
29+
fmt.Fprintf(os.Stderr, "\nplgm: Percona Load Generator for MongoDB Clusters\n")
3030
fmt.Fprintf(os.Stderr, "Usage: %s [flags] [config_file]\n\n", os.Args[0])
3131

3232
fmt.Fprintf(os.Stderr, "Examples:\n")
@@ -41,39 +41,39 @@ func main() {
4141
fmt.Fprintf(os.Stderr, "\nEnvironment Variables (Overrides):\n")
4242

4343
fmt.Fprintf(os.Stderr, " [Connection]\n")
44-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_URI", "Connection URI")
45-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_USERNAME", "Database User")
46-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_PASSWORD", "Database Password (Recommended: Use Prompt)")
47-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DIRECT_CONNECTION", "Force direct connection (true/false)")
48-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_REPLICA_SET", "Replica Set name")
49-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_READ_PREFERENCE", "nearest")
44+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_URI", "Connection URI")
45+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_USERNAME", "Database User")
46+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_PASSWORD", "Database Password (Recommended: Use Prompt)")
47+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DIRECT_CONNECTION", "Force direct connection (true/false)")
48+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_REPLICA_SET", "Replica Set name")
49+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_READ_PREFERENCE", "nearest")
5050

5151
fmt.Fprintf(os.Stderr, "\n [Workload Core]\n")
52-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DEFAULT_WORKLOAD", "Use built-in workload (true/false)")
53-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_COLLECTIONS_PATH", "Path to collection JSON")
54-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_QUERIES_PATH", "Path to query JSON")
55-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DURATION", "Test duration (e.g. 60s, 5m)")
56-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_CONCURRENCY", "Number of active workers")
57-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DOCUMENTS_COUNT", "Initial seed document count")
58-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DROP_COLLECTIONS", "Drop collections on start (true/false)")
59-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_SKIP_SEED", "Do not seed initial data on start (true/false)")
60-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DEBUG_MODE", "Enable verbose logic logs (true/false)")
52+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DEFAULT_WORKLOAD", "Use built-in workload (true/false)")
53+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_COLLECTIONS_PATH", "Path to collection JSON")
54+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_QUERIES_PATH", "Path to query JSON")
55+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DURATION", "Test duration (e.g. 60s, 5m)")
56+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_CONCURRENCY", "Number of active workers")
57+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DOCUMENTS_COUNT", "Initial seed document count")
58+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DROP_COLLECTIONS", "Drop collections on start (true/false)")
59+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_SKIP_SEED", "Do not seed initial data on start (true/false)")
60+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DEBUG_MODE", "Enable verbose logic logs (true/false)")
6161

6262
fmt.Fprintf(os.Stderr, "\n [Operation Ratios] (Must sum to ~100)\n")
63-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_FIND_PERCENT", "% of ops that are FIND")
64-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_UPDATE_PERCENT", "% of ops that are UPDATE")
65-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_INSERT_PERCENT", "% of ops that are INSERT")
66-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_DELETE_PERCENT", "% of ops that are DELETE")
67-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_AGGREGATE_PERCENT", "% of ops that are AGGREGATE")
63+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_FIND_PERCENT", "% of ops that are FIND")
64+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_UPDATE_PERCENT", "% of ops that are UPDATE")
65+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_INSERT_PERCENT", "% of ops that are INSERT")
66+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_DELETE_PERCENT", "% of ops that are DELETE")
67+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_AGGREGATE_PERCENT", "% of ops that are AGGREGATE")
6868

6969
fmt.Fprintf(os.Stderr, "\n [Performance Optimization]\n")
70-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_FIND_BATCH_SIZE", "Docs returned per cursor batch")
71-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_FIND_LIMIT", "Max docs per Find query")
72-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_INSERT_CACHE_SIZE", "Generator buffer size")
73-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_OP_TIMEOUT_MS", "Soft timeout per DB op (ms)")
74-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_RETRY_ATTEMPTS", "Retry attempts for failures")
75-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_RETRY_BACKOFF_MS", "Wait time between retries (ms)")
76-
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GENMONGOLOAD_STATUS_REFRESH_RATE_SEC", "Status report interval (sec)")
70+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_FIND_BATCH_SIZE", "Docs returned per cursor batch")
71+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_FIND_LIMIT", "Max docs per Find query")
72+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_INSERT_CACHE_SIZE", "Generator buffer size")
73+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_OP_TIMEOUT_MS", "Soft timeout per DB op (ms)")
74+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_RETRY_ATTEMPTS", "Retry attempts for failures")
75+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_RETRY_BACKOFF_MS", "Wait time between retries (ms)")
76+
fmt.Fprintf(os.Stderr, " %-35s %s\n", "PERCONALOAD_STATUS_REFRESH_RATE_SEC", "Status report interval (sec)")
7777
fmt.Fprintf(os.Stderr, " %-35s %s\n", "GOMAXPROCS", "Go Runtime CPU limit")
7878
fmt.Fprintf(os.Stderr, "\n")
7979
}
@@ -82,7 +82,7 @@ func main() {
8282

8383
// 2. Handle Version Flag
8484
if *versionFlag {
85-
fmt.Printf("genMongoLoad v%s\n", version)
85+
fmt.Printf("plgm v%s\n", version)
8686
os.Exit(0)
8787
}
8888

@@ -112,7 +112,7 @@ func main() {
112112
// 1. Analyze the Base URI to see if it already has credentials
113113
u, err := url.Parse(appCfg.URI)
114114
if err != nil {
115-
log.Fatalf("Invalid GENMONGOLOAD_URI: %v", err)
115+
log.Fatalf("Invalid PERCONALOAD_URI: %v", err)
116116
}
117117
uriHasUser := u.User != nil && u.User.Username() != ""
118118

config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# ==============================================================================
44

55
# The primary connection string for the MongoDB target.
6-
# Can be overridden via environment variable: GENMONGOLOAD_URI
6+
# Can be overridden via environment variable: PERCONALOAD_URI
77
uri: "mongodb://localhost:31001"
88

99
# --- Connection Tuning ---
1010
# Standard driver parameters to control behavior and resource usage.
1111
connection_params:
1212
# Credentials (Optional)
13-
# You can set the username here or via env GENMONGOLOAD_USERNAME.
14-
# Password is NOT set here. Use GENMONGOLOAD_PASSWORD. If not set, the interactive prompt will ask for it
13+
# You can set the username here or via env PERCONALOAD_USERNAME.
14+
# Password is NOT set here. Use PERCONALOAD_PASSWORD. If not set, the interactive prompt will ask for it
1515
username: "root"
1616
auth_source: admin # Database to authenticate against
1717
direct_connection: true # Connect directly to the host (bypass topology discovery if single node)
@@ -43,7 +43,7 @@ debug: false
4343
# Workload Definition
4444
# ==============================================================================
4545

46-
# If true, genMongoLoad will only run the default workload default (resources/collections/default.json).
46+
# If true, plgm will only run the default workload default (resources/collections/default.json).
4747
# If false, loads custom JSON files from the paths below.
4848
default_workload: true
4949

docker.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# MongoDB Workload Generator - Docker & Kubernetes Guide
1+
# Percona Load Generator for MongoDB Clusters - Docker & Kubernetes Guide
22

3-
This guide details how to containerize and run the `genMongoLoad` workload generator.
3+
This guide details how to containerize and run the `plgm` workload generator.
44

55
Running the benchmark as a container inside your Kubernetes cluster is the **recommended approach** for performance testing. It bypasses local network proxies (VPNs, Ingress Controllers) and places the load generator on the same high-speed network fabric as the database, ensuring you measure database performance, not network latency.
66

@@ -17,13 +17,13 @@ Create a file named `Dockerfile` in the root of this project. We have provided a
1717
Build the image locally.
1818

1919
```bash
20-
docker build -t genmongoload:latest .
20+
docker build -t plgm:latest .
2121
```
2222

2323
> **Note for Kubernetes Users:** If your cluster is remote (EKS, GKE, AKS), you might have to tag and push this image to a registry your cluster can access:
2424
> ```bash
25-
> docker tag genmongoload:latest myregistry.azurecr.io/genmongoload:v1.0.0
26-
> docker push myregistry.azurecr.io/genmongoload:v1.0.0
25+
> docker tag plgm:latest myregistry.azurecr.io/plgm:v1.0.0
26+
> docker push myregistry.azurecr.io/plgm:v1.0.0
2727
> ```
2828
2929
---
@@ -32,30 +32,30 @@ docker build -t genmongoload:latest .
3232
3333
A Kubernetes Job is the ideal choice for benchmarking as it runs to completion and then terminates. However, you may choose the deployment strategy that best fits your specific requirements.
3434
35-
### Create `genMongoLoad-job.yaml`
35+
### Create `plgm-job.yaml`
3636
37-
We have provided a comprehensive sample manifest. It uses a Seed List for the URI (listing all three pods) to ensure high availability and utilizes the `GENMONGOLOAD_REPLICA_SET` variable among others to configure our options. This file is provided as an example; please edit [genMongoLoad-job.yaml](./genMongoLoad-job.yaml) to suit your specific requirements.
37+
We have provided a comprehensive sample manifest. It uses a Seed List for the URI (listing all three pods) to ensure high availability and utilizes the `PERCONALOAD_REPLICA_SET` variable among others to configure our options. This file is provided as an example; please edit [plgm-job.yaml](./plgm-job.yaml) to suit your specific requirements.
3838
3939
### Execute the Benchmark
4040
4141
**1. Launch the Job**
4242
```bash
43-
kubectl apply -f genMongoLoad-job.yaml
44-
job.batch/genmongoload created
43+
kubectl apply -f plgm-job.yaml
44+
job.batch/plgm created
4545
```
4646
4747
**2. Watch the Output**
4848
Find the pod created by the job and stream the logs to see the real-time "Ops/Sec" report.
4949
```bash
50-
# Get the pod name (e.g., genmongoload-xxxxx)
51-
kubectl get pods -l job-name=genmongoload -n lab
50+
# Get the pod name (e.g., plgm-xxxxx)
51+
kubectl get pods -l job-name=plgm -n lab
5252
NAME READY STATUS RESTARTS AGE
53-
genmongoload-xfznq 1/1 Running 0 4s
53+
plgm-xfznq 1/1 Running 0 4s
5454

5555
# Stream logs
56-
kubectl logs genmongoload-xfznq -n lab
56+
kubectl logs plgm-xfznq -n lab
5757

58-
genMongoLoad 1
58+
plgm 1
5959
--------------------------------------------------
6060
Database: airline
6161
Workers: 40 active
@@ -111,14 +111,14 @@ kubectl logs genmongoload-xfznq -n lab
111111
**3. Clean Up & Retry**
112112
Jobs are immutable. To run again with new settings, delete the old job first.
113113
```bash
114-
kubectl get jobs -l job-name=genmongoload -n lab
114+
kubectl get jobs -l job-name=plgm -n lab
115115
NAME STATUS COMPLETIONS DURATION AGE
116-
genmongoload Complete 1/1 13s 3m8s
116+
plgm Complete 1/1 13s 3m8s
117117

118-
kubectl delete job genmongoload -n lab
119-
job.batch "genmongoload" deleted
118+
kubectl delete job plgm -n lab
119+
job.batch "plgm" deleted
120120

121-
kubectl apply -f genMongoLoad-job.yaml
121+
kubectl apply -f plgm-job.yaml
122122
```
123123

124124
---
@@ -129,15 +129,15 @@ You can override almost any setting in `config.yaml` using these Environment Var
129129

130130
| Variable | Description |
131131
| :--- | :--- |
132-
| `GENMONGOLOAD_URI` | Connection String (use Internal DNS) |
133-
| `GENMONGOLOAD_CONCURRENCY` | Number of parallel worker threads |
134-
| `GENMONGOLOAD_DURATION` | Test duration (e.g., `60s`, `5m`) |
135-
| `GENMONGOLOAD_FIND_PERCENT` | % of operations that are Reads |
136-
| `GENMONGOLOAD_INSERT_PERCENT` | % of operations that are Inserts |
137-
| `GENMONGOLOAD_UPDATE_PERCENT` | % of operations that are Updates |
138-
| `GENMONGOLOAD_DELETE_PERCENT` | % of operations that are Deletes |
139-
| `GENMONGOLOAD_DOCUMENTS_COUNT` | Initial seed document count (if seeding) |
140-
| `GENMONGOLOAD_DEFAULT_WORKLOAD`| Set to `true` (use built-in flights) or `false` (custom) |
132+
| `PERCONALOAD_URI` | Connection String (use Internal DNS) |
133+
| `PERCONALOAD_CONCURRENCY` | Number of parallel worker threads |
134+
| `PERCONALOAD_DURATION` | Test duration (e.g., `60s`, `5m`) |
135+
| `PERCONALOAD_FIND_PERCENT` | % of operations that are Reads |
136+
| `PERCONALOAD_INSERT_PERCENT` | % of operations that are Inserts |
137+
| `PERCONALOAD_UPDATE_PERCENT` | % of operations that are Updates |
138+
| `PERCONALOAD_DELETE_PERCENT` | % of operations that are Deletes |
139+
| `PERCONALOAD_DOCUMENTS_COUNT` | Initial seed document count (if seeding) |
140+
| `PERCONALOAD_DEFAULT_WORKLOAD`| Set to `true` (use built-in flights) or `false` (custom) |
141141

142142
## 4. Troubleshooting Performance
143143

@@ -154,10 +154,10 @@ You can override almost any setting in `config.yaml` using these Environment Var
154154
2. **Check the Benchmark Pod:**
155155
Is the generator hitting its own limits?
156156
```bash
157-
kubectl top pod genmongoload-xxxxx
157+
kubectl top pod plgm-xxxxx
158158
```
159159
* **CPU Maxed?** The generator is CPU-bound. Increase `resources.limits.cpu` in the YAML or lower `GOMAXPROCS`.
160-
* **CPU Low?** It might be network latency waiting for the DB. Increase `GENMONGOLOAD_CONCURRENCY` to create more parallel requests.
160+
* **CPU Low?** It might be network latency waiting for the DB. Increase `PERCONALOAD_CONCURRENCY` to create more parallel requests.
161161

162162
3. **Read Preference:**
163163
If your Primary node is at 100% but Secondaries are idle, ensure your URI includes `readPreference=nearest` or `secondaryPreferred`.

genMongoLoadDemo.gif

-543 KB
Binary file not shown.

0 commit comments

Comments
 (0)