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,62 @@
---
title: Deploy MySQL on Microsoft Azure Cobalt 100 processors

draft: true
cascade:
draft: true

minutes_to_complete: 40

who_is_this_for: This is an advanced topic that introduces MySQL deployment on Microsoft Azure Cobalt 100 (Arm-based) virtual machines. It is designed for developers migrating MySQL applications from x86_64 to Arm.

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

prerequisites:
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
- Familiarity with relational databases and the basics of [MySQL](https://dev.mysql.com/doc/refman/8.0/en/introduction.html)

author: Pareena Verma

### Tags
skilllevels: Advanced
subjects: Databases
cloud_service_providers: Microsoft Azure

armips:
- Neoverse

tools_software_languages:
- MySQL
- SQL
- Docker

operatingsystems:
- Linux

further_reading:
- resource:
title: Azure Virtual Machines documentation
link: https://learn.microsoft.com/en-us/azure/virtual-machines/
type: documentation
- resource:
title: Azure Container Instances documentation
link: https://learn.microsoft.com/en-us/azure/container-instances/
type: documentation
- resource:
title: MySQL Manual
link: https://dev.mysql.com/doc/refman/8.0/en/installing.html
type: documentation
- resource:
title: mysqlslap official website
link: https://dev.mysql.com/doc/refman/8.4/en/mysqlslap.html
type: website

### 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,24 @@
---
title: "Overview"
weight: 2

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

## Cobalt 100 Arm-based processor

Azure Cobalt 100 is Microsoft’s first-generation Arm-based processor, designed for cloud-native, scale-out Linux workloads. Based on Arm’s Neoverse-N2 architecture, this 64-bit CPU delivers improved performance and energy efficiency. Running at 3.4 GHz, it provides a dedicated physical core for each vCPU, ensuring consistent and predictable performance.

Typical workloads include web and application servers, data analytics, open-source databases, and caching systems.

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

MySQL is an open-source relational database management system (RDBMS) widely used for storing, organizing, and managing structured data. It uses SQL (Structured Query Language) for querying and managing databases, making it one of the most popular choices for web applications, enterprise solutions, and cloud deployments.

It is known for its reliability, high performance, and ease of use. MySQL supports features like transactions, replication, partitioning, and robust security, making it suitable for both small applications and large-scale production systems.

Learn more at the [MySQL official website](https://www.mysql.com/) and in the [official documentation](https://dev.mysql.com/doc/)
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: Validate MySQL
weight: 6

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

## Run a functional test of MySQL on Azure Cobalt 100

After installing MySQL on your Arm64 virtual machine, you can perform simple baseline testing to validate that MySQL runs correctly and produces the expected output.

### Start MySQL

Make sure MySQL is running:

```console
sudo systemctl start mysql
sudo systemctl enable mysql
```
### Connect to MySQL

```console
mysql -u admin -p
```
Opens the MySQL client and connects as the new user(admin), prompting you to enter the admin password.

### Show and use Database

```sql
CREATE DATABASE baseline_test;
SHOW DATABASES;
USE baseline_test;
SELECT DATABASE();
```

- `CREATE DATABASE baseline_test;` - Creates a new database named baseline_test.
- `SHOW DATABASES;` - Lists all available databases.
- `USE baseline_test;` - Switches to the new database.
- `SELECT DATABASE();` - Confirms the current database in use.

You should see output similar to:

```output
mysql> CREATE DATABASE baseline_test;
Query OK, 1 row affected (0.01 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| baseline_test |
| benchmark_db |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)

mysql> USE baseline_test;
Database changed
mysql> SELECT DATABASE();
+---------------+
| DATABASE() |
+---------------+
| baseline_test |
+---------------+
1 row in set (0.00 sec)
```
You created a new database named **baseline_test**, verified its presence with `SHOW DATABASES`, and confirmed it is the active database using `SELECT DATABASE()`.

### Create and show Table

```sql
CREATE TABLE test_table (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
value INT
);
```

- `CREATE TABLE` - Defines a new table named test_table.
- `id` - Primary key with auto-increment.
- `name` - String field up to 50 characters.
- `value` - Integer field.
- `SHOW TABLES;` - Lists all tables in the current database.

You should see output similar to:

```output
Query OK, 0 rows affected (0.05 sec)

mysql> SHOW TABLES;
+-------------------------+
| Tables_in_baseline_test |
+-------------------------+
| test_table |
+-------------------------+
1 row in set (0.00 sec)
```
You successfully created the table **test_table** in the `baseline_test` database and verified its existence using `SHOW TABLES`.

### Insert Sample Data

```sql
INSERT INTO test_table (name, value)
VALUES
('Alice', 100),
('Bob', 200),
('Charlie', 300);
```
- `INSERT INTO test_table (name, value)` - Specifies which table and columns to insert into.
- `VALUES` - Provides three rows of data.

After inserting, you can check the data with:

```sql
SELECT * FROM test_table;
```
- `SELECT *` - Retrieves all columns.
- `FROM test_table` - Selects from the test_table.

You should see output similar to:

```output
mysql> SELECT * FROM test_table;
+----+---------+-------+
| id | name | value |
+----+---------+-------+
| 1 | Alice | 100 |
| 2 | Bob | 200 |
| 3 | Charlie | 300 |
+----+---------+-------+
3 rows in set (0.00 sec)
```

The functional test was successful — the **test_table** contains three rows (**Alice, Bob, and Charlie**) with their respective values, confirming MySQL is working
correctly.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
title: Benchmark MySQL with mysqlslap
weight: 7

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

## Benchmark MySQL on Azure Cobalt 100 Arm-based instances and x86_64 instances

`mysqlslap` is the official MySQL benchmarking tool used to simulate multiple client connections and measure query performance. It helps evaluate **read/write throughput, query response times**, and overall MySQL server performance under different workloads, making it ideal for baseline testing and optimization.

## Steps for MySQL Benchmarking with mysqlslap

1. Connect to MySQL and Create a Database

To access the MySQL server, use the following command based on your `admin` user password:

```console
mysql -u admin -p
```
Once logged in, you can create a benchmark_db using SQL commands like:

```sql
CREATE DATABASE benchmark_db;
USE benchmark_db;
```

3. Create a Table and Populate Data

After logging into MySQL, you can create a table to store benchmark data. Here’s a simple example:

```sql
CREATE TABLE benchmark_table (
record_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
score INT
);
```
Insert some sample rows manually:

```sql
INSERT INTO benchmark_table (username,score) VALUES
('John',100),('Jane',200),('Mike',300);
```

Or populate automatically with 1000 rows:

```sql
DELIMITER //
CREATE PROCEDURE populate_benchmark_data()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i <= 1000 DO
INSERT INTO benchmark_table (username, score)
VALUES (CONCAT('Player', i), i*10);
SET i = i + 1;
END WHILE;
END //
DELIMITER ;

CALL populate_benchmark_data();
DROP PROCEDURE populate_benchmark_data;
```
- The table `benchmark_table` has three columns: `record_id` (primary key), `username`, and `score`.
- You can insert a few rows manually for testing or use a procedure to generate **1000 rows automatically** for more realistic benchmarking

## Run a Simple Read/Write Benchmark

Once your table is ready, you can use `mysqlslap` to simulate multiple clients performing queries. This helps test MySQL’s performance under load.

```console
mysqlslap --user=admin --password="MyStrongPassword!" --host=127.0.0.1 --concurrency=10 --iterations=5 --query="INSERT INTO benchmark_db.benchmark_table (username,score) VALUES('TestUser',123);" --create-schema=benchmark_db
```
- **--user / --password:** MySQL login credentials.
- **--host:** MySQL server address (127.0.0.1 for local).
- **--concurrency:** Number of simultaneous clients (here, 10).
- **--iterations:** How many times to repeat the test (here, 5).
- **--query:** The SQL statement to run repeatedly.
- **--create-schema:** The database in which to run the query.

You should see output similar to the following:

```output
Benchmark
Average number of seconds to run all queries: 0.267 seconds
Minimum number of seconds to run all queries: 0.265 seconds
Maximum number of seconds to run all queries: 0.271 seconds
Number of clients running queries: 10
Average number of queries per client: 1
```

Below command runs a **read benchmark** on your MySQL database using `mysqlslap`. It simulates multiple clients querying the table at the same time and records the results.

```console
mysqlslap --user=admin --password="MyStrongPassword!" --host=127.0.0.1 --concurrency=10 --iterations=5 --query="SELECT * FROM benchmark_db.benchmark_table WHERE record_id < 500;" --create-schema=benchmark_db --verbose | tee -a /tmp/mysqlslap_benchmark.log
```

You should see output similar to the following:

```output
Benchmark
Average number of seconds to run all queries: 0.263 seconds
Minimum number of seconds to run all queries: 0.261 seconds
Maximum number of seconds to run all queries: 0.264 seconds
Number of clients running queries: 10
Average number of queries per client: 1
```

## Benchmark Results Table Explained:

- **Average number of seconds to run all queries:** This is the average time it took for all the queries in one iteration to complete across all clients. It gives you a quick sense of overall performance.
- **Minimum number of seconds to run all queries:** This is the fastest time any iteration of queries took.
- **Maximum number of seconds to run all queries:** This is the slowest time any iteration of queries took. The closer this is to the average, the more consistent your performance is.
- **Number of clients running queries:** Indicates how many simulated users (or connections) ran queries simultaneously during the test.
- **Average number of queries per client:** Shows the average number of queries each client executed in the benchmark iteration.

## Benchmark summary on Arm64:
Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pro 24.04 LTS virtual machine**.

| Query Type | Average Time (s) | Minimum Time (s) | Maximum Time (s) | Clients | Avg Queries per Client |
|------------|-----------------|-----------------|-----------------|--------|----------------------|
| INSERT | 0.267 | 0.265 | 0.271 | 10 | 1 |
| SELECT | 0.263 | 0.261 | 0.264 | 10 | 1 |

## Benchmark summary on x86_64:
Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu Pro 24.04 LTS virtual machine**.

| Query Type | Average Time (s) | Minimum Time (s) | Maximum Time (s) | Clients | Avg Queries per Client |
|------------|-----------------|-----------------|-----------------|--------|----------------------|
| INSERT | 0.243 | 0.231 | 0.273 | 10 | 1 |
| SELECT | 0.222 | 0.214 | 0.233 | 10 | 1 |

## Insights from Benchmark Results

The benchmark results on the Arm64 virtual machine show:

- **Balanced Performance for Read and Write Queries:** Both `INSERT` and `SELECT` queries performed consistently, with average times of **0.267s** and **0.263s**, respectively.
- **Low Variability Across Iterations:** The difference between the minimum and maximum times was very small for both query types, indicating stable and predictable behavior under load.
- **Moderate Workload Handling:** With **10 clients** and an average of **1 query per client**, the system handled concurrent operations efficiently without significant delays.
- **Key Takeaway:** The MySQL setup on Arm64 provides reliable and steady performance for both data insertion and retrieval tasks, making it a solid choice for applications requiring dependable database operations.

You have now benchmarked MySql on an Azure Cobalt 100 Arm64 virtual machine and compared results with x86_64.
Loading