Skip to content

Deploy Golang on the Microsoft Azure Cobalt 100 processors #2238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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,58 @@
---
title: Run Golang on the Microsoft Azure Cobalt 100 processors

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:
- Start an Azure Arm64 virtual machine using Azure console, with Ubuntu as the base image.
- Learn how to create an Azure Linux 3.0 Docker container.
- Deploy the Golang on an Azure Linux 3.0 Arm64-based Docker container and an Azure Linux 3.0 custom-image-based Azure virtual machine.
- Test and Benchmark Golang in both containerized and virtual machine environments.

prerequisites:
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6).
- A machine with [Docker](/install-guides/docker/) installed.
- 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
- Docker
- 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,22 @@
---
title: "Cobalt 100 Arm-based processor and Golang"

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).

## Azure Linux 3.0

Azure Linux 3.0 is Microsoft's in-house, lightweight Linux distribution optimized for running cloud-native workloads on Azure. Designed with performance, security, and reliability in mind, it is fully supported by Microsoft and tailored for containers, microservices, and Kubernetes. With native support for Arm64 (AArch64) architecture, Azure Linux 3.0 enables efficient execution of workloads on energy-efficient Arm-based infrastructure, making it a powerful choice for scalable and cost-effective cloud deployments.

## 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,135 @@
---
title: Golang Baseline Testing
weight: 6

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


### Baseline testing of Golang Web Page on Azure Arm64
This guide demonstrates how to test your Go installation on Azure Arm64 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 hold your project and move inside it:

```console
mkdir goweb && cd goweb
```
This makes a directory named goweb and then changes 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 inside. 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 code below. 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"
"gosort-bench"
)
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))
}
```

**4. Run the Web Server**

Run your Go program with:

```console
go run main.go
```

This compiles and immediately starts the server. If successful, you’ll see the message:

```output
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
```
**5. Open in Browser**

Finally, open your web browser and type in:

```bash
http://<Public-IP>:8080
```
Replace <**Public-IP**> with your Azure virtual machine’s actual public IP address. 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](./go-web.png)

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