diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md index 3c97d84ac8..17dc3e75f9 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md @@ -1,9 +1,7 @@ --- -title: Deploy Node.js on Google Cloud C4A (Arm-based Axion VMs) +title: Deploy Node.js on Google Cloud C4A Arm-based Axion VMs + -draft: true -cascade: - draft: true minutes_to_complete: 30 @@ -11,9 +9,9 @@ who_is_this_for: This is an introductory topic for software developers migrating learning_objectives: - - Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors) + - Provision an Arm-based SUSE Linux Enterprise Server virtual machine on Google Cloud C4A instances with Axion processors - Install and configure Node.js on a SUSE Arm64 (C4A) instance - - Validate Node.js functionality with baseline HTTP server tests + - Validate Node.js functionality with baseline HTTP server tests - Benchmark Node.js performance using Autocannon on Arm64 (AArch64) architecture diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md index 715c359130..42fe0869be 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md @@ -8,16 +8,14 @@ layout: "learningpathall" ## Google Axion C4A Arm instances in Google Cloud -Google Axion C4A 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 machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications. +Google Axion C4A is a family of Arm-based virtual machines powered by Google’s custom Axion CPU, built on Arm Neoverse-V2 cores. These instances deliver high performance and energy efficiency for modern cloud workloads, including CI/CD pipelines, microservices, media processing, and general-purpose applications. The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud. -To learn more about Google Axion, refer to the [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu) blog. +For more information on Google Axion, see the Google blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu). ## Node.js -Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine. +Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine. It enables you to build scalable server-side applications, APIs, and backend services using JavaScript. Node.js features an event-driven, non-blocking I/O model, making it highly efficient for handling concurrent connections. Node.js is widely used for web servers, real-time applications, microservices, and cloud-native backend services. -It allows developers to build scalable server-side applications, APIs, and backend services using JavaScript. Node.js features an event-driven, non-blocking I/O model, making it highly efficient for handling concurrent connections. - -Node.js is widely used for web servers, real-time applications, microservices, and cloud-native backend services. Learn more from the [Node.js official website](https://nodejs.org/en) and its [official documentation](https://nodejs.org/docs/latest/api/). +For more information on Node.js, see the [Node.js website](https://nodejs.org/en) and the [Node.js documentation](https://nodejs.org/docs/latest/api/). diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/baseline.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/baseline.md index ea830061ff..ca29d31e3d 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/baseline.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/baseline.md @@ -1,39 +1,41 @@ --- -title: Node.js baseline testing on Google Axion C4A Arm Virtual machine +title: Validate Node.js baseline on Google Axion C4A Arm virtual machine weight: 5 ### FIXED, DO NOT MODIFY layout: learningpathall --- +## Validate Node.js installation with a baseline test -Since Node.js has been successfully installed on your GCP C4A Arm virtual machine, please follow these steps to make sure that it is running. +Confirm that your Node.js installation works as expected before benchmarking performance on your Arm-based VM. Run these baseline tests to verify that Node.js is installed correctly and can execute JavaScript code and serve HTTP requests. Catch setup issues early and ensure your environment is ready for further testing. -## Validate Node.js installation with a baseline test +## Run a simple REPL test -### 1. Run a Simple REPL Test -The Node.js REPL (Read-Eval-Print Loop) allows you to run JavaScript commands interactively. +Start the Node.js REPL (Read-Eval-Print Loop) to run JavaScript commands interactively: ```console node ``` -Inside the REPL, type: + +Type the following command inside the REPL: ```console console.log("Hello from Node.js"); ``` -You should see an output similar to: + +The output is similar to: ```output Hello from Node.js undefined ``` -This confirms that Node.js can execute JavaScript commands successfully. Please now press "Ctrl-D" to exit node. -### 2. Test a Basic HTTP Server -You can now create a small HTTP server to validate that Node.js can handle web requests. +This confirms that Node.js can execute JavaScript commands successfully. Press "Ctrl-D" to exit node. + +## Test a basic HTTP server -Use a text editor to create a file named `app.js` with the code below: +Create a file named `app.js` with the following code to validate that Node.js can handle web requests: ```javascript const http = require('http'); @@ -47,34 +49,39 @@ server.listen(80, '0.0.0.0', () => { console.log('Server running at http://0.0.0.0:80/'); }); ``` - - This server listens on port 80. - - Binding to 0.0.0.0 allows connections from any IP, not just localhost. -Next, we run the HTTP server in the background via sudo: +The server listens for incoming connections on port 80, which is the default port for HTTP traffic. By binding to the IP address 0.0.0.0, the server accepts connections from any network interface, not just from localhost. This configuration enables access from other devices on the network. + +Run the HTTP server in the background using sudo: ```console export MY_NODE=`which node` sudo ${MY_NODE} app.js & ``` -You should see an output similar to: + +The expected output is: ```output Server running at http://0.0.0.0:80/ ``` -#### Test Locally with Curl + +## Test locally with curl + +Run the following command to test the server locally: ```console curl http://localhost:80 ``` -You should see an output similar to: +The expected output is: ```output Baseline test successful! ``` -#### Test from a Browser -Also, you can access it from the browser with your VM's public IP. Run the following command to print your VM’s public URL, then open it in a browser: +## Test from a browser + +Print your VM’s public URL and open it in a browser: ```console echo "http://$(curl -s ifconfig.me):80/" @@ -82,6 +89,6 @@ echo "http://$(curl -s ifconfig.me):80/" You should see the following message in your browser, confirming that your Node.js HTTP server is running successfully: -![Node.js Browser alt-text#center](images/node-browser.png) +![Screenshot showing the browser displaying 'Baseline test successful!' from the Node.js HTTP server running on a Google Axion C4A Arm VM. alt-text#center](images/node-browser.png "Browser displaying baseline test successful dialogue message") -This verifies the basic functionality of the Node.js installation before proceeding to the benchmarking. +You have now validated that Node.js is working correctly on your Arm VM. Proceed to benchmarking and performance testing. diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/benchmarking.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/benchmarking.md index e0dbfc7d8b..c6cf14aa3e 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/benchmarking.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/benchmarking.md @@ -1,44 +1,53 @@ --- -title: Node.js Benchmarking +title: Benchmark Node.js performance with Autocannon on Arm and x86_64 weight: 6 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Node.js Benchmarking by Autocannon +## Benchmark Node.js with Autocannon -After validating that Node.js is installed and your HTTP server is running, you can benchmark it using **Autocannon**. +After validating that Node.js is installed and your HTTP server is running, you can benchmark it using Autocannon. You'll use Autocannon to run a series of tests, analyze the results, and identify areas for optimization. Benchmarking on Arm64 provides valuable insights into how Node.js applications scale and perform in cloud environments, helping you make informed decisions about deployment and resource allocation. -### Install Autocannon -**Autocannon** is a fast HTTP/1.1 benchmarking tool for Node.js, used to measure server throughput, latency, and request handling under concurrent load. +## Install Autocannon + +Autocannon is a fast HTTP/1.1 benchmarking tool for Node.js, used to measure server throughput, latency, and request handling under concurrent load. To install Autocannon, run this command: ```console npm install -g autocannon ``` -### Start Your Node.js HTTP Server +## Start the Node.js HTTP server -If your sample HTTP server is not already running from the last section, you can start it by typing: +If your sample HTTP server isn't running from the last section, start it by using this command: ```console export MY_NODE=`which node` sudo ${MY_NODE} app.js & ``` -Server should be listening on port 80 in the background: +The server should be listening on port 80 in the background: ```output Server running at http://0.0.0.0:80/ ``` -### Run a Basic Benchmark (Local) +## Run a local Node.js benchmark with Autocannon + +Now run a local Node.js benchmark with Autocannon: ```console autocannon -c 100 -d 10 http://localhost:80 ``` -- `-c 100` → 100 concurrent connections -- `-d 10` → duration 10 seconds -- URL → endpoint to test +{{% notice Tip %}} +These options specify how the benchmarking tool runs the test: + +- The `-c 100` flag sets the number of concurrent connections to one hundred, simulating multiple users accessing the endpoint at the same time. +- The `-d 10` flag sets the test duration to ten seconds, so the tool sends requests for that period. +- The URL is the endpoint you're measuring, which could be a web service or API running on your Arm server. + +This configuration helps you evaluate how your application performs under load on Arm platforms. +{{% /notice %}} You should see an output similar to: ```output @@ -65,48 +74,52 @@ Req/Bytes counts sampled once per second. 707k requests in 10.02s, 137 MB read ``` -### Understanding Node.js benchmark metrics and results with Autocannon +## Interpret the Autocannon benchmark metrics -- **Avg (Average Latency)** → The mean time it took for requests to get a response. -- **Stdev (Standard Deviation)** → How much individual request times vary around the average. Smaller numbers mean more consistent response times. -- **Min (Minimum Latency)** → The fastest request observed during the test. +Now have a look at the Autocannon benchmark metrics to get a sense of how Node.js performed. Here is an explanation of the metrics and what they mean: + +- The average latency (Avg) shows the mean time it takes for each request to receive a response from the server. +- Standard deviation (Stdev) indicates how much the response times vary around the average; lower values mean the server responds more consistently. +- The minimum latency (Min) represents the fastest response recorded during the benchmark, highlighting the best-case performance for individual requests. + +## Review Node.js benchmark results on x86_64 -### Benchmark summary on x86_64 To compare the benchmark results, the following results were collected by running the same benchmark on a `x86 - c4-standard-4` (4 vCPUs, 15 GB Memory) x86_64 VM in GCP, running SUSE: -Latency (ms): +### Latency results (ms): | Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max | |----------|------|--------------|-------|-----|--------|--------|-------| | Latency | 0 | 1 | 2 | 2 | 0.73 | 0.87 | 104 | -Throughput: +### Throughput results: | Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min | |------------|--------|--------|---------|---------|----------|-----------|---------| | Req/Sec | 70,143 | 70,143 | 84,479 | 93,887 | 84,128 | 7,547.18 | 70,095 | | Bytes/Sec | 13.6 MB| 13.6 MB| 16.4 MB | 18.2 MB | 16.3 MB | 1.47 MB | 13.6 MB| -### Benchmark summary on Arm64 -Results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE): +## Review Node.js benchmark results on Arm64 + +Here are the results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE): -Latency (ms): +### Latency results (ms): | Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max | |----------|------|--------------|-------|-----|------|-------|------| | Latency | 1 | 1 | 3 | 3 | 1.2 | 0.62 | 24 | -Throughput: +### Throughput results: | Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min | |------------|--------|--------|---------|---------|----------|----------|---------| | Req/Sec | 45,279 | 45,279 | 54,719 | 55,199 | 53,798.4 | 2,863.96 | 45,257 | | Bytes/Sec | 8.78 MB| 8.78 MB| 10.6 MB | 10.7 MB | 10.4 MB | 557 kB | 8.78 MB | -### Node.js performance benchmarking comparison on Arm64 and x86_64 -When you compare the benchmarking results, you will notice that on the Google Axion C4A Arm-based instances: +## Evaluate Node.js performance on Arm64 -- Average latency is very low (~1.2 ms) with consistent response times. -- Maximum latency spikes are rare, reaching up to 24 ms. -- The server handles high throughput, averaging ~53,798 requests/sec. -- Data transfer rate averages 10.4 MB/sec, demonstrating efficient performance under load. +Now that you have the benchmarking results, you can see how Node.js performs on Arm64: +- The average latency is low, around 1.2 ms, which means your server responds quickly to requests. +- Response times are consistent, with only occasional spikes up to 24 ms. +- The server processes a high volume of traffic, averaging about 53,800 requests per second. +- Data transfer rates are efficient, averaging 10.4 MB per second during the benchmark. diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/installation.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/installation.md index 344ae9471c..5f9dbe67ff 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/installation.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/installation.md @@ -1,22 +1,30 @@ --- -title: Install Node.js Using Node Version Manager +title: Install Node.js using Node Version Manager weight: 4 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Install Node.js with Node Version Manager (NVM) -This guide walks you through installing **NodeJS** via the Node Version Manager (NVM). NVM is a powerful tool that allows users to specify which version of **NodeJS** that they want to use. NVM will then download and install the requested vesion using the **NodeJS** official packages. +## Install Node Version Manager (NVM) +To install Node.js on your Arm-based VM, use Node Version Manager (NVM). NVM lets you select and manage different Node.js versions easily. By using official Node.js packages, you'll get a reliable and straightforward setup. -### 1. Install Node Version Manager (NVM) -First, we will run this command to download and install NVM into our VM instance: + +First, use this command to download and install NVM into your VM instance: ```console curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash ``` -Next, we have to activate NVM in our terminal shell. We can manually activate our current shell via copy and paste of the following into the shell: +Next, activate Node Version Manager (NVM) in your current terminal session. Copy and paste the following commands into your shell to load NVM and enable command completion: + +```console +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" +``` + +This step ensures that NVM commands are available in your shell. If you open a new terminal, repeat these commands or add them to your `~/.bashrc` file for automatic activation: ```console export NVM_DIR="$HOME/.nvm" @@ -24,30 +32,28 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion ``` -You should be able to confirm that NVM is available by typing: +Confirm that NVM is available by typing: ```console nvm --version ``` -### 2. Install NodeJS -Now that NVM is installed, we simply type the following commands in our shell to download and install **NodeJS**: +## Install Node.js +Now that NVM is installed, download and install Node.js: ```console nvm install v24 nvm use v24 ``` -Additionally, we can add this command to the bottom of our $HOME/.bashrc file: +Next, add this command to the bottom of your $HOME/.bashrc file: ```console echo 'nvm use v24' >> ~/.bashrc ``` -### 3. Verify Installation -Check that Node.js and npm (Node’s package manager) are installed correctly. - -You should be able to confirm that **NodeJS** is now installed and available! +## Verify installation +Check that Node.js and npm (Node.js package manager) are installed correctly by using this command that confirms that **NodeJS** is installed and available: ```console node --version @@ -60,4 +66,10 @@ v24.10.0 11.6.1 ``` -Node.js installation is complete. You can now proceed with the baseline testing. +This shows you that Node.js installation is complete. You can now proceed with the baseline testing. + +## What you've accomplished + +You've successfully provisioned a Google Axion C4A Arm virtual machine running SUSE Linux Enterprise Server. You're now ready to install Node.js and deploy your workloads on Arm. + + diff --git a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/instance.md b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/instance.md index fc33e92cfe..d23b5c22a7 100644 --- a/content/learning-paths/servers-and-cloud-computing/node-js-gcp/instance.md +++ b/content/learning-paths/servers-and-cloud-computing/node-js-gcp/instance.md @@ -16,24 +16,54 @@ For support on GCP setup, see the Learning Path [Getting started with Google Clo ## Provision a Google Axion C4A Arm VM in Google Cloud Console -To create a virtual machine based on the C4A instance type: -- Navigate to the [Google Cloud Console](https://console.cloud.google.com/). -- Go to **Compute Engine > VM Instances** and select **Create Instance**. -- Under **Machine configuration**: - - Populate fields such as **Instance name**, **Region**, and **Zone**. +To create a virtual machine using the C4A instance type in Google Cloud Platform: + +- Open [Google Cloud Console](https://console.cloud.google.com/). +- In the left menu, select **Compute Engine**, then select **VM Instances**. +- Select **Create Instance**. +- In the **Machine configuration** section: + - Enter a unique **Instance name**. + - Choose your preferred **Region** and **Zone**. - Set **Series** to `C4A`. - - Select `c4a-standard-4` for machine type. + - Select `c4a-standard-4` for the machine type. ![Create a Google Axion C4A Arm virtual machine in the Google Cloud Console with c4a-standard-4 selected alt-text#center](images/gcp-vm.png "Creating a Google Axion C4A Arm virtual machine in Google Cloud Console") +This configuration gives you four Arm vCPUs and 16 GB memory, optimized for Arm workloads. + +## Select OS and finalize VM settings + +After configuring the machine type, you'll need to select the operating system and finalize your VM settings. Follow the steps below to select an Arm64-based OS image, configure networking, and launch your instance. This ensures your VM is ready for Arm-native development and accessible for further setup. + + +- In the **OS and Storage** section, select **Change**: + - Choose an Arm64-based OS image. For this Learning Path, select **SUSE Linux Enterprise Server**. + - For **License type**, select **Pay as you go**. + - Select **Select** to confirm your choices. + +- In the **Networking** section, enable **Allow HTTP traffic**. + +- Select **Review and create** to review your configuration. + +- Select **Create** to launch your VM instance. + +- After the VM is created, locate your instance in the **VM Instances** list. + - Select the **SSH** button next to your instance to open a browser-based SSH shell. + +{{% notice Note %}} +If you don't see the **SSH** option, refresh the page or check that your VM is running. The SSH shell opens in a new browser window, giving you direct access to your Arm-based VM. +{{% /notice %}} -- Under **OS and Storage**, select **Change**, then choose an Arm64-based OS image. For this Learning Path, use **SUSE Linux Enterprise Server**. Select "Pay As You Go" for the license type. Click **Select**. -- Under **Networking**, enable **Allow HTTP traffic**. -- Click **Create** to launch the instance. -- Once created, you should see a "SSH" option to the right in your list of VM instances. Click on this to launch a SSH shell into your VM instance: ![Invoke a SSH session via your browser alt-text#center](images/gcp-ssh.png "Invoke a SSH session into your running VM instance") -- A window from your browser should come up and you should now see a shell into your VM instance: +A window from your browser should come up and you should now see a shell into your VM instance: ![Terminal Shell in your VM instance alt-text#center](images/gcp-shell.png "Terminal shell in your VM instance") + + +## What you've accomplished + +You've successfully provisioned a Google Axion C4A Arm virtual machine running SUSE Linux Enterprise Server. You're now ready to install Node.js and deploy your workloads on Arm. + +