Skip to content

Commit 58a7b04

Browse files
Merge pull request #2458 from madeline-underwood/node.js
Node.js_JA to review
2 parents 76e494f + fc67080 commit 58a7b04

File tree

6 files changed

+146
-88
lines changed

6 files changed

+146
-88
lines changed

content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
2-
title: Deploy Node.js on Google Cloud C4A (Arm-based Axion VMs)
2+
title: Deploy Node.js on Google Cloud C4A Arm-based Axion VMs
3+
34

4-
draft: true
5-
cascade:
6-
draft: true
75

86
minutes_to_complete: 30
97

108
who_is_this_for: This is an introductory topic for software developers migrating Node.js workloads from x86_64 to Arm-based servers, specifically on Google Cloud C4A virtual machines built on Axion processors.
119

1210

1311
learning_objectives:
14-
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
12+
- Provision an Arm-based SUSE Linux Enterprise Server virtual machine on Google Cloud C4A instances with Axion processors
1513
- Install and configure Node.js on a SUSE Arm64 (C4A) instance
16-
- Validate Node.js functionality with baseline HTTP server tests
14+
- Validate Node.js functionality with baseline HTTP server tests
1715
- Benchmark Node.js performance using Autocannon on Arm64 (AArch64) architecture
1816

1917

content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ layout: "learningpathall"
88

99
## Google Axion C4A Arm instances in Google Cloud
1010

11-
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.
11+
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.
1212

1313
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.
1414

15-
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.
15+
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).
1616

1717
## Node.js
1818

19-
Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine.
19+
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.
2020

21-
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.
22-
23-
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/).
21+
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/).
Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
---
2-
title: Node.js baseline testing on Google Axion C4A Arm Virtual machine
2+
title: Validate Node.js baseline on Google Axion C4A Arm virtual machine
33
weight: 5
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9+
## Validate Node.js installation with a baseline test
910

10-
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.
11+
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.
1112

12-
## Validate Node.js installation with a baseline test
13+
## Run a simple REPL test
1314

14-
### 1. Run a Simple REPL Test
15-
The Node.js REPL (Read-Eval-Print Loop) allows you to run JavaScript commands interactively.
15+
Start the Node.js REPL (Read-Eval-Print Loop) to run JavaScript commands interactively:
1616

1717
```console
1818
node
1919
```
20-
Inside the REPL, type:
20+
21+
Type the following command inside the REPL:
2122

2223
```console
2324
console.log("Hello from Node.js");
2425
```
25-
You should see an output similar to:
26+
27+
The output is similar to:
2628

2729
```output
2830
Hello from Node.js
2931
undefined
3032
```
31-
This confirms that Node.js can execute JavaScript commands successfully. Please now press "Ctrl-D" to exit node.
3233

33-
### 2. Test a Basic HTTP Server
34-
You can now create a small HTTP server to validate that Node.js can handle web requests.
34+
This confirms that Node.js can execute JavaScript commands successfully. Press "Ctrl-D" to exit node.
35+
36+
## Test a basic HTTP server
3537

36-
Use a text editor to create a file named `app.js` with the code below:
38+
Create a file named `app.js` with the following code to validate that Node.js can handle web requests:
3739

3840
```javascript
3941
const http = require('http');
@@ -47,41 +49,46 @@ server.listen(80, '0.0.0.0', () => {
4749
console.log('Server running at http://0.0.0.0:80/');
4850
});
4951
```
50-
- This server listens on port 80.
51-
- Binding to 0.0.0.0 allows connections from any IP, not just localhost.
5252

53-
Next, we run the HTTP server in the background via sudo:
53+
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.
54+
55+
Run the HTTP server in the background using sudo:
5456

5557
```console
5658
export MY_NODE=`which node`
5759
sudo ${MY_NODE} app.js &
5860
```
59-
You should see an output similar to:
61+
62+
The expected output is:
6063

6164
```output
6265
Server running at http://0.0.0.0:80/
6366
```
64-
#### Test Locally with Curl
67+
68+
## Test locally with curl
69+
70+
Run the following command to test the server locally:
6571

6672
```console
6773
curl http://localhost:80
6874
```
6975

70-
You should see an output similar to:
76+
The expected output is:
7177

7278
```output
7379
Baseline test successful!
7480
```
7581

