In a previous post, I went through the steps involved to install SystemTap on a Linux box. Now, I'd like to show how to configure drizzle and MySQL for use with SystemTap.
First, of all, you need to make sure the dtrace python script that is used by SystemTap is in your path. If it is not, then if you are on Ubuntu you need to install the systemtap-sdt-dev package as mentioned in my last post. Assuming our system is setup correctly, we can build drizzle as follows:
$ bzr branch lp:drizzle stap
$ cd stap
$ ./config/autorun.sh
$ ./configure --enable-dtrace
$ make
The drizzle binary will now have support for static stap probes. In order to verify this and see what probes are present in drizzle, lets start a drizzle server and list the probes in the server process:
$ cd tests
$ ./dtr --start-and-exit
$ sudo stap -l 'process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("*")'
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__rdlock__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__wrlock__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__unlock__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__rdlock__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__wrlock__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("cursor__unlock__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__row__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__row__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("update__row__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("update__row__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("delete__row__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("delete__row__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("connection__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("filesort__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("filesort__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__opt__choose__plan__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__opt__choose__plan__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("connection__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("delete__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__select__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("command__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("command__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__exec__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__exec__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__parse__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("query__parse__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("select__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("select__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("update__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("update__done")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("delete__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__start")
process("/home/posulliv/repos/drizzle/uc/drizzled/drizzled").mark("insert__select__start")
$
The argument to your process function should be the path to your drizzle binary. The process for MySQL is very similar. I'm going to just list the build commands and show the probes that are present in MySQL:
$ bzr branch lp:mysql-server mysql-stap
$ cd mysql-stap
$ ./BUILD/autogen.sh
$ ./configure --enable-dtrace
$ make
$ cd mysql-test
$ ./mtr --start &
$ sudo stap -l 'process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("*")'
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("net__write__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("net__write__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("net__read__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("net__read__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("connection__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("connection__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__parse__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__parse__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("update__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("update__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("multi__update__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("multi__update__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__select__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__select__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("delete__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("delete__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("multi__delete__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("multi__delete__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__exec__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__exec__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("command__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("command__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("select__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("select__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("filesort__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("filesort__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__rdlock__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__wrlock__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__unlock__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__rdlock__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__wrlock__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("handler__unlock__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("delete__row__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("delete__row__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__row__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("insert__row__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("update__row__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("update__row__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__cache__hit")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("query__cache__miss")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("read__row__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("read__row__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("index__read__row__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("index__read__row__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__read__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__read__block")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__read__hit")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__read__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__read__miss")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__write__done")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__write__start")
process("/home/posulliv/repos/mysql/uc/sql/mysqld").mark("keycache__write__block")
$
You can see that there are probes in MySQL which would not make sense for Drizzle such as probes related to the query cache and keycache. In Drizzle, we are also starting to add probes around the optimizer but it is slow going. That's it for now. I'll probably write a brief post next week demonstrating using these probes in MySQL and Drizzle. I'll be covering more in my presentation at the MySQL user's conference in a few weeks.

blog comments powered by Disqus

Published

02 April 2010

Category

drizzle