Si vous voulez utiliser les probes DTrace de MySQL grace à SystemTap sur Ubuntu, il faut, d’abord, que les packages « systemtap » et « systemtap-sdt-dev » soient installés. Il faut également que MySQL soit compilé avec le package « systemtap-sdt-dev » et l’option -DENABLE_DTRACE=1
. Il faut enfin que votre noyau soit patché avec utrace (CONFIG_UTRACE) ce qui n’est pas le cas avec les distributions standard Ubuntu ; au contraire des noyaux Oracle/Redhat EL ou Fedora.
Avec Ubuntu 10.10 Maverick Meerkat, rien n’est plus simple ;
grace à Stephan Peijnik, vous pouvez simplement récupérer un noyau incluant déjà utrace depuis le PPA correspondant. Pour se faire, enregistrer le référentiel :
sudo add-apt-repository ppa:speijnik/utrace-kernel
Vérifiez puis installez le-dit noyau:
sudo apt-cache show linux-image-2.6.35-26-generic-pae
Package: linux-image-2.6.35-26-generic-pae
Source: linux
Priority: optional
Section: admin
Installed-Size: 105020
Maintainer: Ubuntu Kernel Team
Architecture: i386
Version: 2.6.35-26.46~utrace0
Recommends: grub-pc | grub | lilo (>= 19.1)
Suggests: fdutils, linux-doc-2.6.35 | linux-source-2.6.35, linux-tools
Provides: fuse-module, ivtv-modules, kvm-api-4, linux-image, linux-image-2.6, ndiswrapper-modules-1.9, redhat-cluster-modules
Depends: initramfs-tools (>= 0.36ubuntu6), coreutils | fileutils (>= 4.0), module-init-tools (>= 3.3-pre11-4ubuntu3), wireless-crda
Conflicts: hotplug (<< 0.0.20040105-1)
Pre-Depends: dpkg (>= 1.10.24)
Filename: pool/main/l/linux/linux-image-2.6.35-26-generic-pae_2.6.35-26.46~utrace0_i386.deb
Size: 34245788
MD5sum: 442d4298aec8fcca7b2020aaa13048a0
SHA1: c8cd6df0f98674238dcfd27848b456c897108cdd
Description: Linux kernel image for version 2.6.35 on x86
This package contains the Linux kernel image for version 2.6.35 on
x86.
.
Also includes the corresponding System.map file, the modules built by the
packager, and scripts that try to ensure that the system is not left in an
unbootable state after an update.
.
Supports Generic processors.
.
Geared toward 32 bit desktop systems with more then 4GB RAM.
.
You likely do not want to install this package directly. Instead, install
the linux-generic-pae meta-package, which will ensure that upgrades work
correctly, and that supporting packages are also installed.
sudo apt-get install linux-headers-2.6.35-26
linux-headers-2.6.35-26-generic-pae
linux-tools-2.6.35-26
Une fois le noyau installé, rebootez sur cette version et lancez MySQL; vous pourrez vérifier simplement que vous pouvez désormais utiliser SystemTap avec MySQL à l’aide de la commande suivante en remplaçant le chemin du binaire mysqld :
sudo stap -l 'process("/opt/mysql55/bin/mysqld").mark("*")'
Le résultat doit ressembler à ce qui suit :
process("/opt/mysql55/bin/mysqld").mark("command__done")
process("/opt/mysql55/bin/mysqld").mark("command__start")
process("/opt/mysql55/bin/mysqld").mark("connection__done")
process("/opt/mysql55/bin/mysqld").mark("connection__start")
process("/opt/mysql55/bin/mysqld").mark("delete__done")
process("/opt/mysql55/bin/mysqld").mark("delete__row__done")
process("/opt/mysql55/bin/mysqld").mark("delete__row__start")
process("/opt/mysql55/bin/mysqld").mark("delete__start")
process("/opt/mysql55/bin/mysqld").mark("filesort__done")
process("/opt/mysql55/bin/mysqld").mark("filesort__start")
process("/opt/mysql55/bin/mysqld").mark("handler__rdlock__done")
process("/opt/mysql55/bin/mysqld").mark("handler__rdlock__start")
process("/opt/mysql55/bin/mysqld").mark("handler__unlock__done")
process("/opt/mysql55/bin/mysqld").mark("handler__unlock__start")
process("/opt/mysql55/bin/mysqld").mark("handler__wrlock__done")
process("/opt/mysql55/bin/mysqld").mark("handler__wrlock__start")
process("/opt/mysql55/bin/mysqld").mark("index__read__row__done")
process("/opt/mysql55/bin/mysqld").mark("index__read__row__start")
process("/opt/mysql55/bin/mysqld").mark("insert__done")
process("/opt/mysql55/bin/mysqld").mark("insert__row__done")
process("/opt/mysql55/bin/mysqld").mark("insert__row__start")
process("/opt/mysql55/bin/mysqld").mark("insert__select__done")
process("/opt/mysql55/bin/mysqld").mark("insert__select__start")
process("/opt/mysql55/bin/mysqld").mark("insert__start")
process("/opt/mysql55/bin/mysqld").mark("keycache__read__block")
process("/opt/mysql55/bin/mysqld").mark("keycache__read__done")
process("/opt/mysql55/bin/mysqld").mark("keycache__read__hit")
process("/opt/mysql55/bin/mysqld").mark("keycache__read__miss")
process("/opt/mysql55/bin/mysqld").mark("keycache__read__start")
process("/opt/mysql55/bin/mysqld").mark("keycache__write__block")
process("/opt/mysql55/bin/mysqld").mark("keycache__write__done")
process("/opt/mysql55/bin/mysqld").mark("keycache__write__start")
process("/opt/mysql55/bin/mysqld").mark("multi__delete__done")
process("/opt/mysql55/bin/mysqld").mark("multi__delete__start")
process("/opt/mysql55/bin/mysqld").mark("multi__update__done")
process("/opt/mysql55/bin/mysqld").mark("multi__update__start")
process("/opt/mysql55/bin/mysqld").mark("net__read__done")
process("/opt/mysql55/bin/mysqld").mark("net__read__start")
process("/opt/mysql55/bin/mysqld").mark("net__write__done")
process("/opt/mysql55/bin/mysqld").mark("net__write__start")
process("/opt/mysql55/bin/mysqld").mark("query__cache__hit")
process("/opt/mysql55/bin/mysqld").mark("query__cache__miss")
process("/opt/mysql55/bin/mysqld").mark("query__done")
process("/opt/mysql55/bin/mysqld").mark("query__exec__done")
process("/opt/mysql55/bin/mysqld").mark("query__exec__start")
process("/opt/mysql55/bin/mysqld").mark("query__parse__done")
process("/opt/mysql55/bin/mysqld").mark("query__parse__start")
process("/opt/mysql55/bin/mysqld").mark("query__start")
process("/opt/mysql55/bin/mysqld").mark("read__row__done")
process("/opt/mysql55/bin/mysqld").mark("read__row__start")
process("/opt/mysql55/bin/mysqld").mark("select__done")
process("/opt/mysql55/bin/mysqld").mark("select__start")
process("/opt/mysql55/bin/mysqld").mark("update__done")
process("/opt/mysql55/bin/mysqld").mark("update__row__done")
process("/opt/mysql55/bin/mysqld").mark("update__row__start")
process("/opt/mysql55/bin/mysqld").mark("update__start")
Et voilà :
Pour un détail des probes disponibles, reportez-vous à la documentation MySQL. Pour des exemples de scripts d’utilisation de SystemMap avec MySQL, reportez-vous à la présentation et la video de Padraig O’Sullivan.
Certe Linux, dans ce domaine, n’est pas Solaris ou FreeBSD mais ça se tient ; et pour un peu que vous utilisiez une des version Oracle ou Redhat EL, le noyau inclut déjà utrace ; quoiqu’avec UEK ?
1 réflexion sur “Noyau Ubuntu/Utrace pour probes Dtrace de MySQL”
Excellent ces articles sur mysql.
Les commentaires sont fermés.