Skip to content

Commit fe67faa

Browse files
authored
Merge pull request #2360 from pareenaverma/content_review
Go on Azure LP Tech review
2 parents 280ab62 + d575d8d commit fe67faa

File tree

5 files changed

+90
-88
lines changed

5 files changed

+90
-88
lines changed

content/learning-paths/servers-and-cloud-computing/golang-on-azure/_index.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ draft: true
55
cascade:
66
draft: true
77

8-
minutes_to_complete: 40
8+
minutes_to_complete: 30
99

10-
who_is_this_for: This Learning Path is designed for software developers looking to migrate their Golang workloads from x86_64 to Arm-based platforms, specifically on the Microsoft Azure Cobalt 100 processors.
10+
who_is_this_for: This is an introductory topic for software developers looking to migrate their Golang workloads from x86_64 to Arm-based platforms, specifically on the Microsoft Azure Cobalt 100 processors.
1111

1212
learning_objectives:
1313
- Provision an Azure Arm64 virtual machine using Azure console, with Ubuntu Pro 24.04 LTS as the base image.
@@ -16,13 +16,12 @@ learning_objectives:
1616

1717
prerequisites:
1818
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
19-
- Basic understanding of Linux command line.
2019
- Familiarity with the [Golang](https://go.dev/) and deployment practices on Arm64 platforms.
2120

22-
author: Jason Andrews
21+
author: Pareena Verma
2322

2423
### Tags
25-
skilllevels: Advanced
24+
skilllevels: Introductory
2625
subjects: Performance and Architecture
2726
cloud_service_providers: Microsoft Azure
2827

@@ -31,7 +30,6 @@ armips:
3130

3231
tools_software_languages:
3332
- Golang
34-
- go test -bench
3533

3634
operatingsystems:
3735
- Linux

content/learning-paths/servers-and-cloud-computing/golang-on-azure/baseline-testing.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@ layout: learningpathall
77
---
88

99

10-
### Baseline testing of Golang Web Page on Azure Arm64
11-
This section demonstrates how to test your Go installation on the **Ubuntu Pro 24.04 LTS Arm64** virtual machine by creating and running a simple Go web server that serves a styled HTML page.
10+
### Baseline Testing: Running a Go Web Server on Azure Arm64
11+
To validate your Go toolchain and runtime environment, you can build and run a lightweight web server. This ensures that compilation, networking, and runtime execution are working correctly on your Ubuntu Pro 24.04 LTS Arm64 virtual machine running on Azure Cobalt 100.
1212

13-
**1. Create Project Directory**
14-
15-
First, create a new folder called goweb to contain all project files, and then navigate into it:
13+
1. Create the project directory
14+
15+
Start by creating a new folder to hold your Go web project and navigate to it:
1616

1717
```console
1818
mkdir goweb && cd goweb
1919
```
20-
This command creates a new directory named goweb and then switches into it.
2120

22-
**2. Create HTML Page with Bootstrap Styling**
21+
2. Create an HTML Page with Bootstrap Styling
2322

24-
Next, create a file named `index.html` using the nano editor:
23+
Next, create a simple web page that your Go server will serve. Using the nano editor (or any editor of your choice), create a file named `index.html`:
2524

2625
```console
2726
nano index.html
2827
```
2928

30-
Paste the following HTML code into the index.html file. This builds a simple, styled web page with a header, a welcome message, and a button using Bootstrap.
29+
Paste the following HTML code into the `index.html` file. This page uses Bootstrap for styling and includes a header, a welcome message, and a button that links to a Go-powered API endpoint.
3130

3231
```html
3332
<!DOCTYPE html>
@@ -66,14 +65,14 @@ Paste the following HTML code into the index.html file. This builds a simple, st
6665
</body>
6766
</html>
6867
```
69-
**3. Create Golang Web Server**
68+
3. Create Golang Web Server
7069

71-
Now create the Go program that will serve this web page:
70+
Now, let’s create the Go program that will serve your static HTML page and expose a simple API endpoint.
7271

7372
```console
7473
nano main.go
7574
```
76-
Paste the following code into the main.go file. This sets up a very basic web server that serves files from the current folder, including the **index.html** you just created. When it runs, it will print a message showing the server address.
75+
Paste the following code into the `main.go` file. This sets up a very basic web server that serves files from the current folder, including the `index.html` you just created. When it runs, it will print a message showing the server address.
7776

7877
```go
7978
package main
@@ -105,57 +104,55 @@ func main() {
105104
}
106105
```
107106
{{% notice Note %}}Running on port 80 requires root privileges. Use sudo with the full Go path if needed.{{% /notice %}}
108-
**4. Run on the Web Server**
109107

110-
Run your Go program with:
108+
4. Run the Web Server
109+
110+
Compile and start your Go program with:
111111

112112
```console
113113
sudo /usr/local/go/bin/go run main.go
114114
```
115115

116-
This compiles and immediately starts the server. If the server starts successfully, you will see the following message in your terminal::
116+
This command compiles the Go source code into a binary and immediately starts the server on port 80. If the server starts successfully, you will see the following message in your terminal:
117117

118118
```output
119119
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
120120
```
121-
**5. Allow HTTP Traffic in Firewall**
121+
5. Allow HTTP Traffic in Firewall
122+
123+
On Ubuntu Pro 24.04 LTS virtual machines, UFW (Uncomplicated Firewall) is used to manage firewall rules. By default, it allows only SSH (port 22), while other inbound connections are blocked.
122124

123-
On **Ubuntu Pro 24.04 LTS** virtual machines, **UFW (Uncomplicated Firewall)** is used to manage firewall rules. By default, it allows only SSH (port 22) and blocks most other traffic.
125+
Even if you have already configured Azure Network Security Group (NSG) rules to allow inbound traffic on port 80, the VM level firewall may still block HTTP requests until explicitly opened.
124126

125-
So even if Azure allows HTTP on port 80 (added to inbound ports during VM creation), your VM’s firewall may still block it until you run:
127+
Run the following commands to allow HTTP traffic on port 80:
126128

127129
```console
128130
sudo ufw allow 80/tcp
129131
sudo ufw enable
130132
```
131-
You can verify that HTTP is now allowed with:
133+
After enabling UFW and allowing traffic on port 80, confirm that the firewall is now configured correctly by running:
132134

133135
```console
134136
sudo ufw status
135137
```
136-
You should see an output similar to:
138+
You should see output similar to:
137139
```output
138140
Status: active
139141
140142
To Action From
141143
-- ------ ----
142-
8080/tcp ALLOW Anywhere
143144
80/tcp ALLOW Anywhere
144-
8080/tcp (v6) ALLOW Anywhere (v6)
145145
80/tcp (v6) ALLOW Anywhere (v6)
146146
```
147147

148-
**6. Open in Browser**
149-
150-
Run the following command to print your VM’s public URL, then open it in a browser:
148+
6. Open in a Browser
149+
To quickly get your VM’s public IP address and form the URL, run:
151150

152151
```console
153152
echo "http://$(curl -s ifconfig.me)/"
154153
```
155-
When you visit this link, you should see the styled HTML page being served directly by your Go application.
156-
157-
You should see the Golang web page confirming a successful installation of Golang.
154+
Open this URL in your browser, and you should see the styled HTML landing page being served directly by your Go application.
158155

159156
![golang](images/go-web.png)
160157

161-
Now, your Golang instance is ready for further benchmarking and production use.
158+
Reaching this page in your browser confirms that Go is installed correctly, your environment is configured, and your Go web server is working end-to-end on Azure Cobalt 100 (Arm64). You can now proceed to perform further benchmarking tests.

content/learning-paths/servers-and-cloud-computing/golang-on-azure/benchmarking.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ weight: 6
66
layout: learningpathall
77
---
88

9-
## Run the performance tests using go test -bench
9+
## Run Performance Tests Using go test -bench
1010

1111
`go test -bench` (the benchmarking mode of go test) is Golang’s built-in benchmarking framework that measures the performance of functions by running them repeatedly and reporting execution time (**ns/op**), memory usage, and allocations. With the `-benchmem flag`, it also shows memory usage and allocations. It’s simple, reliable, and requires only writing benchmark functions in the standard Golang testing package.
1212

1313
1. Create a Project Folder
1414

15-
Open your terminal and create a new folder for this project:
15+
In your terminal, create a directory for your benchmark project and navigate into it:
1616

1717
```console
1818
mkdir gosort-bench
1919
cd gosort-bench
2020
```
2121

2222
2. Initialize a Go Module
23-
24-
Inside the project directory, run following command:
23+
24+
Inside your project directory, initialize a new Go module by running:
2525

2626
```console
2727
go mod init gosort-bench
2828
```
29-
This creates a go.mod file, which defines the module path (gosort-bench in this case) and marks the directory as a Go project. The go.mod file also allows Go to manage dependencies (external libraries) automatically, ensuring your project remains reproducible and easy to maintain.
29+
This creates a `go.mod` file, which defines the module path (gosort-bench in this case) and marks the directory as a Go project. The `go.mod` file also allows Go to manage dependencies (external libraries) automatically, ensuring your project remains reproducible and easy to maintain.
3030

3131
3. Add Sorting Functions
3232

33-
Create a file called **sorting.go**:
33+
Create a file called `sorting.go`:
3434

3535
```console
3636
nano sorting.go
3737
```
38-
Paste this code in **sorting.go** file:
38+
Paste the following code in `sorting.go`:
3939

4040
```go
4141
package sorting
@@ -75,13 +75,15 @@ func partition(arr []int, low, high int) int {
7575
return i + 1
7676
}
7777
```
78-
- The code contains **two sorting methods**, Bubble Sort and Quick Sort, which arrange numbers in order from smallest to largest.
79-
- **Bubble Sort** works by repeatedly comparing two numbers side by side and swapping them if they are in the wrong order. It keeps doing this until the whole list is sorted.
80-
- **Quick Sor**t is faster. It picks a "pivot" number and splits the list into two groups — numbers smaller than the pivot and numbers bigger than it. Then it sorts each group separately.
81-
- The **function** partition helps Quick Sort decide where to split the list based on the pivot number.
82-
- In short, **Bubble Sort is simple but slow,** while **Quick Sort is smarter and usually much faster for big lists of numbers**.
78+
The code contains two sorting methods, Bubble Sort and Quick Sort, which arrange numbers in order from smallest to largest.
79+
* Bubble Sort works by repeatedly comparing two numbers side by side and swapping them if they are in the wrong order. It keeps doing this until the whole list is sorted.
80+
* Quick Sort is faster. It picks a pivot number and splits the list into two groups — numbers smaller than the pivot and numbers bigger than it. Then it sorts each group separately. The function partition helps Quick Sort decide where to split the list based on the pivot number.
81+
82+
To summarize, Bubble Sort is simple but slow, while Quick Sort is more efficient and usually much faster for big lists of numbers.
8383

84-
You create the sorting folder and then move `sorting.go` into it to organize your code properly so that the Go module can reference it as `gosort-bench/sorting`.
84+
At this point, you have defined two sorting algorithms ready to be benchmarked.
85+
86+
To keep your project modular and maintainable, it’s best practice to place implementation code inside its own package folder. This allows benchmarks and other Go files to import it cleanly.
8587

8688
```console
8789
mkdir sorting
@@ -90,13 +92,13 @@ mv sorting.go sorting/
9092

9193
4. Add Benchmark Tests
9294

93-
Create another file called s**orting_benchmark_test.go**:
95+
Next, create a benchmark test file named `sorting_benchmark_test.go` in your project’s root directory (not inside the sorting/ folder, so it can import the sorting package cleanly):
9496

9597
```console
9698
nano sorting_benchmark_test.go
9799
````
98100

99-
Paste the below code:
101+
Paste the following code into it:
100102

101103
```go
102104
package sorting_test
@@ -131,24 +133,23 @@ func BenchmarkQuickSort(b *testing.B) {
131133
}
132134
}
133135
```
136+
The code implements a benchmark that checks how fast Bubble Sort and Quick Sort run in Go.
137+
- It first creates a list of 10,000 random numbers each time before running a sort, so the test is fair and consistent.
138+
- The BenchmarkBubbleSort() function measures the speed of sorting using the slower Bubble Sort method.
139+
- The BenchmarkQuickSort() function measures the speed of sorting using the faster Quick Sort method.
134140

135-
- The code is a **benchmark test** that checks how fast Bubble Sort and Quick Sort run in Go.
136-
- It first creates a **list of 10,000 random numbers** each time before running a sort, so the test is fair and consistent.
137-
- **BenchmarkBubbleSort** measures the speed of sorting using the slower Bubble Sort method.
138-
- **BenchmarkQuickSort** measures the speed of sorting using the faster Quick Sort method.
139-
140-
When you run **go test -bench=. -benchmem**, Go will show you how long each sort takes and how much memory it uses, so you can compare the two sorting techniques.
141+
When you run the benchmark, Go will show you how long each sort takes and how much memory it uses, so you can compare the two sorting techniques.
141142

142143
### Run the Benchmark
143144

144145
Execute the benchmark suite using the following command:
145146
```console
146147
go test -bench=. -benchmem
147148
```
148-
- **-bench=.** - runs all functions starting with Benchmark.
149-
- **-benchmem** - also shows memory usage (allocations per operation).
149+
-bench=. runs every function whose name starts with Benchmark.
150+
-benchmem adds memory metrics (B/op, allocs/op) to the report.
150151

151-
You should see the output similar to this:
152+
You should see output similar to:
152153

153154
```output
154155
goos: linux
@@ -159,14 +160,14 @@ BenchmarkQuickSort-4 3506 340873 ns/op 0
159160
PASS
160161
ok gosort-bench 2.905s
161162
```
162-
### Matrics Explanation
163-
164-
- **ns/op** - nanoseconds per operation (lower is better).
165-
- **B/op** - bytes of memory used per operation.
166-
- **allocs/op** - how many memory allocations happened per operation.
163+
### Metrics Explained
167164

165+
* ns/op – nanoseconds per operation (lower is better). This is the primary latency metric.
166+
* B/op – bytes allocated per operation (lower is better). This is useful for spotting hidden allocations.
167+
* allocs/op – number of heap allocations per operation (lower is better). Zero here means the algorithm itself didn’t allocate.
168+
168169
### Benchmark summary on Arm64
169-
Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pro 24.04 LTS virtual machine**.
170+
Here is a summary of benchmark results collected on an Arm64 D4ps_v6 Ubuntu Pro 24.04 LTS virtual machine.
170171

171172
| Benchmark | Value on Virtual Machine |
172173
|-------------------|--------------------------|
@@ -179,7 +180,7 @@ Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pr
179180
| Total time (s) | 2.905 |
180181

181182
### Benchmark summary on x86_64
182-
Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu Pro 24.04 LTS virtual machine**.
183+
Here is a summary of the benchmark results collected on x86_64 D4s_v6 Ubuntu Pro 24.04 LTS virtual machine.
183184

184185
| Benchmark | Value on Virtual Machine |
185186
|-------------------|--------------------------|
@@ -196,8 +197,8 @@ Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu P
196197

197198
When you compare the benchmarking results you will notice that on the Azure Cobalt 100:
198199

199-
- **Arm64 maintains consistency**the virtual machine delivered stable and predictable results, showing that Arm64 optimizations are effective for compute workloads.
200-
- **BubbleSort (CPU-heavy, O(n²))** – runs in **~36.6M ns/op**, proving that raw CPU performance on Arm64 is consistent and unaffected by environmental factors.
201-
- **QuickSort (efficient O(n log n))** – execution is very fast (**~341K ns/op**), demonstrating that Arm64 handles algorithmic workloads efficiently.
202-
- **No memory overhead** – the benchmark shows **0 B/op and 0 allocs/op**, confirming Golang’s memory efficiency is preserved on Arm64.
203-
- **Run counts align closely****BubbleSort (32 runs)** and **QuickSort (3,506 runs)** indicate Arm64 delivers repeatable and reliable performance.
200+
Azure Cobalt 100 (Arm64) outperforms in both BubbleSort and QuickSort benchmarks, with the advantage more pronounced for QuickSort. The performance delta (~15–33%) shows how Arm Neoverse cores deliver strong results in CPU-bound, integer-heavy workloads common in Go applications.
201+
202+
For real-world Go applications that rely on sorting, JSON processing, and other recursive or data-processing workloads, running on Azure Cobalt 100 Arm64 VMs can deliver better throughput and reduced execution time compared to similarly sized x86_64 VMs.
203+
204+
These results validate the benefits of running Go workloads on Azure Cobalt 100 Arm64 instances, and establish a baseline for extending benchmarks to real-world workloads beyond sorting.

content/learning-paths/servers-and-cloud-computing/golang-on-azure/create-instance.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ layout: learningpathall
88

99
## Introduction
1010

11-
There are several ways to create an Arm-based Cobalt 100 virtual machine : the Microsoft Azure console, the Azure CLI tool, or using your choice of IaC (Infrastructure as Code). This guide will use the Azure console to create a virtual machine with Arm-based Cobalt 100 Processor.
11+
There are several ways to create an Arm-based Cobalt 100 virtual machine:
12+
13+
- The Azure console
14+
- The Azure CLI
15+
- An infrastructure as code (IaC) tool
16+
17+
In this section, you will use the Azure console to create a virtual machine with the Arm-based Azure Cobalt 100 processor.
1218

1319
This learning path focuses on the general-purpose virtual machine of the D series. Please read the guide on [Dpsv6 size series](https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/general-purpose/dpsv6-series) offered by Microsoft Azure.
1420

15-
If you have never used the Microsoft Cloud Platform before, please review the microsoft [guide to Create a Linux virtual machine in the Azure portal](https://learn.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal?tabs=ubuntu).
21+
While the steps to create this instance are included here for convenience, you can also refer to the [Deploy a Cobalt 100 virtual machine on Azure Learning Path](/learning-paths/servers-and-cloud-computing/cobalt/).
1622

1723
#### Create an Arm-based Azure Virtual Machine
1824

0 commit comments

Comments
 (0)