Slide 1

Slide 1 text

A Support Engineer Walkthrough on pt-stalk Marcos Albe Principal Support Engineer - Percona Marcelo Altmann Senior Support Engineer - Percona

Slide 2

Slide 2 text

2 Thank You Sponsors!

Slide 3

Slide 3 text

3 SAVE THE DATE! CALL FOR PAPERS OPENING SOON! www.perconalive.com April 23-25, 2018 Santa Clara Convention Center

Slide 4

Slide 4 text

Who is speaking ?

Slide 5

Slide 5 text

5 Who is Speaking ? • Marcelo Altmann - Senior Support Engineer @ Percona - Resident specialist on Surf & Brazil leisure •Marcos Albé - Principal Support Engineer @ Percona - Chief Barbeque Officer & Designated Beer Analyst

Slide 6

Slide 6 text

Agenda

Slide 7

Slide 7 text

7 Agenda • What do we USE • Who’s stalkin’? • How pt-stalk can be USEd • Walkthrough

Slide 8

Slide 8 text

What do we USE

Slide 9

Slide 9 text

9 We use one of these...

Slide 10

Slide 10 text

10 Utilization

Slide 11

Slide 11 text

11 Utilization Saturation

Slide 12

Slide 12 text

12 Utilization Saturation Errors

Slide 13

Slide 13 text

13

Slide 14

Slide 14 text

Who’s stalkin’?

Slide 15

Slide 15 text

15 check out those resources!

Slide 16

Slide 16 text

16 Who’s stalkin’? •Aspersa stalk + Aspersa collect in one! (thanks Daniel & Baron) •# The name 'stalk' is because 'watch' is already taken, and 'stalk' is fun. •Now part of pt-toolkit •Monitors variable or a script’s single-valued output •Triggers capture when set threshold is reached - files from /proc: diskstats, interrupts, meminfo, slabinfo, procstat, procvmstat. - vmstat, iostat, top, netstat, pmap, mpstat, sysctl, df, hostname, mysqladmin ext, mysqladmin debug, lsof). - SHOW ENGINE INNODB STATUS, SHOW ENGINE INNODB MUTEX, SHOW GLOBAL VARIABLES, SHOW FULL PROCESSLIST and SHOW OPEN TABLES. •Production safe! •Custom triggers and custom captures •Companion tools (pt-sift, pt-mext, pt-diskstats, pt-summary); Bash dissection

Slide 17

Slide 17 text

17 Who’s stalkin’: common parameters •Stalking part - --daemonize | --no-stalk - --function=status - --interval=1 - --variable=Threads_running - --threshold=25 - --cycles=5 •Collecting part - --run-time=30 - --sleep=300 - --iterations= - --plugin= - --dest=/var/lib/pt-stalk • Values shown are the defaults for each (where given)

Slide 18

Slide 18 text

18 Who’s stalkin’: work flow

Slide 19

Slide 19 text

19 Who’s stalkin’: working examples I Collect data during 60 seconds for 3 consecutive times, starting immediately. pt-stalk --no-stalk \ --dest=$HOME/percona \ --user=root \ --ask-pass \ --run-time=60 --sleep=60 --iterations=3

Slide 20

Slide 20 text

20 Who’s stalkin’: working examples II Run as a daemon and trigger collection if InnoDB has more than 5 pending fsyncs. pt-stalk --daemonize \ --function=status \ --variable=Innodb_data_pending_fsyncs \ --threshold=5 \ --cycles=2 \ --interval=1 \ --iterations=5 \ --plugin=/usr/local/bin/raid_card_status.sh

Slide 21

Slide 21 text

21 Who’s stalkin’: custom triggers #!/bin/bash # Save this bash snippet as /root/delayed_slave_trg.sh; trg_plugin() { mysql $EXT_ARGV -Ee "SHOW SLAVE STATUS" | \ grep "Seconds_Behind_Master" | \ awk "{ print $2 }"; } # use like pt-stalk --function=/root/delayed_slave_trg.sh --etc --etc

Slide 22

Slide 22 text

22 Who’s stalkin’: custom capture #!/bin/bash # save as /root/collect_perf.sh before_collect() { # run perf stat; match sleep length to --run-time /usr/bin/perf stat --all-cpus \ --output=${d}/${p}-stat_a \ -- sleep ${OPT_RUN_TIME}; } # use like pt-stalk --plugin=/root/collect_perf.sh --etc --etc

Slide 23

Slide 23 text

How pt-stalk can be USE’d

Slide 24

Slide 24 text

24 How pt-stalk can be USE’d Linux Kernel CPU CPU Interconnect DRAM I/O Bridge I/O Controller Network Controller I/O Bus Expander Interconnect Disk Disk Swap Port Port Applications System libraries System Call Interface VFS Sockets Scheduler File Systems TCP/UDP Volume Manager IP Virtual Memory Block Device Interface Ethernet Device Drivers Memory Bus Interface Transports

Slide 25

Slide 25 text

25 Linux Kernel CPU CPU Interconnect DRAM I/O Bridge I/O Controller Network Controller I/O Bus Expander Interconnect Disk Disk Swap Port Port Applications (MySQL!) System libraries System Call Interface VFS Sockets Scheduler File Systems TCP/UDP Volume Manager IP Virtual Memory Block Device Interface Ethernet Device Drivers Memory Bus Interface Transports ps df /proc/diskstats SHOW ENGINE INNODB STATUS /proc/interrupts iostat lsof /proc/meminfo mpstat SHOW ENGINE INNODB MUTEX mysqladmin ext SHOW OPEN TABLES pmap /proc/procstat SHOW FULL PROCESSLIST /proc/vmstat /proc/slabinfo sysctl SHOW ENGINE TOKUDB STATUS top SHOW GLOBAL VARIABLES vmstat SHOW SLAVE STATUS netstat strace tcpdump gdb (backtraces) oprofile

Slide 26

Slide 26 text

26 strace tcpdump gdb (backtraces) oprofile How pt-stalk can be USE’d: Here Be Dragons!

Slide 27

Slide 27 text

A walkthrough

Slide 28

Slide 28 text

28 A walkthrough Using pt-stalk to solve problems with... ●...High IO ●...High CPU ●...Networking

Slide 29

Slide 29 text

29 Useful links ●grep commands - https://gist.github.com/altmannmarcelo/eec40a54568299c2cc11b6cf585 9203d ●Check List - http://www.brendangregg.com/USEmethod/use-linux.html

Slide 30

Slide 30 text

Questions ? Marcos Albe [email protected] Marcelo Altmann @altmannmarcelo [email protected]