You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/node-js-gcp/_index.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,17 @@
1
1
---
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
+
3
4
4
-
draft: true
5
-
cascade:
6
-
draft: true
7
5
8
6
minutes_to_complete: 30
9
7
10
8
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.
11
9
12
10
13
11
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
15
13
- 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
17
15
- Benchmark Node.js performance using Autocannon on Arm64 (AArch64) architecture
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/node-js-gcp/background.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,14 @@ layout: "learningpathall"
8
8
9
9
## Google Axion C4A Arm instances in Google Cloud
10
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.
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 highperformance and energy efficiency for modern cloud workloads, including CI/CD pipelines, microservices, media processing, and general-purpose applications.
12
12
13
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
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.
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).
16
16
17
17
## Node.js
18
18
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.
20
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/).
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/).
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
3
3
weight: 5
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
+
## Validate Node.js installation with a baseline test
9
10
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.
11
12
12
-
## Validate Node.js installation with a baseline test
13
+
## Run a simple REPL test
13
14
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:
16
16
17
17
```console
18
18
node
19
19
```
20
-
Inside the REPL, type:
20
+
21
+
Type the following command inside the REPL:
21
22
22
23
```console
23
24
console.log("Hello from Node.js");
24
25
```
25
-
You should see an output similar to:
26
+
27
+
The output is similar to:
26
28
27
29
```output
28
30
Hello from Node.js
29
31
undefined
30
32
```
31
-
This confirms that Node.js can execute JavaScript commands successfully. Please now press "Ctrl-D" to exit node.
32
33
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
35
37
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:
console.log('Server running at http://0.0.0.0:80/');
48
50
});
49
51
```
50
-
- This server listens on port 80.
51
-
- Binding to 0.0.0.0 allows connections from any IP, not just localhost.
52
52
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:
54
56
55
57
```console
56
58
export MY_NODE=`which node`
57
59
sudo ${MY_NODE} app.js &
58
60
```
59
-
You should see an output similar to:
61
+
62
+
The expected output is:
60
63
61
64
```output
62
65
Server running at http://0.0.0.0:80/
63
66
```
64
-
#### Test Locally with Curl
67
+
68
+
## Test locally with curl
69
+
70
+
Run the following command to test the server locally:
65
71
66
72
```console
67
73
curl http://localhost:80
68
74
```
69
75
70
-
You should see an output similar to:
76
+
The expected output is:
71
77
72
78
```output
73
79
Baseline test successful!
74
80
```
75
81
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:
78
85
79
86
```console
80
87
echo "http://$(curl -s ifconfig.me):80/"
81
88
```
82
89
83
90
You should see the following message in your browser, confirming that your Node.js HTTP server is running successfully:

86
93
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.
title: Benchmark Node.js performance with Autocannon on Arm and x86_64
3
3
weight: 6
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Node.js Benchmarking by Autocannon
9
+
## Benchmark Node.js with Autocannon
10
10
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.
12
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.
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:
15
16
16
17
```console
17
18
npm install -g autocannon
18
19
```
19
20
20
-
###Start Your Node.js HTTP Server
21
+
## Start the Node.js HTTP server
21
22
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:
23
24
```console
24
25
export MY_NODE=`which node`
25
26
sudo ${MY_NODE} app.js &
26
27
```
27
28
28
-
Server should be listening on port 80 in the background:
29
+
The server should be listening on port 80 in the background:
29
30
30
31
```output
31
32
Server running at http://0.0.0.0:80/
32
33
```
33
34
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:
35
38
36
39
```console
37
40
autocannon -c 100 -d 10 http://localhost:80
38
41
```
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 %}}
42
51
43
52
You should see an output similar to:
44
53
```output
@@ -65,48 +74,52 @@ Req/Bytes counts sampled once per second.
65
74
707k requests in 10.02s, 137 MB read
66
75
```
67
76
68
-
### Understanding Node.js benchmark metrics and results with Autocannon
77
+
##Interpret the Autocannon benchmark metrics
69
78
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
73
86
74
-
### Benchmark summary on x86_64
75
87
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:
## 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.
11
11
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:
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:
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:
You should be able to confirm that NVM is available by typing:
35
+
Confirm that NVM is available by typing:
28
36
29
37
```console
30
38
nvm --version
31
39
```
32
40
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:
35
43
36
44
```console
37
45
nvm install v24
38
46
nvm use v24
39
47
```
40
48
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:
42
50
43
51
```console
44
52
echo 'nvm use v24' >> ~/.bashrc
45
53
```
46
54
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:
51
57
52
58
```console
53
59
node --version
@@ -60,4 +66,10 @@ v24.10.0
60
66
11.6.1
61
67
```
62
68
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.
0 commit comments