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,69 @@
---
title: Migrate MySQL from on-premises x64 to Azure Cobalt 100 Arm VMs

description: Learn how to migrate a MySQL database from an on-premises x64 environment to an Arm-based Azure Cobalt 100 VM and validate performance with sysbench.

draft: true
cascade:
draft: true

minutes_to_complete: 30

who_is_this_for: This Learning Path is for developers who want to migrate MySQL from an on-premises x64 environment to an Arm-based Azure Cobalt 100 virtual machine.

learning_objectives:
- Provision an Arm-based Azure Cobalt 100 virtual machine by using Terraform and Azure CLI.
- Export and restore a MySQL database from an on-premises x64 simulator into the Arm VM.
- Run sysbench on the migrated database and interpret key performance metrics.

prerequisites:
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
- Basic familiarity with SSH and MySQL command-line tools


author: Doug Anson

### Tags
skilllevels: Introductory
subjects: Performance and Architecture
cloud_service_providers:
- Microsoft Azure

armips:
- Neoverse

tools_software_languages:
- MySQL
- Terraform
- Azure CLI
- sysbench
- Bash

operatingsystems:
- Linux

further_reading:
- resource:
title: Azure Virtual Machines documentation
link: https://learn.microsoft.com/en-us/azure/virtual-machines/
type: documentation
- resource:
title: Copying MySQL databases to another machine
link: https://dev.mysql.com/doc/refman/8.4/en/copying-databases.html
type: documentation
- resource:
title: mysqldump reference
link: https://dev.mysql.com/doc/refman/8.4/en/mysqldump.html
type: documentation
- resource:
title: sysbench benchmarking tools for MySQL
link: https://manpages.ubuntu.com/manpages/trusty/man1/sysbench.1.html
type: documentation


### 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,26 @@
---
title: Understand Azure Cobalt 100 VMs and MySQL migration strategy

weight: 2

layout: "learningpathall"
---

### Azure Cobalt 100 Arm-based processor

Azure’s Cobalt 100 is Microsoft’s first-generation, in-house Arm-based processor. Built on Arm Neoverse N2, Cobalt 100 is a 64-bit CPU that delivers strong performance and energy efficiency for cloud-native, scale-out Linux workloads such as web and application servers, data analytics, open-source databases, and caching systems. Running at 3.4 GHz, Cobalt 100 allocates a dedicated physical core for each vCPU, which helps ensure consistent and predictable performance.

To learn more, see the Microsoft blog [Announcing the preview of new Azure VMs 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).

### MySQL Migrations

MySQL is a cross-platform relational database system whose storage engines and on-disk formats are designed for reliability and portability. When you move between CPU architectures, such as x64 to Arm, MySQL documentation recommends a logical migration instead of copying raw data files.

A practical approach is to use `mysqldump` to export SQL, transfer the dump, and import it on the Arm target with the `mysql` client. The MySQL 8.4 Reference Manual also recommends this approach for cross-architecture transfers.


## What you've learned and what's next

You now have the background on Azure Cobalt 100 and the recommended MySQL migration method for x64-to-Arm moves.

Next, you'll create a simulated on-premises x64 server in Azure and prepare it as the migration source environment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
title: Benchmarking with Arm-based Azure Cloud MySQL

weight: 6

layout: "learningpathall"
---

### Introduction

In this section, you'll run sysbench on the Arm-based Azure MySQL instance and review core performance metrics.


### Preparing to run the benchmark

From your local machine, open an SSH shell to the on-premises simulator by replacing `YOUR_RSA_FILENAME` and `YOUR_ONPREM_IP_ADDRESS`:

```bash
ssh -i $HOME/.ssh/YOUR_RSA_FILENAME azureadmin@YOUR_ONPREM_IP_ADDRESS
```

From that on-premises shell, identify the SSH key in `$HOME/.ssh` used for the Azure VM. Then connect to the Arm-based Azure VM:

```bash
ssh -i $HOME/.ssh/AZURE_CLOUD_RSA_FILENAME azureadmin@YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS
```

You should now have an SSH shell into your Arm-based Azure VM.

Next, create a file named `run.sh` with the following content:

```bash
#!/bin/bash


run_bench() {
THR=$1
LENGTH=$2
FILENAME=${PREFIX}_${THR}.perf
if [ -f ${FILENAME} ]; then
rm ${FILENAME}
fi
set -x
sysbench /usr/share/sysbench/oltp_read_write.lua --table-size=1000000 --db-driver=mysql --mysql-db=testdb --mysql-user=${ADMIN} --mysql-password=${PW} --time=${LENGTH} --max-requests=0 --threads=${THR} run 2>&1 1>${FILENAME}
set +x
}

main() {
run_bench 16 60
run_bench 32 60
run_bench 64 60
run_bench 96 60
run_bench 128 60
}

export ADMIN=$1
export PW=$2
export PREFIX=$3
shift 3

main $*
```

Make the script executable:

```bash
sudo chmod 755 ./run.sh
```

