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
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/mongodb/benchmark_mongodb-8.0.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ sudo yum install python2
28
28
{{< /tab >}}
29
29
{{< /tabpane >}}
30
30
31
-
For Ubuntu 22.04 and 24.04, Python 2 is not available using the package manager.
31
+
For Ubuntu 22.04 and 24.04, Python 2 is not available using the package manager.
32
32
33
33
You can install Python 2.7 using:
34
34
@@ -61,16 +61,16 @@ cd ycsb-0.17.0
61
61
./bin/ycsb
62
62
```
63
63
64
-
## Load/Insert Test on MongoDB
64
+
## A simple Load/Insert Test on MongoDB
65
65
66
-
To load and test the performance of loading data(INSERT) into default database `ycsb` at `localhost:27017` where MongoDB is running using the synchronous driver run the following command:
66
+
To load and test the performance of loading data(INSERT) into default database `ycsb` at `(localhost/Primary Node):27017` where MongoDB is running using the synchronous driver run the following command:
The "-P" parameter is used to load property files. In this example, you used it load the workloada parameter file which sets the recordcount to 1000 in addition to other parameters. The "-threads" parameter indicates the number of threads and is set to 1 by default.
72
72
73
-
## Update/Read/Read Modify Write Test on MongoDB
73
+
## A simple Update/Read/Read Modify Write Test on MongoDB
74
74
75
75
To test the performance of executing a workload which includes running UPDATE, Read Modify Write(RMW) and/or READ operations on the data using 10 threads for example, use the following command:
76
76
@@ -115,5 +115,5 @@ At the end of each test, statistics are printed to the console. Shown below is t
115
115
...
116
116
```
117
117
118
-
Continue to the next section to run YCSB on a 3 node cluster.
118
+
[Continue to the next section to run YCSB on a 3 node cluster.](/learning-paths/servers-and-cloud-computing/mongodb/replica_set_testing)
weight: 5# (intro is 1), 2 is first, 3 is second, etc.
5
+
weight: 3# (intro is 1), 2 is first, 3 is second, etc.
8
6
9
7
# Do not modify these elements
10
8
layout: "learningpathall"
11
9
---
12
-
13
-
The recommended MongoDB YCSB test setup is a relica set containing three nodes of equal size. The primary node is the node you send the YCSB traffic to and the others are secondary nodes.
10
+
## MongoDB test scenarios
11
+
To test Mongodb you need two parts. A instance running the testing software([YCSB](/learning-paths/servers-and-cloud-computing/mongodb/benchmark_mongodb-8.0)). one or more instances running MongoDB in some configuration. The recommended MongoDB test setup is a three node relica set. These three nodes are of equal size with one instance being desigated as the primary node( the target for test traffic ) and the others as secondary nodes.
14
12
15
13
## What is a replica set?
16
14
17
-
A replica set is a group of instances that maintain the same data set. A replica set contains many nodes, but 3 nodes are used for testing.
15
+
A replica set is a group of instances that maintain the same dataset. A replica set contains many nodes, but three nodes are the most common for testing.
18
16
19
17
## What node size should I use?
20
18
21
-
The most common size for testing MongoDB is an 8 vCPU instance. You can test with any sized machine, but if you are looking for ideal testing conditions 8 vCPUs is enough. Each node should have 32GB of RAM.
22
-
23
-
You should keep the complete data set in memory. Additional details abut the recommended configuration are provided below.
24
-
25
-
## Create a replica set
26
-
27
-
Create a 3 node replica set by starting 3 Arm instances with the specifications above.
28
-
29
-
Install MongoDB on each node using the previously provided instructions.
30
-
31
-
Select 1 instance as the primary node and install YCSB on the instance.
32
-
33
-
## Initialize the replica set
34
-
35
-
1. Set variables with the IP addresses of each node:
19
+
The most common size for testing MongoDB is an 8 vCPU instance. You can test with any sized instance, but if you are looking for ideal testing conditions, 8 vCPUs is enough. Each node should have atleast 32GB of RAM.
36
20
37
-
```bash
38
-
PRIMARY_NODE_IP="<primary-node-ip>"
39
-
SECONDARY_NODE1_IP="<secondary-node1-ip>"
40
-
SECONDARY_NODE2_IP="<secondary-node2-ip>"
41
-
```
21
+
To achieve the best results, its recommended to keep the complete data set in memory. If you see disk access when running tests, increase the RAM size of your instances. Additional details about the recommended configuration are provided below.
42
22
43
-
2. Connect to the primary node using the MongoDB shell:
44
-
45
-
```bash
46
-
mongosh --host <primary-node-ip>:27017
47
-
```
23
+
## Creating replica sets
48
24
49
-
3. Initialize the replica set with the following command:
25
+
You can create replica sets of any size(two is the minimum). Three is recemmended but you can add as many as you like.
50
26
51
-
```bash
52
-
PRIMARY_NODE_IP="<primary-node-ip>"
53
-
SECONDARY_NODE1_IP="<secondary-node1-ip>"
54
-
SECONDARY_NODE2_IP="<secondary-node2-ip>"
27
+
## Three node replica sets
55
28
56
-
mongosh --host $PRIMARY_NODE_IP:27017 <<EOF
57
-
rs.initiate({
58
-
_id: "rs0",
59
-
members: [
60
-
{ _id: 0, host: "$PRIMARY_NODE_IP:27017" },
61
-
{ _id: 1, host: "$SECONDARY_NODE1_IP:27017" },
62
-
{ _id: 2, host: "$SECONDARY_NODE2_IP:27017" }
63
-
]
64
-
})
65
-
EOF
66
-
```
29
+
To creating a three node replica set, start by launching three [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) of equal size.
67
30
68
-
3. Verify the replica set status:
31
+
[install](/learning-paths/servers-and-cloud-computing/mongodb/run_mongodb) Mongodb on all three instances.
69
32
70
-
```bash
71
-
mongosh --host $PRIMARY_NODE_IP:27017 <<EOF
72
-
rs.status()
73
-
EOF
74
-
```
33
+
Once all three instances are up and running. Modify the service and configuration file for all instances.
75
34
76
35
## Modify the MongoDB configuration
77
36
78
-
Use a text editor to edit the file `/etc/mongodb.conf`file and replace the contents of the file with the text below.
37
+
Use a text editor to edit the file `/etc/mongodb.conf` and replace the contents of the file with the text below.
**systemLog:** Contains locations and details of where logging should be contained.
115
76
-**path:** Location for logging
116
77
@@ -135,39 +96,87 @@ setParameter:
135
96
136
97
If you want to use encryption you will need to add the security and keyFile to your configuration. As well as change some of the parameters in the `mongod.conf` file.
137
98
99
+
Run this command to reload the new configurtion.
138
100
139
-
## Recommended Tests on MongoDB
140
-
141
-
The most common real world test to run is a 95/5 test, 95% read and 5% update. 100/0 and 90/10 are also popular.
101
+
```
102
+
sudo service mongod restart
103
+
```
142
104
143
-
Run the following commands for about 5 mins before collecting data.
105
+
## Modify the MongoDB service
144
106
145
-
Load the dataset:
107
+
Use a text editor to edit the file `/etc/systemd/system/mongod.service` and replace the contents of the file with the text below.
**Once all three instances are created and have mongodb installed, select one to be your primary node. The remaining instances will be secondary nodes.**
For instructions on running any other tests or more details on the metrics reported, refer to the [GitHub project for the YCSB.](https://github.com/brianfrankcooper/YCSB/wiki/).
0 commit comments