76-
#### Test from a Browser
77-
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:
82+
## Test from a browser
83+
84+
Print your VM’s public URL and open it in a browser:
7885

7986
```console
8087
echo "http://$(curl -s ifconfig.me):80/"
8188
```
8289

8390
You should see the following message in your browser, confirming that your Node.js HTTP server is running successfully:
8491

85-
![Node.js Browser alt-text#center](images/node-browser.png)
92+
![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")
8693

87-
This verifies the basic functionality of the Node.js installation before proceeding to the benchmarking.
94+
You have now validated that Node.js is working correctly on your Arm VM. Proceed to benchmarking and performance testing.
Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,53 @@
11
---
2-
title: Node.js Benchmarking
2+
title: Benchmark Node.js performance with Autocannon on Arm and x86_64
33
weight: 6
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Node.js Benchmarking by Autocannon
9+
## Benchmark Node.js with Autocannon
1010

11-
After validating that Node.js is installed and your HTTP server is running, you can benchmark it using **Autocannon**.
11+
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.
1212

13-
### Install Autocannon
14-
**Autocannon** is a fast HTTP/1.1 benchmarking tool for Node.js, used to measure server throughput, latency, and request handling under concurrent load.
13+
## Install Autocannon
14+
15+
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:
1516

1617
```console
1718
npm install -g autocannon
1819
```
1920

20-
### Start Your Node.js HTTP Server
21+
## Start the Node.js HTTP server
2122

22-
If your sample HTTP server is not already running from the last section, you can start it by typing:
23+
If your sample HTTP server isn't running from the last section, start it by using this command:
2324
```console
2425
export MY_NODE=`which node`
2526
sudo ${MY_NODE} app.js &
2627
```
2728

28-
Server should be listening on port 80 in the background:
29+
The server should be listening on port 80 in the background:
2930

3031
```output
3132
Server running at http://0.0.0.0:80/
3233
```
3334

34-
### Run a Basic Benchmark (Local)
35+
## Run a local Node.js benchmark with Autocannon
36+
37+
Now run a local Node.js benchmark with Autocannon:
3538

3639
```console
3740
autocannon -c 100 -d 10 http://localhost:80
3841
```
39-
- `-c 100` → 100 concurrent connections
40-
- `-d 10` → duration 10 seconds
41-
- URL → endpoint to test
42+
{{% notice Tip %}}
43+
These options specify how the benchmarking tool runs the test:
44+
45+
- The `-c 100` flag sets the number of concurrent connections to one hundred, simulating multiple users accessing the endpoint at the same time.
46+
- The `-d 10` flag sets the test duration to ten seconds, so the tool sends requests for that period.
47+
- The URL is the endpoint you're measuring, which could be a web service or API running on your Arm server.
48+
49+
This configuration helps you evaluate how your application performs under load on Arm platforms.
50+
{{% /notice %}}
4251

4352
You should see an output similar to:
4453
```output
@@ -65,48 +74,52 @@ Req/Bytes counts sampled once per second.
6574
707k requests in 10.02s, 137 MB read
6675
```
6776

68-
### Understanding Node.js benchmark metrics and results with Autocannon
77+
## Interpret the Autocannon benchmark metrics
6978

70-
- **Avg (Average Latency)** → The mean time it took for requests to get a response.
71-
- **Stdev (Standard Deviation)** → How much individual request times vary around the average. Smaller numbers mean more consistent response times.
72-
- **Min (Minimum Latency)** → The fastest request observed during the test.
79+
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:
80+
81+
- The average latency (Avg) shows the mean time it takes for each request to receive a response from the server.
82+
- Standard deviation (Stdev) indicates how much the response times vary around the average; lower values mean the server responds more consistently.
83+
- The minimum latency (Min) represents the fastest response recorded during the benchmark, highlighting the best-case performance for individual requests.
84+
85+
## Review Node.js benchmark results on x86_64
7386

74-
### Benchmark summary on x86_64
7587
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:
7688

77-
Latency (ms):
89+
### Latency results (ms):
7890

7991
| Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max |
8092
|----------|------|--------------|-------|-----|--------|--------|-------|
8193
| Latency | 0 | 1 | 2 | 2 | 0.73 | 0.87 | 104 |
8294

83-
Throughput:
95+
### Throughput results:
8496

8597
| Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
8698
|------------|--------|--------|---------|---------|----------|-----------|---------|
8799
| Req/Sec | 70,143 | 70,143 | 84,479 | 93,887 | 84,128 | 7,547.18 | 70,095 |
88100
| Bytes/Sec | 13.6 MB| 13.6 MB| 16.4 MB | 18.2 MB | 16.3 MB | 1.47 MB | 13.6 MB|
89101

90-
### Benchmark summary on Arm64
91-
Results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE):
102+
## Review Node.js benchmark results on Arm64
103+
104+
Here are the results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE):
92105

