Skip to content

Commit dcc9bc1

Browse files
authored
Merge pull request #2270 from annietllnd/main
Technical review of MongoDB on GCP
2 parents 6a72cd3 + 4255ad8 commit dcc9bc1

File tree

8 files changed

+176
-237
lines changed

8 files changed

+176
-237
lines changed

content/learning-paths/servers-and-cloud-computing/github-on-arm/instance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: learningpathall
88

99
## Introduction
1010

11-
This guide walks you through provisioning **Google Axion C4A Arm virtual machine** on GCP with the **c4a-standard-4 (4 vCPUs, 16 GB Memory)** machine type, using the **Google Cloud Console**.
11+
This section walks you through creating **Google Axion C4A Arm virtual machine** on GCP with the **c4a-standard-4 (4 vCPUs, 16 GB Memory)** machine type, using the **Google Cloud Console**.
1212

1313
If you haven't got a Google Cloud account, you can follow the Learning Path on [Getting Started with Google Cloud Platform](https://learn.arm.com/learning-paths/servers-and-cloud-computing/csp/google/) to get started.
1414

content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/_index.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
---
22
title: Deploy MongoDB on Google Axion C4A virtual machine
33

4-
minutes_to_complete: 60
4+
minutes_to_complete: 15
55

6-
who_is_this_for: This Learning Path is designed for software developers looking to migrate their MongoDB workloads from x86_64 to Arm-based platforms, specifically on Google Axion-based C4A virtual machines.
6+
draft: true
7+
cascade:
8+
draft: true
9+
10+
who_is_this_for: This is an introductory topic for software developers looking to migrate their MongoDB workloads from x86_64 to Arm-based platforms, specifically on Google Axion-based C4A virtual machines.
711

812
learning_objectives:
9-
- Provision an Arm virtual machine on the Google Cloud Platform using the C4A Google Axion instance family, and RHEL 9 as the base image.
10-
- Install and run MongoDB on an Arm-based GCP C4A instances.
11-
- Validate the functionality of MongoDB through baseline testing.
13+
- Create an Arm cloud instance on the Google Cloud Platform
14+
- Install and run MongoDB on the Arm-based GCP C4A instance.
1215
- Benchmark the MongoDB performance on Arm using Yahoo Cloud Serving Benchmark (YCSB).
1316

1417
prerequisites:
1518
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free?utm_source=google&hl=en) account with billing enabled.
16-
- Basic understanding of Linux command line.
17-
- Familiarity with the [MongoDB architecture](https://www.mongodb.com/) and deployment practices on Arm64 platforms.
1819

19-
author: Jason Andrews
20+
author: Annie Tallund
2021

2122
##### Tags
22-
skilllevels: Advanced
23+
skilllevels: Introductory
2324
subjects: Databases
2425
cloud_service_providers: Google Cloud
2526

content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/background.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ layout: "learningpathall"
88

99
## Google Axion C4A series
1010

11-
The Google Axion C4A series is a family of Arm-based virtual machines built on Google’s custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machine offer strong performance ideal for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
11+
The C4A series is a family of Arm-based instance types for Google’s custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machine offer strong performance suitable for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
1212

13-
The C4A series provides a cost-effective alternative to x86 virtual machine while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
13+
The C4A series provides a cost-effective virtual machine while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
1414

1515
To learn more about Google Axion, refer to the blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu).
1616

content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/baseline-testing.md

Lines changed: 68 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,37 @@ weight: 5
66
layout: learningpathall
77
---
88

9+
Now that MongoDB is successfully installed on your GCP C4A Arm virtual machine, follow these steps to verify that the server is running correctly and accepting local connections.
910

10-
Since MongoDB is installed successfully on your GCP C4A Arm virtual machine, follow these steps to validate that the server is running and accepting local connections.
11-
12-
## MongoDB Baseline Testing (Using **mongosh**)
13-
14-
1. Connect to MongoDB
11+
### 1. Connect to MongoDB
1512

1613
Open a shell session to the local MongoDB instance:
14+
1715
```console
1816
mongosh mongodb://127.0.0.1:27017
1917
```
2018

