MySQL User-Space Markers
Newer versions of MySQL include support for SystemTap user-space markers. The MySQL user-space markers are enabled in Fedora 15. The markers allow SystemTap to probe various MySQL events including the start of a query, the completion of a query and lock operations. You can list the available probe points with the following command:
stap -L 'process("/usr/libexec/mysqld").mark("*")' | sort
Using MySQL User-Space Markers
To use the MySQL user-space markers on Fedora you will need:
- RPMs:
- mysql
- mysql-server
- systemtap
- Membership to the stapdev group (or root access)
- A uprobes module built for the currently running kernel
(SystemTap will print instruction on how to build the uprobes module if one is not currently available)
Examples and Demonstrations of Markers
Some short SystemTap example scripts for MySQL:
mysql-locks.stp summarizes the lock contention
mysql-query.stp summarizes the query time for each process
mysql-slowq.stp records querys requiring more than a specified time
There are also a number of MySQL SystemTap probing examples in http://github.com/posulliv/stap