Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: Deploy Golang on the Microsoft Azure Cobalt 100 processors

draft: true
cascade:
draft: true

minutes_to_complete: 40

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.

learning_objectives:
- Provision an Azure Arm64 virtual machine using Azure console, with Ubuntu Pro 24.04 LTS as the base image.
- Deploy Golang on an Arm64-based virtual machine running Ubuntu Pro 24.04 LTS.
- Perform Golang baseline testing and benchmarking on both x86_64 and Arm64 virtual machine.

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

author: Jason Andrews

### Tags
skilllevels: Advanced
subjects: Performance and Architecture
cloud_service_providers: Microsoft Azure

armips:
- Neoverse

tools_software_languages:
- Golang
- go test -bench

operatingsystems:
- Linux

further_reading:
- resource:
title: Effective Go Benchmarking
link: https://go.dev/doc/effective_go#testing
type: Guide
- resource:
title: Testing and Benchmarking in Go
link: https://pkg.go.dev/testing
type: Official Documentation
- resource:
title: Using go test -bench for Benchmarking
link: https://pkg.go.dev/cmd/go#hdr-Testing_flags
type: Reference


### FIXED, DO NOT MODIFY
# ================================================================================
weight: 1 # _index.md always has weight of 1 to order correctly
layout: "learningpathall" # All files under learning paths have this same wrapper
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# ================================================================================
# FIXED, DO NOT MODIFY THIS FILE
# ================================================================================
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
title: "Next Steps" # Always the same, html page title.
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Overview"

weight: 2

layout: "learningpathall"
---

## Cobalt 100 Arm-based processor

Azure’s Cobalt 100 is built on Microsoft's first-generation, in-house Arm-based processor: the Cobalt 100. Designed entirely by Microsoft and based on Arm’s Neoverse N2 architecture, this 64-bit CPU delivers improved performance and energy efficiency across a broad spectrum of cloud-native, scale-out Linux workloads. These include web and application servers, data analytics, open-source databases, caching systems, and more. Running at 3.4 GHz, the Cobalt 100 processor allocates a dedicated physical core for each vCPU, ensuring consistent and predictable performance.

To learn more about Cobalt 100, refer to the blog [Announcing the preview of new Azure virtual machine based on the Azure Cobalt 100 processor](https://techcommunity.microsoft.com/blog/azurecompute/announcing-the-preview-of-new-azure-vms-based-on-the-azure-cobalt-100-processor/4146353).

## Golang
Golang (or Go) is an open-source programming language developed by Google, designed for simplicity, efficiency, and scalability. It provides built-in support for concurrency, strong typing, and a rich standard library, making it ideal for building reliable, high-performance applications.

Go is widely used for cloud-native development, microservices, system programming, DevOps tools, and distributed systems. Learn more from the [Go official website](https://go.dev/) and its [official documentation](https://go.dev/doc/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
title: Golang Baseline Testing
weight: 5

### FIXED, DO NOT MODIFY
layout: learningpathall
---


### Baseline testing of Golang Web Page on Azure Arm64
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.

**1. Create Project Directory**

First, create a new folder called goweb to contain all project files, and then navigate into it:

```console
mkdir goweb && cd goweb
```
This command creates a new directory named goweb and then switches into it.

**2. Create HTML Page with Bootstrap Styling**

Next, create a file named `index.html` using the nano editor:

```console
nano index.html
```

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.

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Go Web on Azure ARM64</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #6dd5fa, #2980b9);
color: white;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.card {
background: rgba(255, 255, 255, 0.9);
color: #333;
border-radius: 20px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<div class="container">
<div class="card p-5">
<h1 class="mb-3"> Go Web on Azure Arm64</h1>
<p class="lead">This page is powered by Golang running on the Microsoft Azure Cobalt 100 processors.</p>
<a href="/api/hello" class="btn btn-primary mt-3">Test API Endpoint</a>
</div>
</div>
</body>
</html>
```
**3. Create Golang Web Server**

Now create the Go program that will serve this web page:

```console
nano main.go
```
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.

```go
package main
import (
"encoding/json"
"log"
"net/http"
"time"
)
func main() {
// Serve index.html for root
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
http.ServeFile(w, r, "index.html")
return
}
http.FileServer(http.Dir(".")).ServeHTTP(w, r)
})
// REST API endpoint for JSON response
http.HandleFunc("/api/hello", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{
"message": "Hello from Go on Azure ARM64!",
"time": time.Now().Format(time.RFC1123),
})
})
log.Println("Server running on http://0.0.0.0:80")
log.Fatal(http.ListenAndServe(":80", nil))
}
```
{{% notice Note %}}Running on port 80 requires root privileges. Use sudo with the full Go path if needed.{{% /notice %}}
**4. Run on the Web Server**

Run your Go program with:

```console
sudo /usr/local/go/bin/go run main.go
```

This compiles and immediately starts the server. If the server starts successfully, you will see the following message in your terminal::

```output
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
```
**5. Allow HTTP Traffic in Firewall**

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.

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:

```console
sudo ufw allow 80/tcp
sudo ufw enable
```
You can verify that HTTP is now allowed with:

```console
sudo ufw status
```
You should see an output similar to:
```output
Status: active

To Action From
-- ------ ----
8080/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
8080/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
```

**6. Open in Browser**

Run the following command to print your VM’s public URL, then open it in a browser:

```console
echo "http://$(curl -s ifconfig.me)/"
```
When you visit this link, you should see the styled HTML page being served directly by your Go application.

You should see the Golang web page confirming a successful installation of Golang.

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

Now, your Golang instance is ready for further benchmarking and production use.
Loading