21-
2. Create a Test Database and Collection:
19+
### 2. Create a Test Database and Collection
2220

23-
```console
21+
Switch to a new database and create a collection:
22+
23+
```javascript
2424
use baselineDB
2525
db.createCollection("test")
2626
```
27-
This creates a new database **baselineDB** and an empty collection named test.
2827

29-
You should see an output similar to:
28+
This creates a new database named `baselineDB` and an empty collection called `test`.
29+
30+
Expected output:
3031

3132
```output
32-
test> use baselineDB
33-
... db.createCollection("test")
34-
...
3533
switched to db baselineDB
34+
{ ok: 1 }
3635
```
37-
3. Insert 10,000 Test Documents:
36+
37+
### 3. Insert 10,000 Test Documents
38+
39+
Populate the collection with 10,000 timestamped documents:
3840

3941
```javascript
4042
for (let i = 0; i < 10000; i++) {
@@ -45,168 +47,134 @@ for (let i = 0; i < 10000; i++) {
4547
})
4648
}
4749
```
48-
This simulates basic write operations with timestamped records.
49-
10,000 documents will be cretaed and inserted into the test collection of the currently selected database.
50-
The record field would increment from 0 to 9999. The status is always "new".
51-
The timestamp would capture the insertion time for each document using ***new Date()***.
5250

53-
You should see an output similar to:
51+
Each document will contain:
52+
- `record`: a counter from 0 to 9999
53+
- `status`: always `"new"`
54+
- `timestamp`: the current date/time of insertion
55+
56+
Sample output:
5457

5558
```output
56-
{
57-
acknowledged: true,
58-
insertedId: ObjectId('6892dacfbd44e23df4750aa9')
59-
}
59+
{ acknowledged: true, insertedId: ObjectId('...') }
6060
```
6161

62-
4. Read (Query) a Subset of Documents:
62+
### 4. Read a Subset of Documents
63+
64+
Verify read functionality by querying the first few documents:
6365

64-
Fetch a few documents to verify read functionality.
6566
```javascript
6667
db.test.find({ status: "new" }).limit(5)
6768
```
68-
This command is a simple read operation to verify that your data is inserted correctly. It queries the test collection in the current database, and only returns documents where the status is "new". ***limit(5)*** returns only the first 5 matching documents.
6969

70-
You should see an output similar to:
70+
This returns the first 5 documents where `status` is `"new"`.
71+
72+
### 5. Update a Document
73+
74+
Update a specific document by changing its status:
7175

72-
```output
73-
[
74-
{
75-
_id: ObjectId('6892dacbbd44e23df474e39a'),
76-
record: 0,
77-
status: 'new',
78-
timestamp: ISODate('2025-08-06T04:32:11.090Z')
79-
},
80-
{
81-
_id: ObjectId('6892dacbbd44e23df474e39b'),
82-
record: 1,
83-
status: 'new',
84-
timestamp: ISODate('2025-08-06T04:32:11.101Z')
85-
},
86-
{
87-
_id: ObjectId('6892dacbbd44e23df474e39c'),
88-
record: 2,
89-
status: 'new',
90-
timestamp: ISODate('2025-08-06T04:32:11.103Z')
91-
},
92-
{
93-
_id: ObjectId('6892dacbbd44e23df474e39d'),
94-
record: 3,
95-
status: 'new',
96-
timestamp: ISODate('2025-08-06T04:32:11.104Z')
97-
},
98-
{
99-
_id: ObjectId('6892dacbbd44e23df474e39e'),
100-
record: 4,
101-
status: 'new',
102-
timestamp: ISODate('2025-08-06T04:32:11.106Z')
103-
}
104-
]
105-
```
106-
5. Update a Document:
107-
108-
Update a specific document's field to validate update capability.
10976
```javascript
11077
db.test.updateOne({ record: 100 }, { $set: { status: "processed" } })
11178
```
112-
Above command will find the first document where record is exactly 100, and updates that document by setting its status field to "processed".
11379

114-
You should see an output similar to:
80+
This finds the document where `record` is 100 and updates the `status`.
81+
82+
Expected output:
11583

11684
```output
11785
{
11886
acknowledged: true,
119-
insertedId: null,
12087
matchedCount: 1,
121-
modifiedCount: 1,
122-
upsertedCount: 0
88+
modifiedCount: 1
12389
}
12490
```
125-
6. View the Updated Document Before Deletion
12691

127-
```console
92+
### 6. View the Updated Document
93+
94+
Confirm that the document was updated:
95+
96+
```javascript
12897
db.test.findOne({ record: 100 })
12998
```
130-
This retrieves the document where record is 100, allowing you to verify that its status has been updated to "processed".
13199

