Skip to content

Commit 97a402f

Browse files
Merge pull request #2430 from DougAnsonAustinTX/qc_nodejs_tech_review
GCP Axion nodejs tech review and updates
2 parents a550eb2 + 618987d commit 97a402f

File tree

6 files changed

+72
-66
lines changed

6 files changed

+72
-66
lines changed

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ You should see an output similar to:
2828
Hello from Node.js
2929
undefined
3030
```
31-
This confirms that Node.js can execute JavaScript commands successfully.
31+
This confirms that Node.js can execute JavaScript commands successfully. Please now press "Ctrl-D" to exit node.
3232

3333
### 2. Test a Basic HTTP Server
3434
You can now create a small HTTP server to validate that Node.js can handle web requests.
3535

36-
Create `app.js`:
36+
Create `app.js`. For example, you can type "vi app.js" in the SSH shell:
37+
38+
```console
39+
vi app.js
40+
```
41+
42+
...and then insert the following code:
3743

3844
```javascript
3945
const http = require('http');
@@ -43,36 +49,28 @@ const server = http.createServer((req, res) => {
4349
res.end('Baseline test successful!\n');
4450
});
4551

46-
server.listen(3000, '0.0.0.0', () => {
47-
console.log('Server running at http://0.0.0.0:3000/');
52+
server.listen(80, '0.0.0.0', () => {
53+
console.log('Server running at http://0.0.0.0:80/');
4854
});
4955
```
50-
- This server listens on port 3000.
56+
- This server listens on port 80.
5157
- Binding to 0.0.0.0 allows connections from any IP, not just localhost.
5258

53-
Run the server:
59+
Save the code and exit your editor. Next, we run the HTTP server in the background via sudo:
5460

5561
```console
56-
node app.js
62+
export MY_NODE=`which node`
63+
sudo ${MY_NODE} app.js &
5764
```
5865
You should see an output similar to:
5966

6067
```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
68+
Server running at http://0.0.0.0:80/
7069
```
71-
{{% /notice %}}
7270
#### Test Locally with Curl
7371

7472
```console
75-
curl http://localhost:3000
73+
curl http://localhost:80
7674
```
7775

7876
You should see an output similar to:
@@ -85,7 +83,7 @@ Baseline test successful!
8583
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:
8684

8785
```console
88-
echo "http://$(curl -s ifconfig.me):3000/"
86+
echo "http://$(curl -s ifconfig.me):80/"
8987
```
9088

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

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,55 @@ After validating that Node.js is installed and your HTTP server is running, you
1414
**Autocannon** is a fast HTTP/1.1 benchmarking tool for Node.js, used to measure server throughput, latency, and request handling under concurrent load.
1515

1616
```console
17-
sudo npm install -g autocannon
17+
npm install -g autocannon
1818
```
1919

2020
### Start Your Node.js HTTP Server
2121

22+
If your sample HTTP server is not already running from the last section, you can start it by typing:
2223
```console
23-
node app.js
24+
export MY_NODE=`which node`
25+
sudo ${MY_NODE} app.js &
2426
```
2527

26-
Server should be listening on port 3000:
28+
Server should be listening on port 80 in the background:
2729

2830
```output
29-
Server running at http://0.0.0.0:3000/
31+
Server running at http://0.0.0.0:80/
3032
```
3133

3234
### Run a Basic Benchmark (Local)
3335

3436
```console
35-
autocannon -c 100 -d 10 http://localhost:3000
37+
autocannon -c 100 -d 10 http://localhost:80
3638
```
3739
- `-c 100` → 100 concurrent connections
3840
- `-d 10` → duration 10 seconds
3941
- URL → endpoint to test
4042

4143
You should see an output similar to:
4244
```output
43-
Running 10s test @ http://localhost:3000
45+
Running 10s test @ http://localhost:80
4446
100 connections
4547
4648
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,27945,27954,71955,199 │ 53,798.42,863.9645,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-
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴──────────┴─────────┘
49+
┌─────────┬──────┬──────┬───────┬──────┬────────┬─────────┬───────┐
50+
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
51+
├─────────┼──────┼──────┼───────┼──────┼────────┼─────────┼───────┤
52+
│ Latency │ 1 ms │ 1 ms │ 2 ms │ 2 ms │ 1.06 ms │ 0.41 ms │ 28 ms │
53+
└─────────┴──────┴──────┴───────┴──────┴────────┴─────────┴───────┘
54+
┌───────────┬─────────┬─────────┬─────────┬────────┬───────────┬──────────┬─────────┐
55+
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
56+
├───────────┼─────────┼─────────┼─────────┼────────┼───────────┼──────────┼─────────┤
57+
│ Req/Sec │ 66,17566,17570,84772,191 │ 70,713.611,616.8666,134
58+
├───────────┼─────────┼─────────┼─────────┼────────┼───────────┼──────────┼─────────┤
59+
│ Bytes/Sec │ 12.8 MB │ 12.8 MB │ 13.7 MB │ 14 MB │ 13.7 MB │ 313 kB │ 12.8 MB │
60+
└───────────┴─────────┴─────────┴─────────┴────────┴───────────┴──────────┴─────────┘
5961
6062
Req/Bytes counts sampled once per second.
6163
# of samples: 10
6264
63-
538k requests in 10.03s, 104 MB read
65+
707k requests in 10.02s, 137 MB read
6466
```
6567

6668
### Understanding Node.js benchmark metrics and results with Autocannon
22.3 KB
Loading
12.5 KB
Loading
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
11
---
2-
title: Install Node.js
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
10-
This guide walks you through installing **Node.js v24.8.0** on a SUSE Arm64 virtual machine using the official tarball package.
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.
1111

12-
### 1. Download Node.js Binary
13-
First, download the Node.js package (precompiled binaries for Linux Arm64) from the official website.
12+
### 1. Install Node Version Manager (NVM)
13+
First, we will run this command to download and install NVM into our VM instance:
1414

1515
```console
16-
sudo wget https://nodejs.org/dist/latest/node-v24.8.0-linux-arm64.tar.gz
16+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
1717
```
1818

19-
### 2. Extract the Tarball
20-
Unpack the downloaded file so we can access the Node.js binaries.
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:
2120

2221
```console
23-
sudo tar -xvf node-v24.8.0-linux-arm64.tar.gz
22+
export NVM_DIR="$HOME/.nvm"
23+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
24+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
2425
```
2526

26-
### 3. Rename Extracted Directory
27-
Rename the extracted folder to something shorter such as node-v24.8.01 for easier reference.
27+
You should be able to confirm that NVM is available by typing:
2828

2929
```console
30-
sudo mv node-v24.8.0-linux-arm64 node-v24.8.0
30+
nvm --version
3131
```
3232

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.
33+
### 2. Install NodeJS
34+
Now that NVM is installed, we simply type the following commands in our shell to download and install **NodeJS**:
3735

3836
```console
39-
sudo ln -s /usr/local/node-v24.8.0 /usr/local/node
37+
nvm install v24
38+
nvm use v24
4039
```
4140

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.
41+
Additionally, we can add this command to the bottom of our $HOME/.bashrc file:
4542

4643
```console
47-
echo 'export PATH=$HOME/node-v24.8.0/bin:$PATH' >> ~/.bashrc
48-
source ~/.bashrc
44+
echo 'nvm use v24' >> ~/.bashrc
4945
```
5046

51-
### 6. Verify Installation
47+
### 3. Verify Installation
5248
Check that Node.js and npm (Node’s package manager) are installed correctly.
5349

50+
You should be able to confirm that **NodeJS** is now installed and available!
51+
5452
```console
55-
node -v
56-
npm -v
53+
node --version
54+
npm --version
5755
```
56+
5857
You should see an output similar to:
5958
```output
60-
v24.8.0
61-
11.6.0
59+
v24.10.0
60+
11.6.1
6261
```
6362

6463
Node.js installation is complete. You can now proceed with the baseline testing.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ To create a virtual machine based on the C4A instance type:
2727
![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")
2828

2929

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**.
30+
- 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**.
3131
- Under **Networking**, enable **Allow HTTP traffic**.
3232
- Click **Create** to launch the instance.
33+
- 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:
34+
35+
![Invoke a SSH session via your browser alt-text#center](images/gcp-ssh.png "Invoke a SSH session into your running VM instance")
36+
37+
- A window from your browser should come up and you should now see a shell into your VM instance:
38+
39+
![Terminal Shell in your VM instance alt-text#center](images/gcp-shell.png "Terminal shell in your VM instance")

0 commit comments

Comments
 (0)