Databases 3 min read

How to Simulate Slow Disk I/O for MySQL Experiments

This guide explains how to create a delayed‑disk device on Linux, place MySQL binlog files on it, and use tools like mysqlslap and pt‑ioprofile to observe the impact of artificially slow I/O on MySQL performance.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
How to Simulate Slow Disk I/O for MySQL Experiments

The article addresses the problem of reproducing slow disk I/O conditions to study MySQL behavior when its binlog resides on a sluggish storage device.

Step 1 – Create a delayed disk: Use dd if=/dev/zero of=slow.img bs=1M count=100 to generate a 100 MiB file, attach it as a loop device with losetup /dev/loop3 slow.img, and then map the loop device to a dm‑target that adds a 100 ms latency to both read and write operations.

Step 2 – Prepare MySQL on the slow device: Format the delayed device, mount it, and install MySQL via dbdeployer. Configure the binary log directory to point to the mounted slow device (e.g., /mnt/slow) and enable double‑write flush parameters.

Run a workload with mysqlslap to generate I/O pressure. Monitoring with iostat shows that the dm‑0 device (the delayed mapper) experiences queueing and high utilization, while the underlying /dev/loop3 remains under‑utilized, confirming the introduced latency.

Further profiling with pt‑ioprofile reveals that the majority of MySQL’s I/O time is spent on binlog operations, highlighting the impact of the artificial slowdown.

Result: By creating a slow I/O device and placing MySQL’s binlog on it, the experiment provides a reproducible environment for analyzing MySQL’s behavior under local file I/O bottlenecks, enabling deeper performance investigations.

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.

Performance TestingLinuxmysqlDisk I/ODatabase BenchmarkSlow I/O Simulation
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

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.