132-
You should see output similar to:
100+
Expected output:
133101

134102
```output
135103
{
136-
_id: ObjectId('689490ddb7235c65ca74e3fe'),
104+
_id: ObjectId('...'),
137105
record: 100,
138106
status: 'processed',
139-
timestamp: ISODate('2025-08-07T11:41:17.508Z')
107+
timestamp: ISODate('...')
140108
}
141109
```
142110

143-
7. Delete a Document:
111+
### 7. Delete a Document
112+
113+
The command below tells MongoDB to delete one document from the test collection, where record is exactly 100:
144114

145115
```javascript
146116
db.test.deleteOne({ record: 100 })
147117
```
148-
This tells MongoDB to delete one document from the test collection, where record is exactly 100.
149118

150-
You should see an output similar to:
151-
152-
```output
153-
{ acknowledged: true, deletedCount: 1 }
154-
```
155-
Now, confirm the deletion:
119+
Verify that it was deleted:
156120

157-
```console
121+
```javascript
158122
db.test.findOne({ record: 100 })
159123
```
160-
The above command confirms that the document was successfully deleted.
161124

162-
You should see an output similar to:
125+
Expected output:
126+
163127
```output
164128
null
165129
```
166130

167-
8. Measure Execution Time (Optional):
131+
### 8. Measure Execution Time (Optional)
132+
133+
Measure how long it takes to insert 10,000 documents:
168134

169-
The below snippet measures how long it takes to insert documents for performance insight.
170135
```javascript
171136
var start = new Date()
172137
for (let i = 0; i < 10000; i++) {
173138
db.test.insertOne({ sample: i })
174139
}
175140
print("Insert duration (ms):", new Date() - start)
176141
```
177-
You should see an output similar to:
142+
143+
Sample output:
178144

179145
```output
180146
Insert duration (ms): 4427
181147
```
182-
9. Count Total Documents:
183148

184-
Count total entries to confirm expected data volume.
149+
### 9. Count Total Documents
150+
151+
Check the total number of documents in the collection:
152+
185153
```javascript
186154
db.test.countDocuments()
187155
```
188-
You should see an output similar to:
156+
157+
Expected output:
189158

190159
```output
191160
19999
192161
```
162+
193163
The count **19999** reflects the total documents after inserting 10,000 initial records, adding 10,000 more (in point 8), and deleting one (record: 100).
194164

195-
10. Clean Up (Optional):
196165

197-
Deletes the **baselineDB** database and all its contents.
166+
### 10. Clean Up (Optional)
167+
168+
For the sake of resetting the environment, this following command deletes the current database you are connected to in mongosh. Drop the `baselineDB` database to remove all test data:
169+
198170
```javascript
199171
db.dropDatabase()
200172
```
201-
You should see an output similar to:
173+
174+
Expected output:
202175

203176
```output
204177
{ ok: 1, dropped: 'baselineDB' }
205178
```
206179

207-
The above is a destructive command that completely deletes the current database you are connected to in mongosh.
208-
209-
The above operations confirm that MongoDB is installed successfully and is functioning as expected on the GCP Arm64 environment.
210-
211-
Using **mongosh**, you validated key database operations such as **insert**, **read**, **update**, **delete**, and **count**.
212-
Now, your MongoDB instance is ready for further benchmarking and production use.
180+
These baseline operations confirm that MongoDB is functioning properly on your GCP Arm64 environment. Using `mongosh`, you validated key database capabilities including **inserts**, **queries**, **updates**, **deletes**, and **performance metrics**. Your instance is now ready for benchmarking or application integration.

0 commit comments

Comments
 (0)