Tracing queries within DB transactions with dbslower


Kevin Maier
 

Hello,
as part of a university project I am analysing the dbslower tool to evaluate the performance cost of tracing the queries and to test what can be traced with it. As MySQL dropped support for Dtrace for v8.0+ I am using the alternative with uprobes. During my own testing with MySQL v8.0.28 I found out that regular queries get traced without issues, but if they are within a transaction only the queries b'START TRANSACTION' and b'COMMIT' are detected and none of the queries within the transaction get traced. Is there a way to adapt the tracing to include the queries within a transaction aswell, e.g. by adapting the mysql_func_name?

Best regards,
Kevin Maier


Dave M
 

Hi Kevin,

I see you've made a Github issue as well
(https://github.com/iovisor/bcc/issues/4256). That's good, as I
would've recommended making one since the mailing list isn't
frequently used these days. I will respond in the issue as well and we
can continue conversation wherever you'd prefer.

The folks who did most of the implementation of `dbslower`
(https://github.com/iovisor/bcc/pulls?q=is%3Apr+dbslower+is%3Aclosed)
aren't particularly active in this repo these days. They might have
the mysql expertise necessary to answer your question. Unfortunately
I'm not sure if any of the current maintainers have experience tracing
MySQL - myself included. Regardless, if you're willing to dig around
in the MySQL source I do think your suggested approach of modifying
which functions are uprobe'd is likely to work. If current tracing of
'dispatch_command' isn't catching the actual statements in the
transaction, presumably there's some other function that is processing
the text of those statements that should be fine to trace in lieu of /
in addition to what's currently being traced.

If you do get this working we'd certainly appreciate a PR!

-Dave

On Tue, Oct 4, 2022 at 3:56 AM Kevin Maier <kevin.maier@...> wrote:

Hello,
as part of a university project I am analysing the dbslower tool to evaluate the performance cost of tracing the queries and to test what can be traced with it. As MySQL dropped support for Dtrace for v8.0+ I am using the alternative with uprobes. During my own testing with MySQL v8.0.28 I found out that regular queries get traced without issues, but if they are within a transaction only the queries b'START TRANSACTION' and b'COMMIT' are detected and none of the queries within the transaction get traced. Is there a way to adapt the tracing to include the queries within a transaction aswell, e.g. by adapting the mysql_func_name?

Best regards,
Kevin Maier