Databases 7 min read

Why CentOS 7 Boosts MySQL Performance: Real‑World Sysbench Test Results

An in‑depth performance benchmark compares MySQL on CentOS 6 and CentOS 7 using sysbench with 10 tables of 5 million rows, revealing up to 40% higher QPS on CentOS 7, detailing test setup, results, and key configuration tweaks that dramatically improve throughput.

Programmer DD
Programmer DD
Programmer DD
Why CentOS 7 Boosts MySQL Performance: Real‑World Sysbench Test Results

1 Introduction

Plan to upgrade the database server OS from CentOS 6 to CentOS 7; before upgrading, a performance benchmark is performed. This article shares the benchmark records and results.

2 Benchmark Preparation

2.1 Benchmark Method

Use sysbench‑0.5 to create 10 tables, each with 5 million rows, with concurrency levels 12, 24, 36, 48, 60, 72, each running for 4 hours, totaling 24 hours. The benchmark command is:

/opt/yz-sysbench/bin/sysbench --test=/opt/yz-sysbench/share/sysbench/oltp.lua --oltp-tables-count=10 --oltp-table-size=5000000 --mysql-db=sysbench --mysql-user=sysbench --mysql-password=sysbench --mysql-socket=/srv/my3306/run/mysql.sock --max-time=14400 --max-requests=0 --num-threads=12 --oltp-test-mode=complex run

Note: sysbench is installed locally, so network latency is negligible.

2.2 Target Metrics

Monitor database QPS, TPS, host I/O, CPU, and other performance indicators.

3 Benchmark Data

3.1 QPS

3.2 Insert/Delete

In sysbench OLTP mode, insert and delete ratios are equal, so TPS data is combined.

3.3 Update Performance

3.4 CPU & I/O Comparison

CentOS 7 shows slightly lower CPU load and higher I/O utilization than CentOS 6.

3.5 Flash‑sale Scenario

Refer to the article “Hot‑product Update Optimization Plan” for background.

MySQL uses two parameters to control data flushing. The current setting forces a disk write on every transaction commit, ensuring data safety but causing heavy I/O.

Concurrent updates on the same row can cause lock contention and dead‑lock detection, leading to O(n) complexity for dead‑lock checks, which becomes costly at high concurrency.

Core Optimization Parameters

sync_binlog=0                    -- let the OS flush binlog
innodb_flush_log_at_trx_commit=0 -- flush redo log to disk each second
innodb_deadlock_detect=OFF       -- disable deadlock detection
innodb_lock_wait_timeout=2

Benchmark Scenario

CREATE TABLE `seckill` (
  `id` int(11) DEFAULT NULL,
  `num` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO seckill (id, num) VALUES (1, 200000000000000);

mysqlslap -uroot -h127.0.0.1 -P3316 --concurrency=72 --create-schema='test' --query='begin;update seckill set num=num-1 where id =1 and num>1;commit;' --number-of-queries=500000

The test simulates high‑concurrency database load with active sessions of 72, 96, 144, 192, and 256.

In the flash‑sale scenario, CentOS 7 delivers more than three times the performance of CentOS 6 under the same conditions; after tuning, CentOS 7 can handle over 10 k concurrent updates.

3.4 Analysis

QPS on CentOS 7 improves by 20%–40%, and TPS also gains over 20% compared with CentOS 6. Real‑world workloads with complex SQL may see smaller gains.

4 Conclusion

Performance testing of the new system is insightful; CentOS 7 offers several MySQL optimizations. Future posts will explore these in more depth.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

sqlPerformance TestingmysqlDatabase OptimizationCentOSSysbench
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.