93-
Latency (ms):
106+
### Latency results (ms):
94107

95108
| Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max |
96109
|----------|------|--------------|-------|-----|------|-------|------|
97110
| Latency | 1 | 1 | 3 | 3 | 1.2 | 0.62 | 24 |
98111

99-
Throughput:
112+
### Throughput results:
100113

101114
| Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
102115
|------------|--------|--------|---------|---------|----------|----------|---------|
103116
| Req/Sec | 45,279 | 45,279 | 54,719 | 55,199 | 53,798.4 | 2,863.96 | 45,257 |
104117
| Bytes/Sec | 8.78 MB| 8.78 MB| 10.6 MB | 10.7 MB | 10.4 MB | 557 kB | 8.78 MB |
105118

106-
### Node.js performance benchmarking comparison on Arm64 and x86_64
107-
When you compare the benchmarking results, you will notice that on the Google Axion C4A Arm-based instances:
119+
## Evaluate Node.js performance on Arm64
108120

109-
- Average latency is very low (~1.2 ms) with consistent response times.
110-
- Maximum latency spikes are rare, reaching up to 24 ms.
111-
- The server handles high throughput, averaging ~53,798 requests/sec.
112-
- Data transfer rate averages 10.4 MB/sec, demonstrating efficient performance under load.
121+
Now that you have the benchmarking results, you can see how Node.js performs on Arm64:
122+
- The average latency is low, around 1.2 ms, which means your server responds quickly to requests.
123+
- Response times are consistent, with only occasional spikes up to 24 ms.
124+
- The server processes a high volume of traffic, averaging about 53,800 requests per second.
125+
- Data transfer rates are efficient, averaging 10.4 MB per second during the benchmark.
Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,59 @@
11
---
2-
title: Install Node.js Using Node Version Manager
2+
title: Install Node.js using Node Version Manager
33
weight: 4
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Install Node.js with Node Version Manager (NVM)
10-
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.
9+
## Install Node Version Manager (NVM)
10+
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.
1111

12-
### 1. Install Node Version Manager (NVM)
13-
First, we will run this command to download and install NVM into our VM instance:
12+
13+
First, use this command to download and install NVM into your VM instance:
1414

1515
```console
1616
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
1717
```
1818

19-
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:
19+
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:
20+
21+
```console
22+
export NVM_DIR="$HOME/.nvm"
23+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
24+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
25+
```
26+
27+
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:
2028

2129
```console
2230
export NVM_DIR="$HOME/.nvm"
2331
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
2432
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
2533
```
2634

27-
You should be able to confirm that NVM is available by typing:
35+
Confirm that NVM is available by typing:
2836

2937
```console
3038
nvm --version
3139
```
3240

33-
### 2. Install NodeJS
34-
Now that NVM is installed, we simply type the following commands in our shell to download and install **NodeJS**:
41+
## Install Node.js
42+
Now that NVM is installed, download and install Node.js:
3543

3644
```console
3745
nvm install v24
3846
nvm use v24
3947
```
4048

41-
Additionally, we can add this command to the bottom of our $HOME/.bashrc file:
49+
Next, add this command to the bottom of your $HOME/.bashrc file:
4250

4351
```console
4452
echo 'nvm use v24' >> ~/.bashrc
4553
```
4654

47-
### 3. Verify Installation
48-
Check that Node.js and npm (Node’s package manager) are installed correctly.
49-
50-
You should be able to confirm that **NodeJS** is now installed and available!
55+
## Verify installation
56+
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:
5157

5258
```console
5359
node --version
@@ -60,4 +66,10 @@ v24.10.0
6066
11.6.1
6167
```
6268

63-
Node.js installation is complete. You can now proceed with the baseline testing.
69+
This shows you that Node.js installation is complete. You can now proceed with the baseline testing.
70+
71+
## What you've accomplished
72+
73+
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.
74+
75+

0 commit comments

Comments
 (0)