diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/_index.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/_index.md index 78c9482bfc..27a3011c93 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/_index.md @@ -1,21 +1,17 @@ --- -title: Deploy MongoDB on Google Axion C4A virtual machine +title: Deploy MongoDB on an Arm-based Google Axion C4A VM minutes_to_complete: 15 -draft: true -cascade: - draft: true - -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. +who_is_this_for: This introductory topic is for software developers who want to migrate MongoDB workloads from x86_64 to Arm-based platforms, specifically on Google Axion-based C4A virtual machines. learning_objectives: - - Create an Arm cloud instance on the Google Cloud Platform - - Install and run MongoDB on the Arm-based GCP C4A instance. - - Benchmark the MongoDB performance on Arm using Yahoo Cloud Serving Benchmark (YCSB). + - Create an Arm virtual machine on Google Cloud (C4A Axion family) + - Install and run MongoDB on the Arm-based C4A instance + - Benchmark MongoDB performance with Yahoo Cloud Serving Benchmark (YCSB) prerequisites: - - A [Google Cloud Platform (GCP)](https://cloud.google.com/free?utm_source=google&hl=en) account with billing enabled. + - A [Google Cloud Platform (GCP)](https://cloud.google.com/free?utm_source=google&hl=en) account with billing enabled author: Annie Tallund diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/background.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/background.md index a576e38b4f..e3c0cbb163 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/background.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/background.md @@ -8,15 +8,14 @@ layout: "learningpathall" ## Google Axion C4A series -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. +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. The C4A series provides a cost-effective virtual machine while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud. -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). +To learn more about Google Axion, see the blog post [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu). ## MongoDB -MongoDB is a popular open-source NoSQL database designed for high performance, scalability, and flexibility. -It stores data in JSON-like BSON documents, making it ideal for modern applications that require dynamic, schema-less data structures. +MongoDB is a popular open-source NoSQL database designed for performance, scalability, and flexibility. It stores data in JSON-like BSON documents, making it well suited to applications that require dynamic, schema-less data models. -MongoDB is widely used for web, mobile, IoT, and real-time analytics workloads. Learn more from the [MongoDB official website](https://www.mongodb.com/) and its [official documentation](https://www.mongodb.com/docs/). +MongoDB is widely used for web, mobile, IoT, and real-time analytics workloads. Learn more on the [MongoDB website](https://www.mongodb.com/) and in the [MongoDB documentation](https://www.mongodb.com/docs/). diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/baseline-testing.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/baseline-testing.md index 6d558c9688..4e99c74930 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/baseline-testing.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/baseline-testing.md @@ -6,9 +6,13 @@ weight: 5 layout: learningpathall --- -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. +## Overview -### 1. Connect to MongoDB +Now that MongoDB is installed on your Google Axion C4A Arm VM, verify that the server is running and accepting local connections. + +Use mongosh to create a test database, run basic CRUD operations, and capture a quick insert-time baseline before you start benchmarking. + +## Connect to MongoDB Open a shell session to the local MongoDB instance: @@ -16,7 +20,8 @@ Open a shell session to the local MongoDB instance: mongosh mongodb://127.0.0.1:27017 ``` -### 2. Create a Test Database and Collection + +## Create a test database and collection Switch to a new database and create a collection: @@ -34,7 +39,7 @@ switched to db baselineDB { ok: 1 } ``` -### 3. Insert 10,000 Test Documents +## Insert 10,000 test documents Populate the collection with 10,000 timestamped documents: @@ -48,9 +53,9 @@ for (let i = 0; i < 10000; i++) { } ``` -Each document will contain: +Each document contains: - `record`: a counter from 0 to 9999 -- `status`: always `"new"` +- `status`: `"new"` - `timestamp`: the current date/time of insertion Sample output: @@ -59,7 +64,7 @@ Sample output: { acknowledged: true, insertedId: ObjectId('...') } ``` -### 4. Read a Subset of Documents +## Read a subset of documents Verify read functionality by querying the first few documents: @@ -69,7 +74,7 @@ db.test.find({ status: "new" }).limit(5) This returns the first 5 documents where `status` is `"new"`. -### 5. Update a Document +## Update a document Update a specific document by changing its status: @@ -89,7 +94,7 @@ Expected output: } ``` -### 6. View the Updated Document +## View the updated document Confirm that the document was updated: @@ -108,7 +113,7 @@ Expected output: } ``` -### 7. Delete a Document +## Delete a document The command below tells MongoDB to delete one document from the test collection, where record is exactly 100: @@ -116,7 +121,7 @@ The command below tells MongoDB to delete one document from the test collection, db.test.deleteOne({ record: 100 }) ``` -Verify that it was deleted: +Verify deletion: ```javascript db.test.findOne({ record: 100 }) @@ -128,7 +133,7 @@ Expected output: null ``` -### 8. Measure Execution Time (Optional) +## Measure execution time (optional) Measure how long it takes to insert 10,000 documents: @@ -146,7 +151,7 @@ Sample output: Insert duration (ms): 4427 ``` -### 9. Count Total Documents +## Count total documents Check the total number of documents in the collection: @@ -163,9 +168,11 @@ Expected output: 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). -### 10. Clean Up (Optional) +## Clean up (optional) + +For the sake of resetting the environment, this following command deletes the current database you are connected to in mongosh. -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: +Drop the `baselineDB` database to remove all test data: ```javascript db.dropDatabase() @@ -177,4 +184,4 @@ Expected output: { ok: 1, dropped: 'baselineDB' } ``` -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. \ No newline at end of file +These baseline operations confirm that MongoDB is functioning properly on your GCP Arm64 environment. Using `mongosh`, you validated inserts, queries, updates, deletes, and basic performance timing. Your instance is now ready for benchmarking or application integration. \ No newline at end of file diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/benchmarking.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/benchmarking.md index fcbe8fd10e..eff06a9a06 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/benchmarking.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/benchmarking.md @@ -5,36 +5,36 @@ weight: 6 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## MongoDB Benchmarking with YCSB (Yahoo! Cloud Serving Benchmark) -**YCSB (Yahoo! Cloud Serving Benchmark)** is an open-source tool for evaluating the performance of NoSQL databases under various workloads. It simulates operations such as reads, writes, updates, and scans to mimic real-world usage patterns. +## Benchmark MongoDB with YCSB -### Install YCSB (Build from Source) +YCSB (Yahoo! Cloud Serving Benchmark) is an open-source tool for evaluating NoSQL databases under various workloads. It simulates operations such as writes, updates, and scans to mimic production traffic. -First, install the required build tools and clone the YCSB repository: +## Install YCSB from source + +Install build tools and clone YCSB, then build the MongoDB binding: ```console sudo dnf install -y git maven java-11-openjdk-devel git clone https://github.com/brianfrankcooper/YCSB.git cd YCSB mvn -pl site.ycsb:mongodb-binding -am clean package -``` -### Load Phase – Insert Initial Dataset -This phase inserts a set of documents into MongoDB to simulate a typical starting workload. By default, it inserts 1,000 records. +## Load initial data +Load a starter dataset (defaults to 1,000 records) into MongoDB: ```console ./bin/ycsb load mongodb -s \ -P workloads/workloada \ -p mongodb.url=mongodb://127.0.0.1:27017/ycsb ``` -This prepares the database for the actual performance test. +This prepares the database for the performance test. -### Execute Benchmark Workload +## Run a mixed workload -Run the actual benchmark with the predefined workload. This command performs mixed read/write operations and collects performance metrics. +Run Workload A (50% reads, 50% updates) and collect metrics: ```console ./bin/ycsb run mongodb -s \ @@ -48,7 +48,7 @@ Run the actual benchmark with the predefined workload. This command performs mix This simulates common real-world applications like session stores or shopping carts. -You’ll see performance output that looks like this: +Sample output: ```output [READ], Operations, 534 @@ -65,19 +65,19 @@ You’ll see performance output that looks like this: [OVERALL], Throughput(ops/sec), 1953.125 ``` -### YCSB Operations & Latency Metrics Explained +## Understand YCSB metrics -- **Operations Count**: Total operations performed for each type (e.g., READ, UPDATE). +- **Operations Count**: Total operations performed for each type (for example, READ, UPDATE). - **Average Latency (us)**: The average time to complete each operation, measured in microseconds. - **Min Latency / Max Latency (us)**: The fastest and slowest observed times for any single operation of that type. With YCSB installed and benchmark results captured, you now have a baseline for MongoDB's performance under mixed workloads. -### Benchmark summary on x86_64 +## Benchmark summary on x86_64 To better understand how MongoDB behaves across architectures, YCSB benchmark workloads were run on both an **x86_64 (C3 Standard)** and an **Arm64 (C4A Standard)** virtual machine, each with 4 vCPUs and 16 GB of memory, running RHEL 9. -The following benchmark results are collected on a c3-standard-4 (4 vCPU, 2 core, 16 GB Memory) x86_64 environment, running RHEL 9. +Results from a c3-standard-4 instance (4 vCPUs, 16 GB RAM) on RHEL 9: | Operation | Count | Avg Latency (us) | Min Latency (us) | Max Latency (us) | 50th Percentile (us) | 95th Percentile (us) | 99th Percentile (us) | |-----------|-------|------------------|------------------|------------------|-----------------------|----------------------|-----------------------| @@ -85,8 +85,8 @@ The following benchmark results are collected on a c3-standard-4 (4 vCPU, 2 cor | UPDATE | 528 | 621.27 | 214 | 12855 | 554 | 971 | 1224 | | CLEANUP | 1 | 4702 | 4700 | 4703 | 4703 | 4703 | 4703 | -### Benchmark summary on Arm64: -The following benchmark results are collected on a c4a-standard-4 (4 vCPU, 16 GB Memory) Arm64 environment, running RHEL 9. +## Benchmark summary on Arm64 (Google Axion C4A): +Results from a c4a-standard-4 instance (4 vCPUs, 16 GB RAM) on RHEL 9: | Operation | Count | Avg Latency (us) | Min Latency (us) | Max Latency (us) | 50th Percentile (us) | 95th Percentile (us) | 99th Percentile (us) | |----------|------------------|------------------|------------------|------------------|----------------------|----------------------|----------------------| @@ -94,10 +94,12 @@ The following benchmark results are collected on a c4a-standard-4 (4 vCPU, 16 G | UPDATE | 466 | 384.45 | 186 | 26543 | 296 | 498 | 821 | | CLEANUP | 1 | 4138 | 4136 | 4139 | 4139 | 4139 | 4139 | -### **Highlights from GCP C4A Arm virtual machine** +## Highlights from the C4A Arm VM + +- Lower average latencies on Arm: ~313 µs (READ) and ~384 µs (UPDATE). + +- Stable p50–p99 latencies indicate consistent performance. -- Arm results show low **average latencies**, **READ** at **313 us** and **UPDATE** at **384 us**. -- **50th** to **99th percentile** latencies remain stable, indicating consistent performance. -- **Max latency** spikes (**8279 us READ**, **26543 us UPDATE**) suggest rare outliers. +- Occasional max-latency outliers suggest transient spikes common in mixed workloads. -This Learning Path walked you through setting up and benchmarking MongoDB on an Arm-based GCP instance, highlighting how to run core operations, validate performance, and interpret benchmarking results with YCSB. Alongside, you explored some performance numbers, showing that Arm is a powerful and cost-efficient alternative for modern data-serving workloads like MongoDB. \ No newline at end of file +With YCSB built and results captured, you now have a baseline for MongoDB performance on Arm-based Google Axion C4A. You can iterate on dataset size, thread counts, and workloads (A–F) to profile additional scenarios and compare cost-performance across architectures. \ No newline at end of file diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/create-instance.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/create-instance.md index f54706f908..33af64d5a6 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/create-instance.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/create-instance.md @@ -6,28 +6,29 @@ weight: 3 layout: learningpathall --- -## Introduction +## Overview -This section walks you through creating a **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**. +This section walks you through creating a 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**. -If you haven't set up a Google Cloud account, check out the Learning Path on [Getting Started with Google Cloud Platform](https://learn.arm.com/learning-paths/servers-and-cloud-computing/csp/google/). +If you haven't set up a Google Cloud account, see the Learning Path [Getting started with Google Cloud Platform](https://learn.arm.com/learning-paths/servers-and-cloud-computing/csp/google/). -### Create an Arm-based Virtual Machine (C4A) +## Create an Arm-based virtual machine (C4A) -To create a virtual machine based on the C4A Arm architecture: -1. Navigate to the [Google Cloud Console](https://console.cloud.google.com/). -2. Go to **Compute Engine** and click on **Create Instance**. -3. Under the **Machine Configuration**: - - Fill in basic details like **Instance Name**, **Region**, and **Zone**. - - Select the **Series** as `C4A`. - - Choose a machine type such as `c4a-standard-4`. -![Instance Screenshot](./select-instance.png) -4. Under the **OS and Storage**, click on **Change**, and select **Red Hat Enterprise Linux** as the Operating System with **Red Hat Enterprise Linux 9** as the Version. Make sure you pick the version of image for Arm. -5. Under **Networking**, enable **Allow HTTP traffic** to allow interacting for later steps in the Learning Path. -6. Click on **Create**, and the instance will launch. +To create a VM based on the C4A Arm architecture: + +1. Open the [Google Cloud Console](https://console.cloud.google.com/). +2. Go to **Compute Engine** and select **Create instance**. +3. In **Machine configuration**: + - Enter the **Instance name**, **Region**, and **Zone**. + - Set **Series** to `C4A`. + - Choose a machine type such as `c4a-standard-4`. + ![Screenshot of GCP Create instance page showing C4A series and c4a-standard-4 selected alt-text#center](./select-instance.png "Selecting the C4A series and c4a-standard-4 machine type") +4. In **OS and storage**, select **Change**, choose **Red Hat Enterprise Linux** as the operating system, and **Red Hat Enterprise Linux 9** as the version. Make sure you select the **Arm** image. +5. In **Networking**, enable **Allow HTTP traffic** so you can test services later in this Learning Path. +6. Select **Create** to launch the instance. {{% notice Important %}} -Avoid enabling Allow HTTP traffic permanently, as it introduces a security vulnerability. Instead, configure access to allow only your own IP address for long-term use. +Do not leave **Allow HTTP traffic** enabled permanently. For long-term use, restrict access to only the IP addresses you need. {{% /notice %}} -To access the Google Cloud Console, click the SSH button in your instance overview. This will open a command line interface (CLI), which you’ll use to run the remaining commands in this Learning Path. Continue to the next section to set up MongoDB on your instance. \ No newline at end of file +To open a shell on the VM, select **SSH** in the instance details page. Use this terminal for the commands in the next sections, where you will install and configure MongoDB on your Axion C4A instance. diff --git a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/mongodb-deploy.md b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/mongodb-deploy.md index 6d41947389..d2799361f1 100644 --- a/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/mongodb-deploy.md +++ b/content/learning-paths/servers-and-cloud-computing/mongodb-on-gcp/mongodb-deploy.md @@ -6,20 +6,22 @@ weight: 4 layout: learningpathall --- -In this section, you’ll install MongoDB and the MongoDB Shell (`mongosh`) by downloading the necessary binaries, configuring your environment, and verifying that the database server is running correctly. +## Overview -### 1. Install System Dependencies +This section shows you how to install MongoDB and the MongoDB Shell (`mongosh`) on an Arm-based Google Axion C4A instance running Red Hat Enterprise Linux. You will download the Arm64 binaries, update your environment, and verify that the database server runs correctly. -Start by installing required system packages to support MongoDB: +## Install system dependencies + +Install the required system packages: ```console -sudo dnf update +sudo dnf update -y sudo dnf install -y libcurl openssl tar wget curl -``` -### 2. Download and Extract MongoDB -Next, fetch and unpack the MongoDB binaries for Arm: +Download and extract MongoDB + +Fetch and unpack the MongoDB Arm64 (aarch64) binaries for RHEL 9.3: ```console wget https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel93-8.0.12.tgz @@ -27,31 +29,31 @@ tar -xzf mongodb-linux-aarch64-rhel93-8.0.12.tgz ls mongodb-linux-aarch64-rhel93-8.0.12/bin ``` -To make MongoDB binaries accessible from any terminal session, add them to your PATH: +Add the binaries to your `PATH` so they are available in every shell session: ```console echo 'export PATH=~/mongodb-linux-aarch64-rhel93-8.0.12/bin:$PATH' >> ~/.bashrc source ~/.bashrc ``` -### 3. Start the MongoDB server +## Start the MongoDB server -Set up a directory to store MongoDB's data files: +Create a data directory for MongoDB files: ```console mkdir -p ~/mongodb-data/db ``` -Run MongoDB in the **foreground** to verify it starts correctly: +Start mongod in the foreground to verify that it launches and to view logs directly: ```console mongod --dbpath ~/mongodb-data/db ``` -Starting the server in the **foreground** allows you to see real-time logs and is useful for debugging or verifying that MongoDB starts correctly. However, this will occupy your terminal and stop the server if you close the terminal or interrupt it. +Starting the server in the foreground allows you to see real-time logs and is useful for debugging or verifying that MongoDB starts correctly. However, this will occupy your terminal and stop the server if you close the terminal or interrupt it. -After stopping the server (e.g., with `Ctrl+C`), confirm that files have been created in the database directory: +Stop the server (for example, with **Ctrl+C**), then confirm that data files were created: ```console ls ~/mongodb-data/db/ @@ -63,31 +65,31 @@ Example output: collection-0-7680310461694759627.wt index-3-7680310461694759627.wt mongod.lock WiredTiger.lock ``` -Once you’ve confirmed it’s working, you can start MongoDB in the **background** using the `--fork` option and redirecting logs to a file. This allows MongoDB to run continuously without tying up your terminal session. To start MongoDB in the **background** with logging enabled: +Once you’ve confirmed it’s working, you can start MongoDB in the background using the `--fork` option and redirecting logs to a file. This allows MongoDB to run continuously without tying up your terminal session. + +Start mongod in the background with logging enabled so it continues to run after you close the terminal: ```console mongod --dbpath ~/mongodb-data/db --logpath ~/mongodb-data/mongod.log --fork ``` +## Install MongoDB Shell (mongosh) -### 4. Install mongosh - -`mongosh` is the MongoDB shell used to interact with your database. Download and install it for Arm: +`mongosh` is the MongoDB shell used to interact with your database. Download and install mongosh for Arm64: ```console wget https://github.com/mongodb-js/mongosh/releases/download/v2.5.6/mongodb-mongosh-2.5.6.aarch64.rpm sudo dnf install -y ./mongodb-mongosh-2.5.6.aarch64.rpm ``` -Confirm that`mongosh` was installed correctly by checking that the version is printed: - +Verify the installation: ```console mongosh --version ``` -### 5. Connect to MongoDB via mongosh +## Connect to MongoDB with mongosh -Finally, connect to your MongoDB server using the shell: +Connect to the local server: ```console mongosh mongodb://127.0.0.1:27017