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/golang-on-azure/_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
@@ -5,9 +5,9 @@ draft: true
5
5
cascade:
6
6
draft: true
7
7
8
-
minutes_to_complete: 40
8
+
minutes_to_complete: 30
9
9
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.
11
11
12
12
learning_objectives:
13
13
- 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:
16
16
17
17
prerequisites:
18
18
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
19
-
- Basic understanding of Linux command line.
20
19
- Familiarity with the [Golang](https://go.dev/) and deployment practices on Arm64 platforms.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/golang-on-azure/baseline-testing.md
+26-29Lines changed: 26 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,27 +7,26 @@ layout: learningpathall
7
7
---
8
8
9
9
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.
12
12
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:
16
16
17
17
```console
18
18
mkdir goweb && cd goweb
19
19
```
20
-
This command creates a new directory named goweb and then switches into it.
21
20
22
-
**2. Create HTML Page with Bootstrap Styling**
21
+
2. Create an HTML Page with Bootstrap Styling
23
22
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`:
25
24
26
25
```console
27
26
nano index.html
28
27
```
29
28
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.
31
30
32
31
```html
33
32
<!DOCTYPE html>
@@ -66,14 +65,14 @@ Paste the following HTML code into the index.html file. This builds a simple, st
66
65
</body>
67
66
</html>
68
67
```
69
-
**3. Create Golang Web Server**
68
+
3. Create Golang Web Server
70
69
71
-
Nowcreate 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.
72
71
73
72
```console
74
73
nano main.go
75
74
```
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.
77
76
78
77
```go
79
78
package main
@@ -105,57 +104,55 @@ func main() {
105
104
}
106
105
```
107
106
{{% 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**
109
107
110
-
Run your Go program with:
108
+
4. Run the Web Server
109
+
110
+
Compile and start your Go program with:
111
111
112
112
```console
113
113
sudo /usr/local/go/bin/go run main.go
114
114
```
115
115
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:
117
117
118
118
```output
119
119
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
120
120
```
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.
122
124
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.
124
126
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:
126
128
127
129
```console
128
130
sudo ufw allow 80/tcp
129
131
sudo ufw enable
130
132
```
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:
132
134
133
135
```console
134
136
sudo ufw status
135
137
```
136
-
You should see an output similar to:
138
+
You should see output similar to:
137
139
```output
138
140
Status: active
139
141
140
142
To Action From
141
143
-- ------ ----
142
-
8080/tcp ALLOW Anywhere
143
144
80/tcp ALLOW Anywhere
144
-
8080/tcp (v6) ALLOW Anywhere (v6)
145
145
80/tcp (v6) ALLOW Anywhere (v6)
146
146
```
147
147
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:
151
150
152
151
```console
153
152
echo "http://$(curl -s ifconfig.me)/"
154
153
```
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.
158
155
159
156

160
157
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.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/golang-on-azure/benchmarking.md
+37-36Lines changed: 37 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,36 +6,36 @@ weight: 6
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Run the performance tests using go test -bench
9
+
## Run Performance Tests Using go test -bench
10
10
11
11
`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.
12
12
13
13
1. Create a Project Folder
14
14
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:
16
16
17
17
```console
18
18
mkdir gosort-bench
19
19
cd gosort-bench
20
20
```
21
21
22
22
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:
25
25
26
26
```console
27
27
go mod init gosort-bench
28
28
```
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.
30
30
31
31
3. Add Sorting Functions
32
32
33
-
Create a file called **sorting.go**:
33
+
Create a file called `sorting.go`:
34
34
35
35
```console
36
36
nano sorting.go
37
37
```
38
-
Paste this code in **sorting.go** file:
38
+
Paste the following code in `sorting.go`:
39
39
40
40
```go
41
41
package sorting
@@ -75,13 +75,15 @@ func partition(arr []int, low, high int) int {
75
75
return i + 1
76
76
}
77
77
```
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.
83
83
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.
85
87
86
88
```console
87
89
mkdir sorting
@@ -90,13 +92,13 @@ mv sorting.go sorting/
90
92
91
93
4. Add Benchmark Tests
92
94
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):
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.
134
140
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.
141
142
142
143
### Run the Benchmark
143
144
144
145
Execute the benchmark suite using the following command:
145
146
```console
146
147
go test -bench=. -benchmem
147
148
```
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.
-**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
167
164
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
+
168
169
### 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.
170
171
171
172
| Benchmark | Value on Virtual Machine |
172
173
|-------------------|--------------------------|
@@ -179,7 +180,7 @@ Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pr
179
180
| Total time (s) | 2.905 |
180
181
181
182
### 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.
183
184
184
185
| Benchmark | Value on Virtual Machine |
185
186
|-------------------|--------------------------|
@@ -196,8 +197,8 @@ Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu P
196
197
197
198
When you compare the benchmarking results you will notice that on the Azure Cobalt 100:
198
199
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.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/golang-on-azure/create-instance.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,17 @@ layout: learningpathall
8
8
9
9
## Introduction
10
10
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.
12
18
13
19
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.
14
20
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/).
0 commit comments