docker-library / docker-library/mysql
MySQL 5.7.41 vs. 8.0.33 Performance Issue on amd64 Image
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 2.6k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
Issue Summary
When running a Sysbench test, it looks like the performance of MySQL 8.0.33 (amd64) is slower compared to MySQL 5.7.41 (amd64) when running in Mac (arm64) or in AWS EC2 Instance (amd64). I would have expected that 8.0.33 to be faster given that it is a newer version.
Environment
| Environment 1 | Environment 2 | |
|---|---|---|
| Hardware | Mac Pro (M1 Max / 64 GB) | AWS EC2 (t2.2xlarge: 8 CPU / 32 GB) |
| OS | MacOS Monterey (12.6.5) | Ubuntu 22.04 (amd64) |
| Docker | 20.10.24, build 297e128 (installed | 24.0.1, build 6802122 |
| Sysbench | 1.0.20 (installed via brew) | 1.0.20 |
| MySQL client | 8.0.32 (installed via brew) | 8.0.33-0ubuntu0.22.04.2 |
Steps to Reproduce (applicable for both environments)
Setup of the 2 MySQL versions
$ docker run --platform=linux/amd64 --name=mysql1 -p 3309:3306/tcp -e MYSQL_ROOT_PASSWORD="test" -d mysql:5.7.41
$ docker run --platform=linux/amd64 --name=mysql2 -p 3310:3306/tcp -e MYSQL_ROOT_PASSWORD="test" -d mysql:8.0.33
$ mysql -h 127.0.0.1 -u root -ptest -P3309 -e 'create database sb1'
$ mysql -h 127.0.0.1 -u root -ptest -P3310 -e 'create database sb1'
$ sysbench oltp_read_write --table-size=100000 --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=test --mysql-port=3309 --mysql-db=sb1 prepare
$ sysbench oltp_read_write --table-size=100000 --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=test --mysql-port=3310 --mysql-db=sb1 prepare
Run the tests
$ sysbench oltp_read_write --table-size=100000 --threads=4 --max-requests=0 --time=30 --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=test --mysql-port=3309 --mysql-db=sb1 run
$ sysbench oltp_read_write --table-size=100000 --threads=4 --max-requests=0 --time=30 --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=test --mysql-port=3310 --mysql-db=sb1 run
Sysbench Results on Mac Pro
For 5.7.41 on Mac Pro:
SQL statistics:
queries performed:
read: 85120
write: 24320
other: 12160
total: 121600
transactions: 6080 (202.58 per sec.)
queries: 121600 (4051.55 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0129s
total number of events: 6080
Latency (ms):
min: 14.70
avg: 19.74
max: 129.73
95th percentile: 0.00
sum: 120028.52
Threads fairness:
events (avg/stddev): 1520.0000/1.58
execution time (avg/stddev): 30.0071/0.00
For 8.0.33 on Mac Pro:
SQL statistics:
queries performed:
read: 64848
write: 18528
other: 9264
total: 92640
transactions: 4632 (154.31 per sec.)
queries: 92640 (3086.13 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0179s
total number of events: 4632
Latency (ms):
min: 19.10
avg: 25.92
max: 149.70
95th percentile: 0.00
sum: 120045.87
Threads fairness:
events (avg/stddev): 1158.0000/1.00
execution time (avg/stddev): 30.0115/0.00
Sysbench Results on AWS EC2
For 5.7.41 on AWS EC2:
SQL statistics:
queries performed:
read: 149100
write: 42600
other: 21300
total: 213000
transactions: 10650 (354.86 per sec.)
queries: 213000 (7097.24 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0098s
total number of events: 10650
Latency (ms):
min: 5.21
avg: 11.27
max: 160.54
95th percentile: 16.71
sum: 119983.74
Threads fairness:
events (avg/stddev): 2662.5000/8.79
execution time (avg/stddev): 29.9959/0.00
For 8.0.33 on AWS EC2:
SQL statistics:
queries performed:
read: 75082
write: 21452
other: 10726
total: 107260
transactions: 5363 (178.66 per sec.)
queries: 107260 (3573.29 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0150s
total number of events: 5363
Latency (ms):
min: 9.19
avg: 22.38
max: 126.07
95th percentile: 49.21
sum: 120010.00
Threads fairness:
events (avg/stddev): 1340.7500/4.21
execution time (avg/stddev): 30.0025/0.00
Summary of the Results
| 5.7.41 (Mac Pro) | 8.0.33 (Mac Pro) | 5.7.41 (AWS EC2) | 8.0.33 (AWS EC2) | |
|---|---|---|---|---|
| transactions/sec | 202.58/sec | 154.31/sec | 354.86/sec | 178.66/sec |
| queries/sec | 4051.55/sec | 3086.13/sec | 7097.24/sec | 3573.29/sec |
Expected Behavior
Based on the results, I expected that MySQL 8.0.33 should be faster given that it is a newer version, but it looks like MySQL 5.7.41 is faster. Is this a known issue?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two docker run commands and the Sysbench workload against mysql:5.7.41 and mysql:8.0.33 on the reported platforms. Compare the container configuration and benchmark conditions before investigating the version difference. Done means identifying a reproducible cause and documenting either an actionable packaging change or why the performance difference is expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, mysql, shell
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100