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
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
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.
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 is still running from the last section, you can 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:
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/node-js-gcp/installation.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,10 @@ weight: 4
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Overview
10
-
This section shows you how to install Node.js using Node Version Manager (NVM). NVM lets you choose which Node.js version to use and handles the download and installation for you. You’ll use official Node.js packages, making setup simple and reliable.
11
-
12
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
+
12
+
13
13
First, use this command to download and install NVM into your VM instance:
0 commit comments