Skip to content

Commit 235135a

Browse files
Merge pull request #2343 from odidev/Node_LP
Deploy Node.js on Google Cloud C4A (Arm-based Axion VMs)
2 parents f996eea + 95b5199 commit 235135a

File tree

9 files changed

+392
-0
lines changed

9 files changed

+392
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Deploy Node.js on Google Cloud C4A (Arm-based Axion VMs)
3+
4+
minutes_to_complete: 30
5+
6+
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.
7+
8+
9+
learning_objectives:
10+
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
11+
- Install and configure Node.js on a SUSE Arm64 (C4A) instance
12+
- Validate Node.js functionality with baseline HTTP server tests
13+
- Benchmark Node.js performance using Autocannon on Arm64 (AArch64) architecture
14+
15+
16+
prerequisites:
17+
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
18+
- Familiarity with networking concepts and [Node.js event-driven architecture](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick)
19+
20+
author: Pareena Verma
21+
22+
##### Tags
23+
skilllevels: Introductory
24+
subjects: Web
25+
cloud_service_providers: Google Cloud
26+
27+
armips:
28+
- Neoverse
29+
30+
tools_software_languages:
31+
- Node.js
32+
- npm
33+
- Autocannon
34+
35+
operatingsystems:
36+
- Linux
37+
38+
# ================================================================================
39+
# FIXED, DO NOT MODIFY
40+
# ================================================================================
41+
further_reading:
42+
- resource:
43+
title: Google Cloud documentation
44+
link: https://cloud.google.com/docs
45+
type: documentation
46+
47+
- resource:
48+
title: Node.js documentation
49+
link: https://nodejs.org/en
50+
type: documentation
51+
52+
- resource:
53+
title: Autocannon documentation
54+
link: https://www.npmjs.com/package/autocannon/v/5.0.0
55+
type: documentation
56+
57+
weight: 1
58+
layout: "learningpathall"
59+
learning_path_main_page: "yes"
60+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Getting started with Node.js on Google Axion C4A (Arm Neoverse-V2)
3+
4+
weight: 2
5+
6+
layout: "learningpathall"
7+
---
8+
9+
## Google Axion C4A Arm instances in Google Cloud
10+
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.
12+
13+
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.
14+
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.
16+
17+
## Node.js
18+
19+
Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine.
20+
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/).
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Node.js baseline testing on Google Axion C4A Arm Virtual machine
3+
weight: 5
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
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+
12+
## Validate Node.js installation with a baseline test
13+
14+
### 1. Run a Simple REPL Test
15+
The Node.js REPL (Read-Eval-Print Loop) allows you to run JavaScript commands interactively.
16+
17+
```console
18+
node
19+
```
20+
Inside the REPL, type:
21+
22+
```console
23+
console.log("Hello from Node.js");
24+
```
25+
You should see an output similar to:
26+
27+
```output
28+
Hello from Node.js
29+
undefined
30+
```
31+
This confirms that Node.js can execute JavaScript commands successfully.
32+
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.
35+
36+
Create `app.js`:
37+
38+
```javascript
39+
const http = require('http');
40+
41+
const server = http.createServer((req, res) => {
42+
res.writeHead(200, { 'Content-Type': 'text/plain' });
43+
res.end('Baseline test successful!\n');
44+
});
45+
46+
server.listen(3000, '0.0.0.0', () => {
47+
console.log('Server running at http://0.0.0.0:3000/');
48+
});
49+
```
50+
- This server listens on port 3000.
51+
- Binding to 0.0.0.0 allows connections from any IP, not just localhost.
52+
53+
Run the server:
54+
55+
```console
56+
node app.js
57+
```
58+
You should see an output similar to:
59+
60+
```output
61+
Server running at http://0.0.0.0:3000/
62+
```
63+
{{% notice Note %}}
64+
Make sure your GCP firewall allows TCP traffic on port 3000. On SUSE Arm64, internal firewalls are usually disabled, so only the GCP firewall needs to be configured.
65+
66+
```console
67+
sudo zypper install -y firewalld
68+
sudo firewall-cmd --permanent --add-port=3000/tcp
69+
sudo firewall-cmd --reload
70+
```
71+
{{% /notice %}}
72+
#### Test Locally with Curl
73+
74+
```console
75+
curl http://localhost:3000
76+
```
77+
78+
You should see an output similar to:
79+
80+
```output
81+
Baseline test successful!
82+
```
83+
84+
#### Test from a Browser
85+
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:
86+
87+
```console
88+
echo "http://$(curl -s ifconfig.me):3000/"
89+
```
90+
91+
You should see the following message in your browser, confirming that your Node.js HTTP server is running successfully:
92+
93+
![Node.js Browser alt-text#center](images/node-browser.png)
94+
95+
This verifies the basic functionality of the Node.js installation before proceeding to the benchmarking.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: Node.js Benchmarking
3+
weight: 6
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Node.js Benchmarking by Autocannon
10+
11+
After validating that Node.js is installed and your HTTP server is running, you can benchmark it using **Autocannon**.
12+
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.
15+
16+
```console
17+
sudo npm install -g autocannon
18+
```
19+
20+
### Start Your Node.js HTTP Server
21+
22+
```console
23+
node app.js
24+
```
25+
26+
Server should be listening on port 3000:
27+
28+
```output
29+
Server running at http://0.0.0.0:3000/
30+
```
31+
32+
### Run a Basic Benchmark (Local)
33+
34+
```console
35+
autocannon -c 100 -d 10 http://localhost:3000
36+
```
37+
- `-c 100` → 100 concurrent connections
38+
- `-d 10` → duration 10 seconds
39+
- URL → endpoint to test
40+
41+
You should see an output similar to:
42+
```output
43+
Running 10s test @ http://localhost:3000
44+
100 connections
45+
46+
47+
┌─────────┬──────┬──────┬───────┬──────┬────────┬─────────┬───────┐
48+
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
49+
├─────────┼──────┼──────┼───────┼──────┼────────┼─────────┼───────┤
50+
│ Latency │ 1 ms │ 1 ms │ 3 ms │ 3 ms │ 1.2 ms │ 0.62 ms │ 24 ms │
51+
└─────────┴──────┴──────┴───────┴──────┴────────┴─────────┴───────┘
52+
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬──────────┬─────────┐
53+
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
54+
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────┼─────────┤
55+
│ Req/Sec │ 45,279 │ 45,279 │ 54,719 │ 55,199 │ 53,798.4 │ 2,863.96 │ 45,257 │
56+
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────┼─────────┤
57+
│ Bytes/Sec │ 8.78 MB │ 8.78 MB │ 10.6 MB │ 10.7 MB │ 10.4 MB │ 557 kB │ 8.78 MB │
58+
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴──────────┴─────────┘
59+
60+
Req/Bytes counts sampled once per second.
61+
# of samples: 10
62+
63+
538k requests in 10.03s, 104 MB read
64+
```
65+
66+
### Understanding Node.js benchmark metrics and results with Autocannon
67+
68+
- **Avg (Average Latency)** → The mean time it took for requests to get a response.
69+
- **Stdev (Standard Deviation)** → How much individual request times vary around the average. Smaller numbers mean more consistent response times.
70+
- **Min (Minimum Latency)** → The fastest request observed during the test.
71+
72+
### Benchmark summary on x86_64
73+
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:
74+
75+
Latency (ms):
76+
77+
| Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max |
78+
|----------|------|--------------|-------|-----|--------|--------|-------|
79+
| Latency | 0 | 1 | 2 | 2 | 0.73 | 0.87 | 104 |
80+
81+
Throughput:
82+
83+
| Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
84+
|------------|--------|--------|---------|---------|----------|-----------|---------|
85+
| Req/Sec | 70,143 | 70,143 | 84,479 | 93,887 | 84,128 | 7,547.18 | 70,095 |
86+
| Bytes/Sec | 13.6 MB| 13.6 MB| 16.4 MB | 18.2 MB | 16.3 MB | 1.47 MB | 13.6 MB|
87+
88+
### Benchmark summary on Arm64
89+
Results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE):
90+
91+
Latency (ms):
92+
93+
| Metric | 2.5% | 50% (Median) | 97.5% | 99% | Avg | Stdev | Max |
94+
|----------|------|--------------|-------|-----|------|-------|------|
95+
| Latency | 1 | 1 | 3 | 3 | 1.2 | 0.62 | 24 |
96+
97+
Throughput:
98+
99+
| Metric | 1% | 2.5% | 50% | 97.5% | Avg | Stdev | Min |
100+
|------------|--------|--------|---------|---------|----------|----------|---------|
101+
| Req/Sec | 45,279 | 45,279 | 54,719 | 55,199 | 53,798.4 | 2,863.96 | 45,257 |
102+
| Bytes/Sec | 8.78 MB| 8.78 MB| 10.6 MB | 10.7 MB | 10.4 MB | 557 kB | 8.78 MB |
103+
104+
### Node.js performance benchmarking comparison on Arm64 and x86_64
105+
When you compare the benchmarking results, you will notice that on the Google Axion C4A Arm-based instances:
106+
107+
- Average latency is very low (~1.2 ms) with consistent response times.
108+
- Maximum latency spikes are rare, reaching up to 24 ms.
109+
- The server handles high throughput, averaging ~53,798 requests/sec.
110+
- Data transfer rate averages 10.4 MB/sec, demonstrating efficient performance under load.
261 KB
Loading
11.3 KB
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Install Node.js
3+
weight: 4
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Install Node.js
10+
This guide walks you through installing **Node.js v24.8.0** on a SUSE Arm64 virtual machine using the official tarball package.
11+
12+
### 1. Download Node.js Binary
13+
First, download the Node.js package (precompiled binaries for Linux Arm64) from the official website.
14+
15+
```console
16+
sudo wget https://nodejs.org/dist/latest/node-v24.8.0-linux-arm64.tar.gz
17+
```
18+
19+
### 2. Extract the Tarball
20+
Unpack the downloaded file so we can access the Node.js binaries.
21+
22+
```console
23+
sudo tar -xvf node-v24.8.0-linux-arm64.tar.gz
24+
```
25+
26+
### 3. Rename Extracted Directory
27+
Rename the extracted folder to something shorter such as node-v24.8.01 for easier reference.
28+
29+
```console
30+
sudo mv node-v24.8.0-linux-arm64 node-v24.8.0
31+
```
32+
33+
### 4. Create a Symlink (Optional)
34+
This step creates a shortcut (`/usr/local/node`) pointing to your Node.js installation directory.
35+
36+
It makes future upgrades easier — you only need to update the symlink instead of changing paths everywhere.
37+
38+
```console
39+
sudo ln -s /usr/local/node-v24.8.0 /usr/local/node
40+
```
41+
42+
### 5. Update PATH Environment Variable
43+
44+
Add Node.js binaries to your PATH so you can run `node` and `npm` commands from anywhere in your terminal.
45+
46+
```console
47+
echo 'export PATH=$HOME/node-v24.8.0/bin:$PATH' >> ~/.bashrc
48+
source ~/.bashrc
49+
```
50+
51+
### 6. Verify Installation
52+
Check that Node.js and npm (Node’s package manager) are installed correctly.
53+
54+
```console
55+
node -v
56+
npm -v
57+
```
58+
You should see an output similar to:
59+
```output
60+
v24.8.0
61+
11.6.0
62+
```
63+
64+
Node.js installation is complete. You can now proceed with the baseline testing.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Create a Google Axion C4A Arm virtual machine on GCP
3+
weight: 3
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Overview
10+
11+
In this section, you will learn how to provision a Google Axion C4A Arm virtual machine on Google Cloud Platform (GCP) using the `c4a-standard-4` (4 vCPUs, 16 GB memory) machine type in the Google Cloud Console.
12+
13+
{{% notice Note %}}
14+
For support on GCP setup, see the Learning Path [Getting started with Google Cloud Platform](https://learn.arm.com/learning-paths/servers-and-cloud-computing/csp/google/).
15+
{{% /notice %}}
16+
17+
## Provision a Google Axion C4A Arm VM in Google Cloud Console
18+
19+
To create a virtual machine based on the C4A instance type:
20+
- Navigate to the [Google Cloud Console](https://console.cloud.google.com/).
21+
- Go to **Compute Engine > VM Instances** and select **Create Instance**.
22+
- Under **Machine configuration**:
23+
- Populate fields such as **Instance name**, **Region**, and **Zone**.
24+
- Set **Series** to `C4A`.
25+
- Select `c4a-standard-4` for machine type.
26+
27+
![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")
28+
29+
30+
- Under **OS and Storage**, select **Change**, then choose an Arm64-based OS image. For this Learning Path, use **SUSE Linux Enterprise Server**. Pick the preferred version for your Operating System. Ensure you select the **Arm image** variant. Click **Select**.
31+
- Under **Networking**, enable **Allow HTTP traffic**.
32+
- Click **Create** to launch the instance.

0 commit comments

Comments
 (0)