In the same shell, retrieve the MySQL root password file used by the migration script:

```bash
sudo su -
cat /root/mysql_root_password.txt
```

### Running the benchmark

Run `run.sh`, replacing `AZURE_CLOUD_MYSQL_ADMIN_PW` with the password value you just retrieved:

```bash
./run.sh admin AZURE_CLOUD_MYSQL_ADMIN_PW cobalt_100_arm64
```

The script creates five `.perf` files with sysbench `oltp_read_write` results at different thread counts.

### Interpreting the results

First, download the five `.perf` files from the Azure VM to your on-premises simulator shell. Replace `AZURE_CLOUD_RSA_FILENAME` and `YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS`:

```bash
cd $HOME
scp -i $HOME/.ssh/AZURE_CLOUD_RSA_FILENAME azureadmin@YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS:*.perf .
```

Next, from your local machine, copy those files from the on-premises simulator to your local host. Replace `ON_PREM_RSA_FILENAME` and `YOUR_ON_PREM_SIM_IP_ADDRESS`:

```bash
cd $HOME
scp -i $HOME/.ssh/ON_PREM_RSA_FILENAME azureuser@YOUR_ON_PREM_SIM_IP_ADDRESS:*.perf .
```

You should now have five `.perf` files on your local host.

To summarize key metrics quickly, run:

```bash
for f in *.perf; do
echo "== $f =="
grep -E "threads:|transactions:|queries:|95th percentile:" "$f"
echo
done
```

Use these values to compare throughput and latency across thread counts:

- Higher `transactions:` values indicate better throughput.
- Lower `95th percentile:` values indicate better tail latency.
- Look for where adding threads no longer increases throughput meaningfully.

The following example image shows benchmark output from this workflow:

![Azure Cobalt 100 Arm64 E4pds_v6 sysbench results#center](images/benchmark.png "Azure Cobalt 100 Arm64 E4pds_v6 sysbench results")

### What we learned

You learned how to provision an Arm-based Azure VM for MySQL migration, move a database from an on-premises x64 simulator, and evaluate performance by reading sysbench throughput and latency metrics.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: Create an Azure X64 virtual machine as an "on-prem simulator"
weight: 3

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

### Overview

In this section, you'll use the Azure portal to create a virtual machine with an x64 processor architecture.

This VM acts as your simulated on-premises x64 MySQL server.

### Create an Azure x64 virtual machine

To create an Azure virtual machine:

- Launch the Azure portal and navigate to **Virtual Machines**.
- Select **Create**, and select **Virtual Machine** from the drop-down list.
- Inside the **Basic** tab, fill in the instance details such as **Virtual machine name** and **Region**.
- Select the image for your virtual machine (for example, Ubuntu Pro 24.04 LTS) and select **x64** as the VM architecture.
- In the **Size** field, select **See all sizes** and select the D-Series v6 family of virtual machines.
- Select **D4ads_v6** from the list as shown in the diagram below:

![Azure Portal showing D-Series v6 VM size selection with x64 D4ads_v6 highlighted#center](images/instance.png "Select D4ads_v6 from the D-Series v6 x64 family")

- For **Authentication type**, select **SSH public key**.

{{% notice Note %}}
Azure can generate an SSH key pair for you and lets you save it for future use.
{{% /notice %}}

- Fill in the **Administrator username** for your VM.
- Select **Generate new key pair**, and select **RSA SSH Format** as the SSH Key Type.

{{% notice Note %}}
RSA offers better security with keys longer than 3072 bits.
{{% /notice %}}

- Give your SSH key a key pair name.
- In the **Inbound port rules**, select **HTTP (80)** and **SSH (22)** as the inbound ports, as shown below:

![Azure Portal showing inbound port rules with HTTP (80) and SSH (22) selected#center](images/instance1.png "Configure inbound port rules for HTTP and SSH access")

- Now select the **Review + Create** tab and review the configuration for your virtual machine. It should look like the following:

![Azure Portal Review + Create tab showing VM configuration summary ready for deployment#center](images/instance3.png "Review VM configuration before creation")

- When you're happy with your selection, select the **Create** button and then **Download Private key and Create Resource** button.

![Azure Portal showing Create button and SSH key download dialog#center](images/instance4.png "Download SSH key and create the virtual machine")

Your virtual machine should be ready and running in a few minutes. You can SSH into the virtual machine using the private key, along with the public IP details.

![Azure Portal showing successful VM deployment with confirmation details#center](images/final-vm.png "Successful VM deployment confirmation")

{{% notice Note %}}To learn more about virtual machines in Azure, see "Getting Started with Microsoft Azure" in [Get started with cloud instances](/learning-paths/servers-and-cloud-computing/csp/azure/).{{% /notice %}}

## What you've learned and what's next

You've created an Azure x64 virtual machine running Ubuntu 24.04 LTS with SSH authentication configured. The virtual machine is now ready to act as your simulated on-premises environment for this Learning Path.

Next, you will prepare this environment by installing MySQL and loading a sample database for migration.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading