dbslower(8) | System Manager's Manual | dbslower(8) |
dbslower - Trace MySQL/PostgreSQL server queries slower than a threshold.
dbslower [-v] [-p PID [PID ...]] [-x PATH] [-m THRESHOLD] {mysql,postgres}
This traces queries served by a MySQL or PostgreSQL server, and prints those that exceed a latency (query time) threshold. By default a threshold of 1 ms is used.
This uses User Statically-Defined Tracing (USDT) probes, a feature added to MySQL and PostgreSQL for DTrace support, but which may not be enabled on a given installation. See requirements. Alternativly, MySQL queries can be traced without the USDT support using the -x option.
Since this uses BPF, only the root user can use this tool.
CONFIG_BPF, bcc, and MySQL server with USDT probe support (when configuring the build: -DENABLE_DTRACE=1) or PostgreSQL server with USDT probe support (when configuring the build: --enable-dtrace).
-h Print usage message.
This adds low-overhead instrumentation to queries, and only emits output data from kernel to user-level if they query exceeds the threshold. If the server query rate is less than 1,000/sec, the overhead is expected to be negligible. If the query rate is higher, test to gauge overhead.
This is from bcc.
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.
Linux
Unstable - in development.
Sasha Goldshtein, Brendan Gregg
2017-02-15 | USER COMMANDS |