Top 10 MySQL Performance Analysis Tools

Preface

The most common bottlenecks in MySQL databases typically involve CPU and I/O performance. CPU saturation often occurs when loading data into memory or reading from the disk, whereas disk I/O bottlenecks arise when the amount of data being loaded exceeds the available memory capacity. When MySQL database performance encounters these bottlenecks, it is essential for every DBA or system administrator to quickly identify the underlying issues. Utilizing MySQL performance analysis tools can greatly facilitate the swift and accurate diagnosis of problems.

Here is a curated collection of indispensable MySQL performance analysis tools that DBAs frequently depend on. Be sure to bookmark this list and share it with others!

1. Pt-query-digest

pt-query-digest is primarily used to analyze MySQL slow logs. Compared to the mysqldumpshow tool, pt-query-digest provides more detailed and comprehensive analysis results. pt-query-digest is a subset of the PT toolkit.

  1. Installation
  1. Usage (1) Directly analyze a slow query file:

(2) Analyze queries from the last 12 hours:

(3) Analyze queries within a specific time range:

(4) Analyze slow queries containing SELECT statements:

(5) Analyze slow queries for a specific user:

(6) Analyze slow queries involving full table scans or full joins:

2. Innotop

Innotop is a MySQL and InnoDB transaction/state monitor that displays queries, InnoDB transactions, lock waits, deadlocks, foreign key errors, open tables, replication status, buffer pool information, row operations, logs, I/O operations, and load graphs. Innotop allows you to monitor multiple servers simultaneously.

  1. Install innotop
  1. Usage (1) Basic usage:

3. Orzdba

Orzdba, an open-source tool from Taobao, allows real-time performance monitoring of databases. With this tool, you can keep track of your database’s performance at all times.

  1. Usage

Explanation of parameters:

  • --host: Specifies the host
  • --user: Specifies the username
  • --password: Database password
  • --port: Database port number
Orzdba-MySQL performance analysis tools

4. Tcpdump

  1. Install tcpdump
  1. Usage (1) Capture packets using tcpdump:

(2) Tcpdump + pt-query-digest:

5. ioprofile

  1. pt-ioprofile pt-ioprofile helps locate the source of the load by identifying processes with high load through ps.
  2. Usage

6. Tcprstat

Tcprstat assesses the database’s health by measuring response times.

  1. Install tcprstat On a 64-bit OS, download the binary file:
  1. Usage

The time for each request is between 0.1ms and 0.124ms.

Explanation of parameters:

  • --p: Database port number
  • -t: Refresh interval time
  • -n: Number of outputs

7. Nicstat

Nicstat is a network monitoring tool that provides detailed information about your network card’s performance.

  1. Install nicstat
  1. Usage

Explanation of parameters:

  • -z: Skip 0 rows

Output parameter explanations:

  • wKB/s, OutKB: Number of kilobytes transmitted per second
  • rMbps, RdMbps: Number of megabytes received per second
  • %Util: Percentage of interface utilization
  • Sat: Number of errors per second, an indicator that the interface is nearing saturation

8. Dstat

  1. Install dstat
  1. Usage

Explanation of parameters:

  • -t:enable time/date output
  • -c:enable cpu stats
  • -l:enable load stats
  • -m:enable memory stats
  • -n:enable network stats
  • -d:enable disk stats
  • -y:enable system stats
Dstat-MySQL performance analysis tools

9. Vmtouch

Vmtouch is a tool for learning and controlling the file system cache on Unix and Unix-like systems.

  1. Quick installation
  1. Usage

Display

10. Oprofile

Oprofile is an open-source profiling tool that samples data to help pinpoint CPU-intensive processes.

  1. Install

Here’s the translation of the provided content:


2. Usage Instructions

(1) Usage

Note: If you see the error “Cannot find event CPUCLKUNHALTED,” follow these steps to resolve it:

Resolution Steps

(2) Obtain Sample Information

(3) Usage Example


Click to rate this post!
[Total: 0 Average: 0]