Tracing MariaDB Server with bpftrace
summary
bpftrace runs on Linux kernel 5.x.y, needs root, and often requires building from source; maps default to 4KB and probe count is capped by an env var (hit limits when probing ~34–35k functions). It captures SQL from dispatch_command arg2 and can record timings by storing start timestamps per thread; sampling at high rate (example: sampling at 99Hz produces ustack traces) yields flame-graphable stacks. Practical notes: ~1k selective probes work, tracing pthread mutexes halved QPS in one test, while aggregated kernel-side counting usually keeps overhead below 1% versus perf ~2%.
AI-written summary · about
chapters (10)
- 0:00Introduction and speaker background
- 14:03Why bpftrace for MariaDB
- 23:10bpftrace basics and language
- 33:23bpftrace variables and maps
- 43:01Tracing MariaDB queries
- 51:16Code coverage with bpftrace
- 54:19Sampling stack traces
- 58:40Tracing mutex locks and performance impact
- 1:01:59Memory allocation tracing
- 1:04:19bpftrace limitations and future
