Skip to content

Commit 185bcc8

Browse files
committed
Deploy MySQL on the Microsoft Azure Cobalt 100 processors
Signed-off-by: odidev <[email protected]>
1 parent 30869fb commit 185bcc8

File tree

12 files changed

+562
-0
lines changed

12 files changed

+562
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Deploy MySQL on Microsoft Azure Cobalt 100 processors
3+
4+
minutes_to_complete: 40
5+
6+
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.
7+
8+
learning_objectives:
9+
- Provision an Azure Arm64 virtual machine using Azure console, with Ubuntu Pro 24.04 LTS as the base image.
10+
- Deploy MySQL on the Ubuntu virtual machine.
11+
- Perform MySQL baseline testing and benchmarking on both x86_64 and Arm64 virtual machines.
12+
13+
prerequisites:
14+
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
15+
- Familiarity with relational databases and the basics of [MySQL](https://dev.mysql.com/doc/refman/8.0/en/introduction.html)
16+
17+
author: Pareena Verma
18+
19+
### Tags
20+
skilllevels: Advanced
21+
subjects: Databases
22+
cloud_service_providers: Microsoft Azure
23+
24+
armips:
25+
- Neoverse
26+
27+
tools_software_languages:
28+
- MySQL
29+
- SQL
30+
- Docker
31+
32+
operatingsystems:
33+
- Linux
34+
35+
further_reading:
36+
- resource:
37+
title: Azure Virtual Machines documentation
38+
link: https://learn.microsoft.com/en-us/azure/virtual-machines/
39+
type: documentation
40+
- resource:
41+
title: Azure Container Instances documentation
42+
link: https://learn.microsoft.com/en-us/azure/container-instances/
43+
type: documentation
44+
- resource:
45+
title: MySQL Manual
46+
link: https://dev.mysql.com/doc/refman/8.0/en/installing.html
47+
type: documentation
48+
- resource:
49+
title: mysqlslap official website
50+
link: https://dev.mysql.com/doc/refman/8.4/en/mysqlslap.html
51+
type: website
52+
53+
### FIXED, DO NOT MODIFY
54+
# ================================================================================
55+
weight: 1 # _index.md always has weight of 1 to order correctly
56+
layout: "learningpathall" # All files under learning paths have this same wrapper
57+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
58+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Overview"
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: "learningpathall"
7+
---
8+
9+
## Cobalt 100 Arm-based processor
10+
11+
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.
12+
13+
Typical workloads include web and application servers, data analytics, open-source databases, and caching systems.
14+
15+
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).
16+
17+
## MySQL
18+
19+
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.
20+
21+
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.
22+
23+
Learn more at the [MySQL official website](https://www.mysql.com/) and in the [official documentation](https://dev.mysql.com/doc/)
24+
.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
title: Validate MySQL
3+
weight: 6
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Run a functional test of MySQL on Azure Cobalt 100
10+
11+
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.
12+
13+
### Start MySQL
14+
15+
Make sure MySQL is running:
16+
17+
```console
18+
sudo systemctl start mysql
19+
sudo systemctl enable mysql
20+
```
21+
### Connect to MySQL
22+
23+
```console
24+
mysql -u admin -p
25+
```
26+
Opens the MySQL client and connects as the new user(admin), prompting you to enter the admin password.
27+
28+
### Show and use Database
29+
30+
```sql
31+
CREATE DATABASE baseline_test;
32+
SHOW DATABASES;
33+
USE baseline_test;
34+
SELECT DATABASE();
35+
```
36+
37+
- `CREATE DATABASE baseline_test;` - Creates a new database named baseline_test.
38+
- `SHOW DATABASES;` - Lists all available databases.
39+
- `USE baseline_test;` - Switches to the new database.
40+
- `SELECT DATABASE();` - Confirms the current database in use.
41+
42+
You should see output similar to:
43+
44+
```output
45+
mysql> CREATE DATABASE baseline_test;
46+
Query OK, 1 row affected (0.01 sec)
47+
48+
mysql> SHOW DATABASES;
49+
+--------------------+
50+
| Database |
51+
+--------------------+
52+
| baseline_test |
53+
| benchmark_db |
54+
| information_schema |
55+
| mydb |
56+
| mysql |
57+
| performance_schema |
58+
| sys |
59+
+--------------------+
60+
7 rows in set (0.00 sec)
61+
62+
mysql> USE baseline_test;
63+
Database changed
64+
mysql> SELECT DATABASE();
65+
+---------------+
66+
| DATABASE() |
67+
+---------------+
68+
| baseline_test |
69+
+---------------+
70+
1 row in set (0.00 sec)
71+
```
72+
You created a new database named **baseline_test**, verified its presence with `SHOW DATABASES`, and confirmed it is the active database using `SELECT DATABASE()`.
73+
74+
### Create and show Table
75+
76+
```sql
77+
CREATE TABLE test_table (
78+
id INT AUTO_INCREMENT PRIMARY KEY,
79+
name VARCHAR(50),
80+
value INT
81+
);
82+
```
83+
84+
- `CREATE TABLE` - Defines a new table named test_table.
85+
- `id` - Primary key with auto-increment.
86+
- `name` - String field up to 50 characters.
87+
- `value` - Integer field.
88+
- `SHOW TABLES;` - Lists all tables in the current database.
89+
90+
You should see output similar to:
91+
92+
```output
93+
Query OK, 0 rows affected (0.05 sec)
94+
95+
mysql> SHOW TABLES;
96+
+-------------------------+
97+
| Tables_in_baseline_test |
98+
+-------------------------+
99+
| test_table |
100+
+-------------------------+
101+
1 row in set (0.00 sec)
102+
```
103+
You successfully created the table **test_table** in the `baseline_test` database and verified its existence using `SHOW TABLES`.
104+
105+
### Insert Sample Data
106+
107+
```sql
108+
INSERT INTO test_table (name, value)
109+
VALUES
110+
('Alice', 100),
111+
('Bob', 200),
112+
('Charlie', 300);
113+
```
114+
- `INSERT INTO test_table (name, value)` - Specifies which table and columns to insert into.
115+
- `VALUES` - Provides three rows of data.
116+
117+
After inserting, you can check the data with:
118+
119+
```sql
120+
SELECT * FROM test_table;
121+
```
122+
- `SELECT *` - Retrieves all columns.
123+
- `FROM test_table` - Selects from the test_table.
124+
125+
You should see output similar to:
126+
127+
```output
128+
mysql> SELECT * FROM test_table;
129+
+----+---------+-------+
130+
| id | name | value |
131+
+----+---------+-------+
132+
| 1 | Alice | 100 |
133+
| 2 | Bob | 200 |
134+
| 3 | Charlie | 300 |
135+
+----+---------+-------+
136+
3 rows in set (0.00 sec)
137+
```
138+
139+
The functional test was successful — the **test_table** contains three rows (**Alice, Bob, and Charlie**) with their respective values, confirming MySQL is working
140+
correctly.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: Benchmark MySQL with mysqlslap
3+
weight: 7
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Benchmark MySQL on Azure Cobalt 100 Arm-based instances and x86_64 instances
10+
11+
`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.
12+
13+
## Steps for MySQL Benchmarking with mysqlslap
14+
15+
1. Connect to MySQL and Create a Database
16+
17+
To access the MySQL server, use the following command based on your `admin` user password:
18+
19+
```console
20+
mysql -u admin -p
21+
```
22+
Once logged in, you can create a benchmark_db using SQL commands like:
23+
24+
```sql
25+
CREATE DATABASE benchmark_db;
26+
USE benchmark_db;
27+
```
28+
29+
3. Create a Table and Populate Data
30+
31+
After logging into MySQL, you can create a table to store benchmark data. Here’s a simple example:
32+
33+
```sql
34+
CREATE TABLE benchmark_table (
35+
record_id INT AUTO_INCREMENT PRIMARY KEY,
36+
username VARCHAR(50),
37+
score INT
38+
);
39+
```
40+
Insert some sample rows manually:
41+
42+
```sql
43+
INSERT INTO benchmark_table (username,score) VALUES
44+
('John',100),('Jane',200),('Mike',300);
45+
```
46+
47+
Or populate automatically with 1000 rows:
48+
49+
```sql
50+
DELIMITER //
51+
CREATE PROCEDURE populate_benchmark_data()
52+
BEGIN
53+
DECLARE i INT DEFAULT 1;
54+
WHILE i <= 1000 DO
55+
INSERT INTO benchmark_table (username, score)
56+
VALUES (CONCAT('Player', i), i*10);
57+
SET i = i + 1;
58+
END WHILE;
59+
END //
60+
DELIMITER ;
61+
62+
CALL populate_benchmark_data();
63+
DROP PROCEDURE populate_benchmark_data;
64+
```
65+
- The table `benchmark_table` has three columns: `record_id` (primary key), `username`, and `score`.
66+
- You can insert a few rows manually for testing or use a procedure to generate **1000 rows automatically** for more realistic benchmarking
67+
68+
## Run a Simple Read/Write Benchmark
69+
70+
Once your table is ready, you can use `mysqlslap` to simulate multiple clients performing queries. This helps test MySQL’s performance under load.
71+
72+
```console
73+
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
74+
```
75+
- **--user / --password:** MySQL login credentials.
76+
- **--host:** MySQL server address (127.0.0.1 for local).
77+
- **--concurrency:** Number of simultaneous clients (here, 10).
78+
- **--iterations:** How many times to repeat the test (here, 5).
79+
- **--query:** The SQL statement to run repeatedly.
80+
- **--create-schema:** The database in which to run the query.
81+
82+
You should see output similar to the following:
83+
84+
```output
85+
Benchmark
86+
Average number of seconds to run all queries: 0.267 seconds
87+
Minimum number of seconds to run all queries: 0.265 seconds
88+
Maximum number of seconds to run all queries: 0.271 seconds
89+
Number of clients running queries: 10
90+
Average number of queries per client: 1
91+
```
92+
93+
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.
94+
95+
```console
96+
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
97+
```
98+
99+
You should see output similar to the following:
100+
101+
```output
102+
Benchmark
103+
Average number of seconds to run all queries: 0.263 seconds
104+
Minimum number of seconds to run all queries: 0.261 seconds
105+
Maximum number of seconds to run all queries: 0.264 seconds
106+
Number of clients running queries: 10
107+
Average number of queries per client: 1
108+
```
109+
110+
## Benchmark Results Table Explained:
111+
112+
- **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.
113+
- **Minimum number of seconds to run all queries:** This is the fastest time any iteration of queries took.
114+
- **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.
115+
- **Number of clients running queries:** Indicates how many simulated users (or connections) ran queries simultaneously during the test.
116+
- **Average number of queries per client:** Shows the average number of queries each client executed in the benchmark iteration.
117+
118+
## Benchmark summary on Arm64:
119+
Here is a summary of benchmark results collected on an Arm64 **D4ps_v6 Ubuntu Pro 24.04 LTS virtual machine**.
120+
121+
| Query Type | Average Time (s) | Minimum Time (s) | Maximum Time (s) | Clients | Avg Queries per Client |
122+
|------------|-----------------|-----------------|-----------------|--------|----------------------|
123+
| INSERT | 0.267 | 0.265 | 0.271 | 10 | 1 |
124+
| SELECT | 0.263 | 0.261 | 0.264 | 10 | 1 |
125+
126+
## Benchmark summary on x86_64:
127+
Here is a summary of the benchmark results collected on x86_64 **D4s_v6 Ubuntu Pro 24.04 LTS virtual machine**.
128+
129+
| Query Type | Average Time (s) | Minimum Time (s) | Maximum Time (s) | Clients | Avg Queries per Client |
130+
|------------|-----------------|-----------------|-----------------|--------|----------------------|
131+
| INSERT | 0.243 | 0.231 | 0.273 | 10 | 1 |
132+
| SELECT | 0.222 | 0.214 | 0.233 | 10 | 1 |
133+
134+
## Insights from Benchmark Results
135+
136+
The benchmark results on the Arm64 virtual machine show:
137+
138+
- **Balanced Performance for Read and Write Queries:** Both `INSERT` and `SELECT` queries performed consistently, with average times of **0.267s** and **0.263s**, respectively.
139+
- **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.
140+
- **Moderate Workload Handling:** With **10 clients** and an average of **1 query per client**, the system handled concurrent operations efficiently without significant delays.
141+
- **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.
142+
143+
You have now benchmarked MySql on an Azure Cobalt 100 Arm64 virtual machine and compared results with x86_64.

0 commit comments

Comments
 (0)