Beruflich Dokumente
Kultur Dokumente
Presenting Sponsors
Technical Assistance
If you require assistance Maximize your screen with Please fill in the short
during the session, type the zoom button on the evaluation following the
your inquiry into the top of the presentation session. It will appear in
question pane on the right window. your web browser.
side.
Thank You to Our Presenting Sponsors
IDERA designs powerful software with one SentryOne empowers Microsoft data professionals to
goal in mind – to solve customers’ most complex achieve breakthrough performance across physical,
challenges with easy-to-use solutions. IDERA’s award- virtual and cloud environments. We develop solutions
winning SQL Server database solutions and multi- to monitor, diagnose, and optimize SQL Server
platform database, application and cloud monitoring performance, including Plan Explorer, the query-tuning
tools ensure your business never slows down. tool with more than 100,000 downloads.
Supporting Sponsor
Attend PASS Summit to Grow Your Career
Connect with a global network of 250,000+ data professionals
PASS Summit is the largest conference for technical professionals who
leverage the Microsoft Data Platform.
PASSsummit.com
The Community
Kellyn Pot'Vin-Gorman
B dbakevlar.com Speaker
Speaker numerous technical conferences for Oracle, Big Data, DevOps
@DBAKevlar Testing and SQL Server
linkedin.com/in/kellynpotvin
Advanced Tools for the Linux DBA
Kellyn Pot'Vin-Gorman, Technical Intelligence Manager, Delphix, Inc.
Presenting Sponsors
LINUX PERFORMANCE IS
HUGE
Monitoring Tools
PIDSTAT
NETSTAT
DSTAT
NMON
LSOF
Common Arguments and Values
• Some of the utilities aren’t standard and may need to be installed.
• Yum and apt-get are your friend
• You may require sudo, (super user) privileges to install
• <command> -x(xx)
• Arguments are cap sensitive, (as is everything in Unix world.)
• <command> -x 5 5
• First value is interval in seconds
• Second value is how many results to return
• <command> -h
• Provides help information about the utility or command
9
PIDSTAT
• We all use IOSTAT, VMSTAT,
MEMSTAT, etc.
• Focusing on the PID and
collecting quick information can
eliminate the need to gather it
elsewhere.
• Statistics on a process, either
global or by PID
Global PID STATS and By PID
Inspecting IO for a User with PIDSTAT
Inspecting Page Faults and Memory
What is DSTAT?
17
dstat Utility
18
dstat Utility
• Dstat for one disk and only CPU info and disk reads:
$ dstat -cdl -D xvda1
$ dstat -d
19
What is NMON?
20
nmon CPU
• Click C <enter>
21
nmon memory
• m<enter>
22
nmon NFS
• NFS<enter>
23
Knowing About Open Files
Knowing what files are open are important when waiting for a
database to close.
Awareness of access of files by a process that may not be
known
To identify what user has what files open
fuser/lsof Utilities
• Displays list of UNIX processes using file-system
# lsof /var
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
syslogd 350 root 5w VREG 222,5 0 440818 /var/adm/messag
syslogd 350 root 6w VREG 222,5 339098 6248 /var/log/syslog
cron 353 root cwd VDIR 222,5 512 254550 /var -- atjobs
LSOF
• LiSt of Files
• In our example, we want to see the files that are open in the
Temp directory.
• Although lsof +D with the directory name should display
them, Linux may not provide as specific data as I’d prefer.
• I want the child PID 17669, only Temp and I want it sorted
• Using grep, we can combat this:
$ lsof | grep Temp | grep 17669 | sort
Temp files, for child 17669, Sorted
Querying Open Datafiles
• $ lsof –u <username>
• Jsmith user is having issues working with an application.
• Query reports back, but the corresponding commit doesn’t occur.
• Believe that login is incorrectly configured.
Now a touch of a file in the directory shows this:
jsmith@e09627d558b7:/opt/mssql-tools/bin$ touch
test.txt
touch: cannot touch 'test.txt': Permission denied
What does LSOF show?
FUSER and Killing Users
33
sar Utility
$ sar -u 5 5
Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_ (2 CPU)
38
nmon memory
• m<enter>
39
nmon NFS
• NFS<enter>
40
Network Diagnostics
• ifconfig
• Configure/display network interfaces
• netstat/ss
• Display cumulative network statistics
• ping
• Send ICMP echo packets to network hosts
• traceroute
• Trace the route of ICMP echo packets to network hosts
• tcpdump/snoop
ifconfig Utility
• Configures network interfaces
• Configure new network interface: ifconfig … create inet … up
• Display network interface status: ifconfig -a
$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 06:8D:24:F2:82:3C
inet addr:10.0.1.20 Bcast:10.0.1.255
Mask:255.255.255.0
inet6 addr: fe80::48d:24ff:fef2:823c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:29480071 errors:0 dropped:0 overruns:0
frame:0
TX packets:26850299 errors:0 dropped:0 overruns:0
carrier:0
collisions:0 txqueuelen:1000
RX bytes:4059464946 (3.7 GiB) TX bytes:9135825067 (8.5
GiB)
Interrupt:153
What is NETSTAT?
• Displays network connections, routing tables, interface statistics
• Network connections (a.k.a. sockets): netstat
• Cumulative networking statistics: netstat -s
• Routing tables: netstat -r
• STREAMS statistics (Solaris and AIX): netstat -m
• Verbose mode: add -v switch
netstat Utility
$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 linuxsource:12129 linuxsource:ncube-lm ESTABLISHED
tcp 0 64 linuxsource:ssh c-164-182-219.hsd1:50171 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm ip-10-0-1-10.delphix.:58424 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm landsharkengine.delph:63611 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm linuxsource:12129 ESTABLISHED
udp 0 0 localhost:17493 localhost:17493 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 12 [ ] DGRAM 8754 /dev/log
unix 2 [ ] DGRAM 7377 @/org/kernel/udev/udevd
unix 3 [ ] STREAM CONNECTED 9499
unix 2 [ ] DGRAM 9338
unix 2 [ ] DGRAM 8927
netstat Utility
• Display network routing tables on the local host:
$ netstat -r
46
ss Utility
$ ss
$ ss -ltp
47
ping Utility
• Simple diagnostic test for network connectivity
• Be aware that many network administrator block ICMP traffic for security reasons
$ ping -c 4 www.amazon.com
PING e15316.ci.akamaiedge.net (104.86.87.164) 56(84) bytes of data.
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=1
ttl=50 time=1.81 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=2
ttl=50 time=1.83 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=3
ttl=50 time=1.99 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=4
ttl=50 time=1.85 ms
49
traceroute Utility
$ traceroute www.amazon.com
traceroute to www.amazon.com (54.192.195.66), 30 hops max, 60 byte packets
1 216.182.225.134 (216.182.225.134) 16.379 ms 216.182.225.124 (216.182.225.124) 49.305 ms
216.182.225.134 (216.182.225.134) 16.347 ms
2 100.66.8.70 (100.66.8.70) 19.966 ms 100.66.8.6 (100.66.8.6) 19.962 ms 100.66.8.250
(100.66.8.250) 14.142 ms
3 100.66.10.46 (100.66.10.46) 21.317 ms 100.66.10.100 (100.66.10.100) 19.104 ms 100.66.11.150
(100.66.11.150) 14.317 ms
4 100.66.7.237 (100.66.7.237) 15.802 ms 100.66.7.183 (100.66.7.183) 16.916 ms 100.66.6.67
(100.66.6.67) 16.800 ms
5 100.66.4.199 (100.66.4.199) 19.609 ms 100.66.4.127 (100.66.4.127) 14.576 ms 100.66.4.151
(100.66.4.151) 11.455 ms
6 100.65.9.65 (100.65.9.65) 0.349 ms 100.65.9.33 (100.65.9.33) 5.948 ms 100.65.9.1 (100.65.9.1)
0.275 ms
7 205.251.244.243 (205.251.244.243) 1.378 ms 72.21.220.120 (72.21.220.120) 1.280 ms 1.333 ms
8 54.239.111.120 (54.239.111.120) 24.074 ms 23.301 ms 54.239.110.22 (54.239.110.22) 37.663 ms
9 54.239.111.183 (54.239.111.183) 1.415 ms 54.239.111.179 (54.239.111.179) 1.234 ms 1.280 ms
10 72.21.220.9 (72.21.220.9) 1.326 ms 1.348 ms 1.391 ms
iPerf3 Utility
• iPerf3 is a tool for active measurements of the maximum achievable
bandwidth on IP networks
• supports tuning of various parameters related to timing, buffers and protocols
(TCP, UDP, SCTP with IPv4 and IPv6)
• Home page https://iperf.fr/
• “iperf” executable must be installed on servers on both ends of
network being measured
Server-A Server-B
(iperf client) (iperf server)
52
tcpdump/snoop Utilities
$ tcpdump
tcpdump: listening on hme0
18:56:08.427002 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 529952:530160, ack 3681, win 172, length 208
18:56:08.428001 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 530160:530368, ack 3681, win 172, length 208
18:56:08.429695 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [.], ack 515360, win 256, length 0
18:56:08.429707 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [.], ack 517984, win 252, length 0
18:56:08.429723 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [P.], seq 3681:3745, ack 515568, win 255, length 64
^C18:56:08.429925 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 530368:530960, ack 3745, win 172, length 592
55
strace Utility
57
dtrace Utility
$ dtrace -n 'proc:::exec-success{printf("%d %s”,timestamp,curpsinfo-
>pr_psargs);}’
dtrace: description 'proc:::exec-success ' matched 1 probe
CPU ID FUNCTION:NAME
1 797 exec_common:exec-success 21935388676181394 man ls
0 797 exec_common:exec-success 21935388840101743 sh -c cd /usr/share/man;
tbl /usr/sha
1 797 exec_common:exec-success 21935388858652639 col –x
0 797 exec_common:exec-success 21935388863714971 neqn
/usr/share/lib/pub/eqnchar –
0 797 exec_common:exec-success 21935388867119787 tbl
/usr/share/man/man1/ls.1
1 797 exec_common:exec-success 21935388881310626 nroff -u0 -Tlp -man –
file Utility
“Finding Java”
$ file /usr/bin/java
/usr/bin/java: symbolic link to `/etc/alternatives/java’
$ file /etc/alternatives/java
/etc/alternatives/java: symbolic link to `/usr/java/jdk1.7.0_51/jre/bin/java’
$ file /usr/java/jdk1.7.0_51/jre/bin/java
/usr/java/jdk1.7.0_51/jre/bin/java: ELF 64-bit LSB executable, x86-64, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
stripped
$ file make_logs.sql
make_logs.sql: ASCII C program text
FTrace
Perf-Events
eBPF
LTTng
SystemTap
KTap
Administrator
Perf Tools sysdig
About Linux Trace Files
• Calls are returned
• -1 is commonly a sign of an error
• Calls can be unfinished and then resumed
• Calls are kept as close to readable as possible, Example:
Perf-Tools
DIG
DeeP
Performance
and Tracing DXToolkit
• Not to duplicate previous in-
depth sessions
• Valuable and make you want to
learn more
• Easy to use
• Variety of tools across resources
• Hit main pain points
Goal
Why TRACE-CMD and Perf-Tools
CONFIG_FUNCTION_TRACER
CONFIG_FUNCTION_GRAPH_TRACER
CONFIG_STACK_TRACER
CONFIG_DYNAMIC_FTRACE
The Next two tools Use
• CPU=0
• Success/Error/Warning/Info
• Success = 1
# trace-cmd record -N gandalf:12345 -e sched_switch -e sched_wakeup -e irq hackbench 50
• Function collectors
• Funccount
• Functrace
• Funcslower
• Funcgraph
• kprobe
Snoop
• IO Opensnoop
• Iosnoop Execsnoop
• Iolatency syscount
• Bitesize
https://github.com/brendangregg/perf-tools
Perf-Tools
SSD
COMM PID TYPE DEV BLOCK BYTES LATms
randread 20125 R 202,16 24803976 8192 0.15
randread 20125 R 202,32 17527272 8192 0.15
randread 20125 R 202,16 13382360 8192 0.15
randread 20125 R 202,32 29727160 8192 0.19
randread 20125 R 202,32 26965272 8192 0.18
randread 20125 R 202,32 27222376 8192 0.17
Outliers in IO Data
• Function vs. Utility
• Executed printk()
• C programming language against
the Linux Kernel
• Prints the string to kernel log,
allowing you to post messages
directly.
PrintK
Recent Changes
OPENsnoop
Reveals Same data as LSOF
Benefit over LSOF
Can be used with .digrc file on host to provide more information about
DNS.
Can use it with monitoring and alerting for the DBA to know when hosts
are experiencing DNS issues, which often are blamed on databases vs. DNS.
DIG Examples
Linux for the DBA Summary
96
Coming up next…
@sqlpass
#sqlpass
@PASScommunity
Presenting Sponsors