SlideShare una empresa de Scribd logo
1 de 68
Descargar para leer sin conexión
Analyzing
OS X Systems Performance
with the
USE Method
Brendan Gregg, Senior Performance Architect, Netflix	

March, 2014
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
Darwin Operating System HardwareXNUKernel
Applications
OSFMKBSD
Ethernet
IP
TCP/UDP
Block Devices
HFS+/...
VFS Sockets
System Libraries
System Call Interface Scheduler
Virtual!
Memory
I/O Kit
Find the Bottleneck
Disk Disk Port Port
DRAM
Southbridge
DMI
GPU
Other Devices
Device Drivers
This Talk
• Summarizes casual to serious performance analysis of OS X	

• From the systems perspective, not the application	

• Many application issues can be found easily this way	

• Covering not just current tools, but suggestions for future work	

• May change how you think about performance!

whoami
• Senior Performance Architect at Netflix	

• Primary author of the DTrace book	

• Wrote many DTrace scripts included with OS X.

Eg: dtruss, iosnoop, iotop, opensnoop, execsnoop,

procsystime, bitesize.d, seeksize.d, setuids.d, etc...	

• These were ported and enhanced by Apple engineering (thanks!)	

• Created the USE method and USE method checklist for OS X
• The Tools Method	

• The USE Method	

• Future work
Agenda
The Tools Method
The Tools Method
• A tool-based performance analysis approach, commonly followed
today. For reference, I've called it the "Tools Method".	

• 1. List available performance tools	

• 2. For each tool, list its useful metrics	

• 3. For each metric, list possible interpretation	

• Simple, useful, but analysis is limited to what the tools provide easily
Tool Examples
• Activity Monitor	

• atMonitor, Temperature Monitor Lite	

• Command Line	

• DTrace	

• Instruments
Activity Monitor
• High level process and

system sumaries.A GUI

version of top(1)	

• Table shows processes

by %CPU, memory	

• CPU load over time	

• Quit, info, and system

diagnosis buttons
Activity Monitor
Network
• Quick way to see current 

and recent network

throughput	

• Like the CPU summary,

shows aggregate device

stats, and not per-device
Activity Monitor
CPU Usage
• Per-CPU utilization from previous 0.5 - 5 seconds (tunable)	

• Handy to leave running. Look for single hot CPUs/threads
Activity Monitor
Floating CPU Window
• Earlier OS X also had a compact version (gone in Mavericks)	

• Was nice, but what I really want is a compact visualization for both
per-CPU and historical data
Activity Monitor
CPU/Disk Suggestion
• Could show both per-device and history using a utilization heat map:
• http://dtrace.org/blogs/brendan/2011/12/18/visualizing-device-utilization/
Activity Monitor
Sample Process
• The cog button ("System

diagnostics options") has a

"Sample process" option for

profiling CPU code paths	

• Explains %CPU usage	

• Although output usually very

long and time consuming to

read (see scroll bar):
Activity Monitor
Flame Graphs ?
• Suggestion: include a

Flame Graph view	

• Visualizes entire

profile output in

one screen	

• http://github.com/

brendangregg/

FlameGraph
atMonitor
• 3rd party app. Version 2.7b crashes for me if "Top Window" is visible.	

• Shows many useful metrics: per-CPU, RAM, GPU, per-disk, and per-
network interface utilization perentages with histories.	

• Currently the easiest way to see GPU, disk, and network utilization. 	

• Utilization is easy to interpret. I/O per second is not.
Temperature Monitor Lite
• Another 3rd party application	

• Easy way to infer GPU utilization	

• Normal:	

• Video:
Command Line
• Accessed via the Terminal application	

• Numerous performance tools available, from UNIX/BSD/OSX	

• Eg, the uptime(1) command shows recent and historic CPU load:
$ uptime
14:36 up 43 days, 2:39, 30 users, load averages: 0.72 1.02 1.29
• There numbers are the 1, 5, and 15 minute load averages.Values are
really constants in an exponential decay moving sum.
• Interpret: if average > number of CPUs, then CPUs are overloaded
Command Line: top
$ top -o cpu
Processes: 272 total, 4 running, 268 sleeping, 1546 threads 14:47:36
Load Avg: 1.14, 0.75, 0.95 CPU usage: 13.95% user, 2.78% sys, 83.26% idle
SharedLibs: 12M resident, 5112K data, 0B linkedit.
MemRegions: 339218 total, 6689M resident, 184M private, 2153M shared.
PhysMem: 3429M wired, 6502M active, 5910M inactive, 15G used, 537M free.
VM: 552G vsize, 1052M framework vsize, 111312590(1) pageins, 1437348(0) pageouts
Networks: packets: 120030109/127G in, 70582570/38G out.
Disks: 22089197/1050G read, 26756359/1163G written.
!
PID COMMAND %CPU TIME #TH #WQ #PORT #MREGS RPRVT RSHRD RSIZE
602 bash 100.0 47:42.28 1/1 0 21 27 236K 816K 760K
94370 top 17.2 00:03.77 1/1 0 24 39 4368K 216K 5116K
52617 firefox 6.3 47:30:58 45/1 2 576- 177307+ 1984M+ 200M 2530M+
92489- Google Chrom 2.2 13:31.85 34 2 530 2454 273M 271M 734M
[...]
• top(1): high level process and system summary:
hey...
Command Line: vm_stat
$ vm_stat 1
Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
free active spec inactive wire faults copy 0fill reactive pageins pageout
101297 1662K 29920 1509998 888520 17650M 106072K 15926M 6833792 111312K 1437348
100919 1658K 29920 1509998 893230 2851 0 2043 0 0 0
101183 1658K 29918 1509998 893169 143 0 87 0 1 0
100517 1658K 29921 1509998 893354 396 3 136 0 2 0
96590 1657K 29923 1514414 894426 5888 94 5146 0 2 0
93184 1662K 28486 1514414 894484 14183 117 12521 0 0 0
91224 1663K 28486 1514414 894886 5683 0 3454 0 0 0
89195 1649K 29924 1514413 909225 11570 199 10050 0 4 0
87550 1636K 29917 1514155 923179 24486 1432 12009 0 2134 0
61596 1644K 28309 1515551 941688 49395 1446 46127 0 4941 0
52932 1669K 28442 1515663 925755 70618 1731 53131 0 1221 0
76395 1681K 28417 1515685 889983 30514 0 28072 0 428 0
73520 1679K 28449 1515777 894905 20082 17 18077 0 107 0
60335 1684K 29073 1515560 903152 39696 38 35535 0 1309 0
[...]
• vm_stat(1): virtual memory statistics, including free memory, paging
Command Line: iostat
$ iostat 1
disk0 disk2 cpu load average
KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m
47.03 13 0.60 96.67 0 0.00 5 2 92 0.94 1.01 0.99
972.42 19 18.02 128.00 141 17.60 2 3 95 0.94 1.01 0.99
315.60 10 3.08 128.00 24 3.00 6 2 92 0.94 1.01 0.99
4.00 1 0.00 0.00 0 0.00 6 2 92 0.94 1.01 0.99
1024.00 8 7.99 128.00 69 8.61 6 2 92 0.94 1.01 0.99
1024.00 18 17.97 128.00 143 17.85 2 2 95 0.86 0.99 0.99
1024.00 17 16.98 128.00 142 17.72 2 2 96 0.86 0.99 0.99
165.27 272 43.84 127.13 146 18.10 6 5 89 0.95 1.01 0.99
1024.00 18 17.98 128.00 143 17.85 2 2 96 0.95 1.01 0.99
[...]
• iostat(1): block device I/O statistics. Disks, USB drives.
• No percent utilization/busy, like other OSes? Makes it hard to interpret.
Command Line: netstat
$ netstat -iI en0 1
input (en0) output
packets errs bytes packets errs bytes colls
237 0 296232 167 0 18555 0
26 0 19374 16 0 4617 0
5 0 661 1 0 2020 0
1601 0 2231882 535 0 50072 0
3519 0 5027348 1005 0 62086 0
1362 0 1923223 627 0 39699 0
1338 0 1866404 296 0 17166 0
878 0 1203230 182 0 14803 0
8 0 1302 11 0 2900 0
[...]
• netstat(1): various network statistics. -i for interface stats:
• No percent utilization, but can figure it out: throughput / known max
Command Line: tcpdump
$ tcpdump -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes
18:00:55.228744 IP 10.0.1.92.53 > 10.0.1.148.49228: 26359 1/0/0 A 69.192.253.15 (81)
18:00:55.311056 ARP, Reply 10.0.1.162 is-at 2c:54:2d:a4:25:4c, length 28
18:00:55.342793 IP 74.125.28.189.443 > 10.0.1.148.62998: Flags [P.], seq
3544891232:3544891287, ack 3832081572, win 661, options [nop,nop,TS val 2936982235 ecr
2331923799], length 55
18:00:55.342933 IP 10.0.1.148.62998 > 74.125.28.189.443: Flags [.], ack 55, win 8188,
options [nop,nop,TS val 2331932237 ecr 2936982235], length 0
18:00:56.477029 IP 10.0.1.148.50359 > 67.195.141.201.443: Flags [P.], seq
696365506:696365533, ack 1903095540, win 16384, length 27
18:00:56.477158 IP 10.0.1.148.50359 > 67.195.141.201.443: Flags [F.], seq 27, ack 1, win
16384, length 0
[...]
• tcpdump(1): sniff and examine network packets:
• Also dump to a file and examine later. Does incur overhead.
Observability So Far...
• We can see all the things!	

• Not really...
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
Darwin Operating System Hardware
XNUKernel
Applications
OSFMKBSD
Ethernet
IP
TCP/UDP
Block Devices
HFS+/...
VFS Sockets
System Libraries
System Call Interface Scheduler
Virtual!
Memory
Device Drivers
I/O Kit
Disk Disk Port Port
DRAM
Southbridge
DMI
GPU
Other Devices
Observability So Far...
iostat
netstat
netstat
ActivityMonitor
atMonitor
vm_stat
top
ActivityMonitor
atMonitor
top
ActivityMonitor
Temp.Monitor
tcpdump
DTrace
• Programmable, real-time, dynamic

and static tracing	

• Write your own one-liners and

scripts, or use other people's;

including those in /usr/bin	

• There is a great book about it...
DTrace: Scripts
$ man -k dtrace
bitesize.d(1m) - analyse disk I/O size by process. Uses DTrace
cpuwalk.d(1m) - Measure which CPUs a process runs on. Uses DTrace
creatbyproc.d(1m) - snoop creat()s by process name. Uses DTrace
dappprof(1m) - profile user and lib function usage. Uses DTrace
dapptrace(1m) - trace user and library function usage. Uses DTrace
diskhits(1m) - disk access by file offset. Uses DTrace
dispqlen.d(1m) - dispatcher queue length by CPU. Uses DTrace
dtrace(1) - generic front-end to the DTrace facility
dtruss(1m) - process syscall details. Uses DTrace
errinfo(1m) - print errno for syscall fails. Uses DTrace
execsnoop(1m) - snoop new process execution. Uses DTrace
[...]
• Over 40 DTrace scripts are shipped with OS X (which I mostly wrote
originally). Listing them:
DTrace: iosnoop
$ iosnoop
UID PID D BLOCK SIZE COMM PATHNAME
503 176 R 148471184 8192 SystemUIServer ??/vm/swapfile10
503 176 R 835310312 4096 SystemUIServer ??/vm/swapfile4
503 92489 W 746204600 61440 Google Chrome ??/Chrome/.com.google.Chrome.hw1Inp
503 92489 W 746204720 23472 Google Chrome ??/Default/.com.google.Chrome.76k4tG
0 19 W 425711304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl
0 19 W 57246896 4096 syslogd ??/DiagnosticMessages/StoreData
0 19 W 425710304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl
503 52617 W 214894232 4096 firefox ??/iw4rbel9.default/_CACHE_CLEAN_
0 19 W 57246896 4096 syslogd ??/DiagnosticMessages/StoreData
0 19 W 425710304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl
[...]
• iosnoop(1m): trace block device I/O
• Identify processes and files causing disk I/O
DTrace: hfsslower.d
$ ~/dtbook_scripts/Chap5/hfsslower.d 10
TIME PROCESS D KB ms FILE
2014 Feb 14 17:35:59 Terminal R 5751 16 data.data
2014 Feb 14 17:35:59 Terminal R 6166 17 data.data
2014 Feb 14 17:35:59 Terminal W 11921 15 data.data
[...]
• hfsslower.d: trace HFS calls slower than a threshold. Eg, 10 ms:
• Traces all application I/O to the file system, not just disk I/O	

• Script is on http://www.dtracebook.com
DTrace: execsnoop
$ execsnoop -v
STRTIME UID PID PPID ARGS
2014 Feb 14 19:40:55 503 94835 551 man
2014 Feb 14 19:40:55 503 94835 551 man
2014 Feb 14 19:40:55 503 94841 94837 groff
2014 Feb 14 19:40:55 503 94839 94837 tbl
2014 Feb 14 19:40:55 503 94840 94838 cat
2014 Feb 14 19:40:56 503 94845 94841 grotty
2014 Feb 14 19:40:56 503 94844 94841 troff
2014 Feb 14 19:40:56 503 94843 94842 less
2014 Feb 14 19:40:58 503 94846 92489 Google Chrome He
2014 Feb 14 19:41:03 503 94847 92489 Google Chrome He
[...]
• execsnoop(1m): trace process execution
• Shows what programs are launched
DTrace: dtruss
$ dtruss -en bash
PID/THRD ELAPSD SYSCALL(args) = return
475/0x1199: 87917 read(0x0, "a0", 0x1) = 1 0
475/0x1199: 12 write_nocancel(0x2, "a0", 0x1) = 1 0
475/0x1199: 3 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0
475/0x1199: 2 sigaltstack(0x0, 0x7FFF55F898D0, 0x0) = 0 0
475/0x1199: 48163 read(0x0, "t0", 0x1) = 1 0
475/0x1199: 10 write_nocancel(0x2, "t0", 0x1) = 1 0
475/0x1199: 3 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0
475/0x1199: 2 sigaltstack(0x0, 0x7FFF55F898D0, 0x0) = 0 0
475/0x1199: 12 write_nocancel(0x2, "m0", 0x1) = 1 0
475/0x1199: 2 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0
[...]
• dtruss(1m): trace system calls, from one or many processes
• dtruss is a script - edit it to add/modify it as desired
DTrace: sotop
$ sotop
PROCESS PID READS WRITES READ_KB WRITE_KB CPU
kernel_task 0 0 0 0 0 475
firefox 52617 205 14 84 22 118
Terminal 165 0 0 0 0 35
WindowServer 89 0 0 0 0 34
SIDPLAY 51232 0 0 0 0 31
Google Chrome H 92513 6 12 0 1 14
Google Chrome H 94477 2 1 0 0 13
clear 94909 0 0 0 0 13
Google Chrome 92489 16 5 0 0 12
sh 94909 0 0 0 0 12
[...]
• sotop: summarize socket I/O by-process, top-style:
• Also from the DTrace book.
Instruments
• Advanced analysis GUI	

• Includes many

"Instruments", which

profile applications

in different ways:	

• Data sources include

DTrace, CPU counters
Instruments
Thread States
Instruments
Low Level CPU Counters
• Performance monitor

counter (PMC) and

performance monitor

interrupts can be

instrumented	

• Hard work, but can be

used to understand

bus and interconnect

activity
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
XNUKernel
Applications
OSFMKBSD
Ethernet
IP
TCP/UDP
Block Devices
HFS+/...
VFS Sockets
System Libraries
System Call Interface Scheduler
Virtual!
Memory
Device Drivers
I/O Kit
Disk Disk Port Port
DRAM
Southbridge
DMI
GPU
Other Devices
Observability So Far...
iostat
netstat
netstat
ActivityMonitor
atMonitor
vm_stat
top
ActivityMonitor
atMonitor
top
ActivityMonitor
Temp.Monitor
dtruss
hfsslower
iosnoop
execsnoopsotop
tcpdump
Instruments
dtrace
Instruments
Tools Method in Practice
• Tools Method provides reasonable coverage	

• Some observability gaps, some uneven coverage	

• Can improve coverage by adding more tools: ps, ping, traceroute,
latency, df, sysctl, plockstat, opensnoop, dispqlen.d, runocc.d, nfsstat,
iopending, soconnect_mac.d, httpdstat.d, sc_usage, fs_usage, ...	

• I could keep covering tools for the rest of this talk...
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
XNUKernel
Applications
OSFMKBSD
Ethernet
IP
TCP/UDP
Block Devices
HFS+/...
VFS Sockets
System Libraries
System Call Interface Scheduler
Virtual!
Memory
Disk Disk Port
DRAM
Southbridge
DMI
GPU
Other Devices
iostat
netstat
netstat
ActivityMonitor
atMonitor
vm_stat
top
ActivityMonitor
atMonitor
top,ps
ActivityMonitor
Temp.Monitor
opensnoop
hfsslower.d
df,nfstat
iosnoop
iopending
execsnoopsotop
tcpdump
dapptrace
ping
Port
traceroute
plockstat
dtruss,sc_usage
errinfo,kill.d
dispqlen.d
runocc.d
latency
soconnect_mac.d,soaccept_mac.d
httpdstat.d
fs_usage
priclass.d
pridist.d
bitesize.d
seeksize.d
maclife.d
macvfssnoop.d
Most DTrace scripts are in /usr/bin
Some are from my DTrace book
and are available online
dtrace
Instruments
Instruments
Custom Instruments using

CPU counters/interrupts can

be added for bus observability
I/O Kit
Device Drivers
The Focus on Tools
• Useful, however, learning tools & metrics becomes laborious.	

• Still limited by what the tools provide, or provide easily.	

• You can try to approach this in a different way...
Instead of starting with the tools, start with the questions
The USE Method
The USE Method
• For every resource, check:	

• 1. Utilization	

• 2. Saturation	

• 3. Errors
The USE Method
• For every resource, check:	

• 1. Utilization: time resource was busy, or degree used	

• 2. Saturation: degree of queued extra work	

• 3. Errors: any errors
Queueing System
Saturation
Utilization
Errors
X
• If it helps, consider

all resources as a

a queueing system:	

• Also check errors
Hardware Resources
• CPUs	

• Main Memory	

• Network Interfaces	

• Storage Devices	

• Controllers, Interconnects	

• Find the functional diagram and examine every item in the data path...
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
Hardware
Functional Diagram
Disk Disk Port Port
DRAM
Southbridge
DMI
GPU
Other Devices
• For each check:	

• 1. Utilization	

• 2. Saturation	

• 3. Errors
USE Method Checklists
• Build a checklist for all combinations, identifying tools/metrics to use
OS X Checklist
Resource Type Metric
CPU Utilization
CPU Saturation
CPU Errors
OS X Checklist
Resource Type Metric
CPU Utilization
system-wide: iostat 1, "us" + "sy"; per-cpu: DTrace [1];Activity
Monitor → CPU Usage or Floating CPU Window; per-process:top
-o cpu, "%CPU";Activity Monitor → Activity Monitor, "%CPU"; ...
CPU Saturation
system-wide: uptime, "load averages" > CPU count; latency,
"SCHEDULER" and "INTERRUPTS"; per-cpu: dispqlen.d (DTT),
non-zero "value"; runocc.d (DTT), non-zero "%runocc"; per-
process: Instruments → Thread States, "On run queue"; DTrace [2]
CPU Errors
dmesg; /var/log/system.log; Instruments → Counters, for PMC and
whatever error counters are supported (eg, thermal throttling)
OS X Checklist
Resource Type Metric
CPU Utilization
system-wide: iostat 1, "us" + "sy"; per-cpu: DTrace [1];Activity
Monitor → CPU Usage or Floating CPU Window; per-process:top
-o cpu, "%CPU";Activity Monitor → Activity Monitor, "%CPU"; ...
CPU Saturation
system-wide: uptime, "load averages" > CPU count; latency,
"SCHEDULER" and "INTERRUPTS"; per-cpu: dispqlen.d (DTT),
non-zero "value"; runocc.d (DTT), non-zero "%runocc"; per-
process: Instruments → Thread States, "On run queue"; DTrace [2]
CPU Errors
dmesg; /var/log/system.log; Instruments → Counters, for PMC and
whatever error counters are supported (eg, thermal throttling)
OS X Checklist, cont.
Resource Type Metric
Memory	

Capacity
Utilization
Memory	

Capacity
Saturation
" Errors
OS X Checklist, cont.
Resource Type Metric
Memory	

Capacity
Utilization
system-wide: vm_stat 1, main memory free = "free" + "inactive", in
units of pages;Activity Monitor → Activity Monitor → System
Memory, "Free" for main memory; per-process: top -o rsize,
"RSIZE" is resident main memory size, "VSIZE" is virtual memory
size; ps -alx, "RSS" is resident set size, "SZ" is virtual memory size;
ps aux similar (legacy format)
Memory	

Capacity
Saturation
system-wide: vm_stat 1, "pageout"; per-process: anonpgpid.d
(DTT), DTrace vminfo:::anonpgin [3] (frequent anonpgin == pain);
Instruments → Memory Monitor, high rate of "Page Ins" and "Page
Outs"; sysctl vm.memory_pressure [4]	

!
" Errors System Information → Hardware → Memory, "Status" for physical
failures; DTrace failed malloc()s
OS X Checklist, cont.
Resource Type Metric
Memory	

Capacity
Utilization
system-wide: vm_stat 1, main memory free = "free" + "inactive", in
units of pages;Activity Monitor → Activity Monitor → System
Memory, "Free" for main memory; per-process: top -o rsize,
"RSIZE" is resident main memory size, "VSIZE" is virtual memory
size; ps -alx, "RSS" is resident set size, "SZ" is virtual memory size;
ps aux similar (legacy format)
Memory	

Capacity
Saturation
system-wide: vm_stat 1, "pageout"; per-process: anonpgpid.d
(DTT), DTrace vminfo:::anonpgin [3] (frequent anonpgin == pain);
Instruments → Memory Monitor, high rate of "Page Ins" and "Page
Outs"; sysctl vm.memory_pressure [4]	

!
" Errors System Information → Hardware → Memory, "Status" for physical
failures; DTrace failed malloc()s
OS X Checklist, cont.
• Full list: http://www.brendangregg.com/USEmethod/use-macosx.html	

• Includes

references

from earlier

tables

Software Resources
• Can be studied using USE metrics as well, if possible	

• OS X Checklist includes some example software resources:	

• Processes, file descriptors, kernel mutexes, user-level mutexes
Mutex Lock
• Can you think of what these could mean for a mutex lock?:	

• Utilization	

• Saturation	

• Errors
Mutex Lock
• Can you think of what these could mean for a mutex lock?:	

• Utilization: held time per second	

• Saturation: measure of contention time or waiters	

• Errors: EDEADLK, EINVAL
Future Work
Future Work
• Tools/Metrics for USE Method	

• More methodologies, and then tools
USE Method Tools
• Tools can be developed to fetch USE metrics more easily	

• Especially for busses and interconnects	

• Would love to see USE metrics in Activity Monitor
USE Method New Uses
• Can be applied new areas, developing new metrics	

• May not always work, but worth trying	

• Find a functional diagram of your system, application, or environment,
and look for U.S.E. metrics for each component
Device Interconnect (PCIe/USB)
Interface
Transports
I/O Controller Network Controller
FSB
Memory!
Bus
CPU
Northbridge
Darwin Operating System HardwareXNUKernel
Disk Disk Port Port
DRAM
Southbridge
DMI
GPU
Other!
Devices
USE Metrics for all of:
Applications
OSFMKBSD
Ethernet
IP
TCP/UDP
Block Devices
HFS+/...
VFS Sockets
System Libraries
System Call Interface Scheduler
Virtual!
Memory
I/O Kit
Device Drivers
Stranger Example:TCP
$ netstat -s
tcp:
80444499 packets sent
28706719 data packets (3613656050 bytes)
76599 data packets (65712152 bytes) retransmitted
68 resends initiated by MTU discovery
41687640 ack-only packets (248964 delayed)
0 URG only packets
0 window probe packets
9286129 window update packets
707685 control packets
0 data packets sent after flow control
177149270 packets received
16296459 acks (for 3602941580 bytes)
556237 duplicate acks
0 acks for unsent data
154775303 packets (1214952475 bytes) received in-sequence
200501 completely duplicate packets (151553377 bytes)
1884 old duplicate packets
79 packets with some dup. data (17270 bytes duped)
6102493 out-of-order packets (4236017281 bytes)
67 packets (0 bytes) of data after window
0 window probes
14180 window update packets
72825 packets received after close
85 bad resets
0 discarded for bad checksums
0 discarded for bad header offset fields
0 discarded because packet too short
378961 connection requests
613 connection accepts
37 bad connection attempts
0 listen queue overflows
332688 connections established (including accepts)
381180 connections closed (including 13038 drops)
14527 connections updated cached RTT on close
14527 connections updated cached RTT variance on close
5495 connections updated cached ssthresh on close
1721 embryonic connections dropped
16204052 segments updated rtt (of 8674926 attempts)
374184 retransmit timeouts
4465 connections dropped by rexmit timeout
0 connections dropped after retransmitting FIN
91 persist timeouts
0 connections dropped by persist timeout
12784 keepalive timeouts
262 keepalive probes sent
1214 connections dropped by keepalive
1312411 correct ACK header predictions
152849516 correct data packet header predictions
17244 SACK recovery episodes
21329 segment rexmits in SACK recovery episodes
25852298 byte rexmits in SACK recovery episodes
180630 SACK options (SACK blocks) received
5682514 SACK options (SACK blocks) sent
0 SACK scoreboard overflow
[...]
• "netstat -s" output has over 50 metrics

for TCP	

• Do you understand them all?	

• Could USE metrics provide a high level

summary, treating TCP as a software

resource? (might be a stretch)
USE Method:TCP
• TCP as a software resource metrics:	

• Utilization	

• Saturation	

• Errors
USE Method:TCP
• TCP as a software resource metrics:	

• Utilization: time data was buffered per second	

• Saturation: listen queue overflows	

• Errors: bad connection attempts, bad resets, bad checksums, ...	

• I think I'd classify retransmits and duplicates as errors.
Other Methodologies
• Other methodologies include:	

• Drill Down Analysis Method	

• Workload Characterization	

• Thread State Analysis (TSA) Method	

• These too can pose questions that tools then answer
References
• http://www.brendangregg.com/USEmethod/use-macosx.html	

• http://www.brendangregg.com/usemethod.html	

• http://dtracebook.com - has DTrace book scripts online	

• http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/	

• http://dtrace.org/blogs/brendan/2011/12/18/visualizing-device-utilization/ - utilization
heat maps	

• http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html - flame graphs
Thanks
• http://www.brendangregg.com	

• bgregg@netflix.com	

• @brendangregg

Más contenido relacionado

La actualidad más candente

FD.io VPP事始め
FD.io VPP事始めFD.io VPP事始め
FD.io VPP事始めtetsusat
 
Hokkaido.cap#1 Wiresharkの使い方(基礎編)
Hokkaido.cap#1 Wiresharkの使い方(基礎編)Hokkaido.cap#1 Wiresharkの使い方(基礎編)
Hokkaido.cap#1 Wiresharkの使い方(基礎編)Panda Yamaki
 
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則勇 中津留
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingMichelle Holley
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)Brendan Gregg
 
自宅サーバ仮想化
自宅サーバ仮想化自宅サーバ仮想化
自宅サーバ仮想化anubis_369
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Etsuji Nakai
 
Super Easy Memory Forensics
Super Easy Memory ForensicsSuper Easy Memory Forensics
Super Easy Memory ForensicsIIJ
 
TIME_WAITに関する話
TIME_WAITに関する話TIME_WAITに関する話
TIME_WAITに関する話Takanori Sejima
 
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)Kentaro Ebisawa
 
Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本Sotaro Kimura
 
Docker Container Security - A Network View
Docker Container Security - A Network ViewDocker Container Security - A Network View
Docker Container Security - A Network ViewNeuVector
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at NetflixBrendan Gregg
 
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?IIJ
 
ネットワークOS野郎 ~ インフラ野郎Night 20160414
ネットワークOS野郎 ~ インフラ野郎Night 20160414ネットワークOS野郎 ~ インフラ野郎Night 20160414
ネットワークOS野郎 ~ インフラ野郎Night 20160414Kentaro Ebisawa
 
Understanding DPDK algorithmics
Understanding DPDK algorithmicsUnderstanding DPDK algorithmics
Understanding DPDK algorithmicsDenys Haryachyy
 
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)
ネットワーク機器のAPIあれこれ入門(NetOpsCoding#2)ネットワーク機器のAPIあれこれ入門(NetOpsCoding#2)
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)Kentaro Ebisawa
 

La actualidad más candente (20)

FD.io VPP事始め
FD.io VPP事始めFD.io VPP事始め
FD.io VPP事始め
 
Hokkaido.cap#1 Wiresharkの使い方(基礎編)
Hokkaido.cap#1 Wiresharkの使い方(基礎編)Hokkaido.cap#1 Wiresharkの使い方(基礎編)
Hokkaido.cap#1 Wiresharkの使い方(基礎編)
 
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則
IDA ユーザなら知っておくべきマントノン侯爵夫人にモテる 7つの法則
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
 
自宅サーバ仮想化
自宅サーバ仮想化自宅サーバ仮想化
自宅サーバ仮想化
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
 
Super Easy Memory Forensics
Super Easy Memory ForensicsSuper Easy Memory Forensics
Super Easy Memory Forensics
 
TIME_WAITに関する話
TIME_WAITに関する話TIME_WAITに関する話
TIME_WAITに関する話
 
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
 
Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本
 
Docker Container Security - A Network View
Docker Container Security - A Network ViewDocker Container Security - A Network View
Docker Container Security - A Network View
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at Netflix
 
Native Memory Tracking
Native Memory TrackingNative Memory Tracking
Native Memory Tracking
 
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?
【解説】IKE(IIJ Kubernetes Engine):= Vanilla Kubernetes + 何?
 
ネットワークOS野郎 ~ インフラ野郎Night 20160414
ネットワークOS野郎 ~ インフラ野郎Night 20160414ネットワークOS野郎 ~ インフラ野郎Night 20160414
ネットワークOS野郎 ~ インフラ野郎Night 20160414
 
Understanding DPDK algorithmics
Understanding DPDK algorithmicsUnderstanding DPDK algorithmics
Understanding DPDK algorithmics
 
Dpdk performance
Dpdk performanceDpdk performance
Dpdk performance
 
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)
ネットワーク機器のAPIあれこれ入門(NetOpsCoding#2)ネットワーク機器のAPIあれこれ入門(NetOpsCoding#2)
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)
 

Destacado

Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016Brendan Gregg
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf toolsVelocity 2015 linux perf tools
Velocity 2015 linux perf toolsBrendan Gregg
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaBrendan Gregg
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
 
FreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame GraphsFreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame GraphsBrendan Gregg
 
MeetBSD2014 Performance Analysis
MeetBSD2014 Performance AnalysisMeetBSD2014 Performance Analysis
MeetBSD2014 Performance AnalysisBrendan Gregg
 
Stop the Guessing: Performance Methodologies for Production Systems
Stop the Guessing: Performance Methodologies for Production SystemsStop the Guessing: Performance Methodologies for Production Systems
Stop the Guessing: Performance Methodologies for Production SystemsBrendan Gregg
 
Performance Analysis: The USE Method
Performance Analysis: The USE MethodPerformance Analysis: The USE Method
Performance Analysis: The USE MethodBrendan Gregg
 
ACM Applicative System Methodology 2016
ACM Applicative System Methodology 2016ACM Applicative System Methodology 2016
ACM Applicative System Methodology 2016Brendan Gregg
 
End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16AppDynamics
 
Linux Performance Tools
Linux Performance ToolsLinux Performance Tools
Linux Performance ToolsBrendan Gregg
 
Application Performance Monitoring
Application Performance MonitoringApplication Performance Monitoring
Application Performance MonitoringOlivier Gérardin
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsBrendan Gregg
 
AppDynamics VS New Relic – The Complete Guide
AppDynamics VS New Relic – The Complete GuideAppDynamics VS New Relic – The Complete Guide
AppDynamics VS New Relic – The Complete GuideTakipi
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersBrendan Gregg
 

Destacado (16)

Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf toolsVelocity 2015 linux perf tools
Velocity 2015 linux perf tools
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versa
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
 
FreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame GraphsFreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame Graphs
 
MeetBSD2014 Performance Analysis
MeetBSD2014 Performance AnalysisMeetBSD2014 Performance Analysis
MeetBSD2014 Performance Analysis
 
Stop the Guessing: Performance Methodologies for Production Systems
Stop the Guessing: Performance Methodologies for Production SystemsStop the Guessing: Performance Methodologies for Production Systems
Stop the Guessing: Performance Methodologies for Production Systems
 
Performance Analysis: The USE Method
Performance Analysis: The USE MethodPerformance Analysis: The USE Method
Performance Analysis: The USE Method
 
ACM Applicative System Methodology 2016
ACM Applicative System Methodology 2016ACM Applicative System Methodology 2016
ACM Applicative System Methodology 2016
 
End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16
 
Linux Performance Tools
Linux Performance ToolsLinux Performance Tools
Linux Performance Tools
 
Application Performance Monitoring
Application Performance MonitoringApplication Performance Monitoring
Application Performance Monitoring
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREs
 
AppDynamics VS New Relic – The Complete Guide
AppDynamics VS New Relic – The Complete GuideAppDynamics VS New Relic – The Complete Guide
AppDynamics VS New Relic – The Complete Guide
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF Superpowers
 

Similar a Analyzing OS X Systems Performance with the USE Method

YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceBrendan Gregg
 
Systems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudSystems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudBrendan Gregg
 
Linux Performance Tools 2014
Linux Performance Tools 2014Linux Performance Tools 2014
Linux Performance Tools 2014Brendan Gregg
 
Performance Analysis: new tools and concepts from the cloud
Performance Analysis: new tools and concepts from the cloudPerformance Analysis: new tools and concepts from the cloud
Performance Analysis: new tools and concepts from the cloudBrendan Gregg
 
Broken Performance Tools
Broken Performance ToolsBroken Performance Tools
Broken Performance ToolsC4Media
 
The New Systems Performance
The New Systems PerformanceThe New Systems Performance
The New Systems PerformanceBrendan Gregg
 
LISA2019 Linux Systems Performance
LISA2019 Linux Systems PerformanceLISA2019 Linux Systems Performance
LISA2019 Linux Systems PerformanceBrendan Gregg
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysisdreamwidth
 
Network operating systems
Network operating systemsNetwork operating systems
Network operating systemsAnkit Kumar
 
Introduction to Embedded System
Introduction to Embedded SystemIntroduction to Embedded System
Introduction to Embedded SystemZakaria Gomaa
 
Performance tunning
Performance tunningPerformance tunning
Performance tunninglokesh777
 
Extreme Linux Performance Monitoring and Tuning
Extreme Linux Performance Monitoring and TuningExtreme Linux Performance Monitoring and Tuning
Extreme Linux Performance Monitoring and TuningMilind Koyande
 
PLNOG16: Obsługa 100M pps na platformie PC , Przemysław Frasunek, Paweł Mała...
PLNOG16: Obsługa 100M pps na platformie PC, Przemysław Frasunek, Paweł Mała...PLNOG16: Obsługa 100M pps na platformie PC, Przemysław Frasunek, Paweł Mała...
PLNOG16: Obsługa 100M pps na platformie PC , Przemysław Frasunek, Paweł Mała...PROIDEA
 
QCon 2015 Broken Performance Tools
QCon 2015 Broken Performance ToolsQCon 2015 Broken Performance Tools
QCon 2015 Broken Performance ToolsBrendan Gregg
 
UKOUG, Lies, Damn Lies and I/O Statistics
UKOUG, Lies, Damn Lies and I/O StatisticsUKOUG, Lies, Damn Lies and I/O Statistics
UKOUG, Lies, Damn Lies and I/O StatisticsKyle Hailey
 
Webinar: Untethering Compute from Storage
Webinar: Untethering Compute from StorageWebinar: Untethering Compute from Storage
Webinar: Untethering Compute from StorageAvere Systems
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)MongoDB
 

Similar a Analyzing OS X Systems Performance with the USE Method (20)

YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
 
Systems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudSystems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the Cloud
 
Linux Performance Tools 2014
Linux Performance Tools 2014Linux Performance Tools 2014
Linux Performance Tools 2014
 
Performance Analysis: new tools and concepts from the cloud
Performance Analysis: new tools and concepts from the cloudPerformance Analysis: new tools and concepts from the cloud
Performance Analysis: new tools and concepts from the cloud
 
Broken Performance Tools
Broken Performance ToolsBroken Performance Tools
Broken Performance Tools
 
COMPUTER COMPONENTS
COMPUTER COMPONENTSCOMPUTER COMPONENTS
COMPUTER COMPONENTS
 
The New Systems Performance
The New Systems PerformanceThe New Systems Performance
The New Systems Performance
 
test
testtest
test
 
LISA2019 Linux Systems Performance
LISA2019 Linux Systems PerformanceLISA2019 Linux Systems Performance
LISA2019 Linux Systems Performance
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
 
Network operating systems
Network operating systemsNetwork operating systems
Network operating systems
 
Network operating systems
Network operating systemsNetwork operating systems
Network operating systems
 
Introduction to Embedded System
Introduction to Embedded SystemIntroduction to Embedded System
Introduction to Embedded System
 
Performance tunning
Performance tunningPerformance tunning
Performance tunning
 
Extreme Linux Performance Monitoring and Tuning
Extreme Linux Performance Monitoring and TuningExtreme Linux Performance Monitoring and Tuning
Extreme Linux Performance Monitoring and Tuning
 
PLNOG16: Obsługa 100M pps na platformie PC , Przemysław Frasunek, Paweł Mała...
PLNOG16: Obsługa 100M pps na platformie PC, Przemysław Frasunek, Paweł Mała...PLNOG16: Obsługa 100M pps na platformie PC, Przemysław Frasunek, Paweł Mała...
PLNOG16: Obsługa 100M pps na platformie PC , Przemysław Frasunek, Paweł Mała...
 
QCon 2015 Broken Performance Tools
QCon 2015 Broken Performance ToolsQCon 2015 Broken Performance Tools
QCon 2015 Broken Performance Tools
 
UKOUG, Lies, Damn Lies and I/O Statistics
UKOUG, Lies, Damn Lies and I/O StatisticsUKOUG, Lies, Damn Lies and I/O Statistics
UKOUG, Lies, Damn Lies and I/O Statistics
 
Webinar: Untethering Compute from Storage
Webinar: Untethering Compute from StorageWebinar: Untethering Compute from Storage
Webinar: Untethering Compute from Storage
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 

Más de Brendan Gregg

YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing PerformanceBrendan Gregg
 
IntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingIntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingBrendan Gregg
 
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Brendan Gregg
 
Systems@Scale 2021 BPF Performance Getting Started
Systems@Scale 2021 BPF Performance Getting StartedSystems@Scale 2021 BPF Performance Getting Started
Systems@Scale 2021 BPF Performance Getting StartedBrendan Gregg
 
Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Brendan Gregg
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedBrendan Gregg
 
re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflixre:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at NetflixBrendan Gregg
 
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareUM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareBrendan Gregg
 
LPC2019 BPF Tracing Tools
LPC2019 BPF Tracing ToolsLPC2019 BPF Tracing Tools
LPC2019 BPF Tracing ToolsBrendan Gregg
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
YOW2018 CTO Summit: Working at netflix
YOW2018 CTO Summit: Working at netflixYOW2018 CTO Summit: Working at netflix
YOW2018 CTO Summit: Working at netflixBrendan Gregg
 
eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019Brendan Gregg
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixBrendan Gregg
 
NetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityNetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityBrendan Gregg
 
ATO Linux Performance 2018
ATO Linux Performance 2018ATO Linux Performance 2018
ATO Linux Performance 2018Brendan Gregg
 
Linux Performance 2018 (PerconaLive keynote)
Linux Performance 2018 (PerconaLive keynote)Linux Performance 2018 (PerconaLive keynote)
Linux Performance 2018 (PerconaLive keynote)Brendan Gregg
 
How Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for PerformanceHow Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for PerformanceBrendan Gregg
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
 

Más de Brendan Gregg (20)

YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing Performance
 
IntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingIntelON 2021 Processor Benchmarking
IntelON 2021 Processor Benchmarking
 
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
 
Systems@Scale 2021 BPF Performance Getting Started
Systems@Scale 2021 BPF Performance Getting StartedSystems@Scale 2021 BPF Performance Getting Started
Systems@Scale 2021 BPF Performance Getting Started
 
Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
 
re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflixre:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflix
 
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareUM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
 
LPC2019 BPF Tracing Tools
LPC2019 BPF Tracing ToolsLPC2019 BPF Tracing Tools
LPC2019 BPF Tracing Tools
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
YOW2018 CTO Summit: Working at netflix
YOW2018 CTO Summit: Working at netflixYOW2018 CTO Summit: Working at netflix
YOW2018 CTO Summit: Working at netflix
 
eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
BPF Tools 2017
BPF Tools 2017BPF Tools 2017
BPF Tools 2017
 
NetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityNetConf 2018 BPF Observability
NetConf 2018 BPF Observability
 
FlameScope 2018
FlameScope 2018FlameScope 2018
FlameScope 2018
 
ATO Linux Performance 2018
ATO Linux Performance 2018ATO Linux Performance 2018
ATO Linux Performance 2018
 
Linux Performance 2018 (PerconaLive keynote)
Linux Performance 2018 (PerconaLive keynote)Linux Performance 2018 (PerconaLive keynote)
Linux Performance 2018 (PerconaLive keynote)
 
How Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for PerformanceHow Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for Performance
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
 

Último

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Último (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Analyzing OS X Systems Performance with the USE Method

  • 1. Analyzing OS X Systems Performance with the USE Method Brendan Gregg, Senior Performance Architect, Netflix March, 2014
  • 2. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge Darwin Operating System HardwareXNUKernel Applications OSFMKBSD Ethernet IP TCP/UDP Block Devices HFS+/... VFS Sockets System Libraries System Call Interface Scheduler Virtual! Memory I/O Kit Find the Bottleneck Disk Disk Port Port DRAM Southbridge DMI GPU Other Devices Device Drivers
  • 3. This Talk • Summarizes casual to serious performance analysis of OS X • From the systems perspective, not the application • Many application issues can be found easily this way • Covering not just current tools, but suggestions for future work • May change how you think about performance!

  • 4. whoami • Senior Performance Architect at Netflix • Primary author of the DTrace book • Wrote many DTrace scripts included with OS X.
 Eg: dtruss, iosnoop, iotop, opensnoop, execsnoop,
 procsystime, bitesize.d, seeksize.d, setuids.d, etc... • These were ported and enhanced by Apple engineering (thanks!) • Created the USE method and USE method checklist for OS X
  • 5. • The Tools Method • The USE Method • Future work Agenda
  • 7. The Tools Method • A tool-based performance analysis approach, commonly followed today. For reference, I've called it the "Tools Method". • 1. List available performance tools • 2. For each tool, list its useful metrics • 3. For each metric, list possible interpretation • Simple, useful, but analysis is limited to what the tools provide easily
  • 8. Tool Examples • Activity Monitor • atMonitor, Temperature Monitor Lite • Command Line • DTrace • Instruments
  • 9. Activity Monitor • High level process and
 system sumaries.A GUI
 version of top(1) • Table shows processes
 by %CPU, memory • CPU load over time • Quit, info, and system
 diagnosis buttons
  • 10. Activity Monitor Network • Quick way to see current 
 and recent network
 throughput • Like the CPU summary,
 shows aggregate device
 stats, and not per-device
  • 11. Activity Monitor CPU Usage • Per-CPU utilization from previous 0.5 - 5 seconds (tunable) • Handy to leave running. Look for single hot CPUs/threads
  • 12. Activity Monitor Floating CPU Window • Earlier OS X also had a compact version (gone in Mavericks) • Was nice, but what I really want is a compact visualization for both per-CPU and historical data
  • 13. Activity Monitor CPU/Disk Suggestion • Could show both per-device and history using a utilization heat map: • http://dtrace.org/blogs/brendan/2011/12/18/visualizing-device-utilization/
  • 14. Activity Monitor Sample Process • The cog button ("System
 diagnostics options") has a
 "Sample process" option for
 profiling CPU code paths • Explains %CPU usage • Although output usually very
 long and time consuming to
 read (see scroll bar):
  • 15. Activity Monitor Flame Graphs ? • Suggestion: include a
 Flame Graph view • Visualizes entire
 profile output in
 one screen • http://github.com/
 brendangregg/
 FlameGraph
  • 16. atMonitor • 3rd party app. Version 2.7b crashes for me if "Top Window" is visible. • Shows many useful metrics: per-CPU, RAM, GPU, per-disk, and per- network interface utilization perentages with histories. • Currently the easiest way to see GPU, disk, and network utilization. • Utilization is easy to interpret. I/O per second is not.
  • 17. Temperature Monitor Lite • Another 3rd party application • Easy way to infer GPU utilization • Normal: • Video:
  • 18. Command Line • Accessed via the Terminal application • Numerous performance tools available, from UNIX/BSD/OSX • Eg, the uptime(1) command shows recent and historic CPU load: $ uptime 14:36 up 43 days, 2:39, 30 users, load averages: 0.72 1.02 1.29 • There numbers are the 1, 5, and 15 minute load averages.Values are really constants in an exponential decay moving sum. • Interpret: if average > number of CPUs, then CPUs are overloaded
  • 19. Command Line: top $ top -o cpu Processes: 272 total, 4 running, 268 sleeping, 1546 threads 14:47:36 Load Avg: 1.14, 0.75, 0.95 CPU usage: 13.95% user, 2.78% sys, 83.26% idle SharedLibs: 12M resident, 5112K data, 0B linkedit. MemRegions: 339218 total, 6689M resident, 184M private, 2153M shared. PhysMem: 3429M wired, 6502M active, 5910M inactive, 15G used, 537M free. VM: 552G vsize, 1052M framework vsize, 111312590(1) pageins, 1437348(0) pageouts Networks: packets: 120030109/127G in, 70582570/38G out. Disks: 22089197/1050G read, 26756359/1163G written. ! PID COMMAND %CPU TIME #TH #WQ #PORT #MREGS RPRVT RSHRD RSIZE 602 bash 100.0 47:42.28 1/1 0 21 27 236K 816K 760K 94370 top 17.2 00:03.77 1/1 0 24 39 4368K 216K 5116K 52617 firefox 6.3 47:30:58 45/1 2 576- 177307+ 1984M+ 200M 2530M+ 92489- Google Chrom 2.2 13:31.85 34 2 530 2454 273M 271M 734M [...] • top(1): high level process and system summary: hey...
  • 20. Command Line: vm_stat $ vm_stat 1 Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%) free active spec inactive wire faults copy 0fill reactive pageins pageout 101297 1662K 29920 1509998 888520 17650M 106072K 15926M 6833792 111312K 1437348 100919 1658K 29920 1509998 893230 2851 0 2043 0 0 0 101183 1658K 29918 1509998 893169 143 0 87 0 1 0 100517 1658K 29921 1509998 893354 396 3 136 0 2 0 96590 1657K 29923 1514414 894426 5888 94 5146 0 2 0 93184 1662K 28486 1514414 894484 14183 117 12521 0 0 0 91224 1663K 28486 1514414 894886 5683 0 3454 0 0 0 89195 1649K 29924 1514413 909225 11570 199 10050 0 4 0 87550 1636K 29917 1514155 923179 24486 1432 12009 0 2134 0 61596 1644K 28309 1515551 941688 49395 1446 46127 0 4941 0 52932 1669K 28442 1515663 925755 70618 1731 53131 0 1221 0 76395 1681K 28417 1515685 889983 30514 0 28072 0 428 0 73520 1679K 28449 1515777 894905 20082 17 18077 0 107 0 60335 1684K 29073 1515560 903152 39696 38 35535 0 1309 0 [...] • vm_stat(1): virtual memory statistics, including free memory, paging
  • 21. Command Line: iostat $ iostat 1 disk0 disk2 cpu load average KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m 47.03 13 0.60 96.67 0 0.00 5 2 92 0.94 1.01 0.99 972.42 19 18.02 128.00 141 17.60 2 3 95 0.94 1.01 0.99 315.60 10 3.08 128.00 24 3.00 6 2 92 0.94 1.01 0.99 4.00 1 0.00 0.00 0 0.00 6 2 92 0.94 1.01 0.99 1024.00 8 7.99 128.00 69 8.61 6 2 92 0.94 1.01 0.99 1024.00 18 17.97 128.00 143 17.85 2 2 95 0.86 0.99 0.99 1024.00 17 16.98 128.00 142 17.72 2 2 96 0.86 0.99 0.99 165.27 272 43.84 127.13 146 18.10 6 5 89 0.95 1.01 0.99 1024.00 18 17.98 128.00 143 17.85 2 2 96 0.95 1.01 0.99 [...] • iostat(1): block device I/O statistics. Disks, USB drives. • No percent utilization/busy, like other OSes? Makes it hard to interpret.
  • 22. Command Line: netstat $ netstat -iI en0 1 input (en0) output packets errs bytes packets errs bytes colls 237 0 296232 167 0 18555 0 26 0 19374 16 0 4617 0 5 0 661 1 0 2020 0 1601 0 2231882 535 0 50072 0 3519 0 5027348 1005 0 62086 0 1362 0 1923223 627 0 39699 0 1338 0 1866404 296 0 17166 0 878 0 1203230 182 0 14803 0 8 0 1302 11 0 2900 0 [...] • netstat(1): various network statistics. -i for interface stats: • No percent utilization, but can figure it out: throughput / known max
  • 23. Command Line: tcpdump $ tcpdump -n tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes 18:00:55.228744 IP 10.0.1.92.53 > 10.0.1.148.49228: 26359 1/0/0 A 69.192.253.15 (81) 18:00:55.311056 ARP, Reply 10.0.1.162 is-at 2c:54:2d:a4:25:4c, length 28 18:00:55.342793 IP 74.125.28.189.443 > 10.0.1.148.62998: Flags [P.], seq 3544891232:3544891287, ack 3832081572, win 661, options [nop,nop,TS val 2936982235 ecr 2331923799], length 55 18:00:55.342933 IP 10.0.1.148.62998 > 74.125.28.189.443: Flags [.], ack 55, win 8188, options [nop,nop,TS val 2331932237 ecr 2936982235], length 0 18:00:56.477029 IP 10.0.1.148.50359 > 67.195.141.201.443: Flags [P.], seq 696365506:696365533, ack 1903095540, win 16384, length 27 18:00:56.477158 IP 10.0.1.148.50359 > 67.195.141.201.443: Flags [F.], seq 27, ack 1, win 16384, length 0 [...] • tcpdump(1): sniff and examine network packets: • Also dump to a file and examine later. Does incur overhead.
  • 24. Observability So Far... • We can see all the things! • Not really...
  • 25. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge Darwin Operating System Hardware XNUKernel Applications OSFMKBSD Ethernet IP TCP/UDP Block Devices HFS+/... VFS Sockets System Libraries System Call Interface Scheduler Virtual! Memory Device Drivers I/O Kit Disk Disk Port Port DRAM Southbridge DMI GPU Other Devices Observability So Far... iostat netstat netstat ActivityMonitor atMonitor vm_stat top ActivityMonitor atMonitor top ActivityMonitor Temp.Monitor tcpdump
  • 26. DTrace • Programmable, real-time, dynamic
 and static tracing • Write your own one-liners and
 scripts, or use other people's;
 including those in /usr/bin • There is a great book about it...
  • 27. DTrace: Scripts $ man -k dtrace bitesize.d(1m) - analyse disk I/O size by process. Uses DTrace cpuwalk.d(1m) - Measure which CPUs a process runs on. Uses DTrace creatbyproc.d(1m) - snoop creat()s by process name. Uses DTrace dappprof(1m) - profile user and lib function usage. Uses DTrace dapptrace(1m) - trace user and library function usage. Uses DTrace diskhits(1m) - disk access by file offset. Uses DTrace dispqlen.d(1m) - dispatcher queue length by CPU. Uses DTrace dtrace(1) - generic front-end to the DTrace facility dtruss(1m) - process syscall details. Uses DTrace errinfo(1m) - print errno for syscall fails. Uses DTrace execsnoop(1m) - snoop new process execution. Uses DTrace [...] • Over 40 DTrace scripts are shipped with OS X (which I mostly wrote originally). Listing them:
  • 28. DTrace: iosnoop $ iosnoop UID PID D BLOCK SIZE COMM PATHNAME 503 176 R 148471184 8192 SystemUIServer ??/vm/swapfile10 503 176 R 835310312 4096 SystemUIServer ??/vm/swapfile4 503 92489 W 746204600 61440 Google Chrome ??/Chrome/.com.google.Chrome.hw1Inp 503 92489 W 746204720 23472 Google Chrome ??/Default/.com.google.Chrome.76k4tG 0 19 W 425711304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl 0 19 W 57246896 4096 syslogd ??/DiagnosticMessages/StoreData 0 19 W 425710304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl 503 52617 W 214894232 4096 firefox ??/iw4rbel9.default/_CACHE_CLEAN_ 0 19 W 57246896 4096 syslogd ??/DiagnosticMessages/StoreData 0 19 W 425710304 4096 syslogd ??/DiagnosticMessages/2014.02.14.asl [...] • iosnoop(1m): trace block device I/O • Identify processes and files causing disk I/O
  • 29. DTrace: hfsslower.d $ ~/dtbook_scripts/Chap5/hfsslower.d 10 TIME PROCESS D KB ms FILE 2014 Feb 14 17:35:59 Terminal R 5751 16 data.data 2014 Feb 14 17:35:59 Terminal R 6166 17 data.data 2014 Feb 14 17:35:59 Terminal W 11921 15 data.data [...] • hfsslower.d: trace HFS calls slower than a threshold. Eg, 10 ms: • Traces all application I/O to the file system, not just disk I/O • Script is on http://www.dtracebook.com
  • 30. DTrace: execsnoop $ execsnoop -v STRTIME UID PID PPID ARGS 2014 Feb 14 19:40:55 503 94835 551 man 2014 Feb 14 19:40:55 503 94835 551 man 2014 Feb 14 19:40:55 503 94841 94837 groff 2014 Feb 14 19:40:55 503 94839 94837 tbl 2014 Feb 14 19:40:55 503 94840 94838 cat 2014 Feb 14 19:40:56 503 94845 94841 grotty 2014 Feb 14 19:40:56 503 94844 94841 troff 2014 Feb 14 19:40:56 503 94843 94842 less 2014 Feb 14 19:40:58 503 94846 92489 Google Chrome He 2014 Feb 14 19:41:03 503 94847 92489 Google Chrome He [...] • execsnoop(1m): trace process execution • Shows what programs are launched
  • 31. DTrace: dtruss $ dtruss -en bash PID/THRD ELAPSD SYSCALL(args) = return 475/0x1199: 87917 read(0x0, "a0", 0x1) = 1 0 475/0x1199: 12 write_nocancel(0x2, "a0", 0x1) = 1 0 475/0x1199: 3 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0 475/0x1199: 2 sigaltstack(0x0, 0x7FFF55F898D0, 0x0) = 0 0 475/0x1199: 48163 read(0x0, "t0", 0x1) = 1 0 475/0x1199: 10 write_nocancel(0x2, "t0", 0x1) = 1 0 475/0x1199: 3 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0 475/0x1199: 2 sigaltstack(0x0, 0x7FFF55F898D0, 0x0) = 0 0 475/0x1199: 12 write_nocancel(0x2, "m0", 0x1) = 1 0 475/0x1199: 2 sigprocmask(0x1, 0x0, 0x7FFF55F898E0) = 0x0 0 [...] • dtruss(1m): trace system calls, from one or many processes • dtruss is a script - edit it to add/modify it as desired
  • 32. DTrace: sotop $ sotop PROCESS PID READS WRITES READ_KB WRITE_KB CPU kernel_task 0 0 0 0 0 475 firefox 52617 205 14 84 22 118 Terminal 165 0 0 0 0 35 WindowServer 89 0 0 0 0 34 SIDPLAY 51232 0 0 0 0 31 Google Chrome H 92513 6 12 0 1 14 Google Chrome H 94477 2 1 0 0 13 clear 94909 0 0 0 0 13 Google Chrome 92489 16 5 0 0 12 sh 94909 0 0 0 0 12 [...] • sotop: summarize socket I/O by-process, top-style: • Also from the DTrace book.
  • 33. Instruments • Advanced analysis GUI • Includes many
 "Instruments", which
 profile applications
 in different ways: • Data sources include
 DTrace, CPU counters
  • 35. Instruments Low Level CPU Counters • Performance monitor
 counter (PMC) and
 performance monitor
 interrupts can be
 instrumented • Hard work, but can be
 used to understand
 bus and interconnect
 activity
  • 36. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge XNUKernel Applications OSFMKBSD Ethernet IP TCP/UDP Block Devices HFS+/... VFS Sockets System Libraries System Call Interface Scheduler Virtual! Memory Device Drivers I/O Kit Disk Disk Port Port DRAM Southbridge DMI GPU Other Devices Observability So Far... iostat netstat netstat ActivityMonitor atMonitor vm_stat top ActivityMonitor atMonitor top ActivityMonitor Temp.Monitor dtruss hfsslower iosnoop execsnoopsotop tcpdump Instruments dtrace Instruments
  • 37. Tools Method in Practice • Tools Method provides reasonable coverage • Some observability gaps, some uneven coverage • Can improve coverage by adding more tools: ps, ping, traceroute, latency, df, sysctl, plockstat, opensnoop, dispqlen.d, runocc.d, nfsstat, iopending, soconnect_mac.d, httpdstat.d, sc_usage, fs_usage, ... • I could keep covering tools for the rest of this talk...
  • 38. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge XNUKernel Applications OSFMKBSD Ethernet IP TCP/UDP Block Devices HFS+/... VFS Sockets System Libraries System Call Interface Scheduler Virtual! Memory Disk Disk Port DRAM Southbridge DMI GPU Other Devices iostat netstat netstat ActivityMonitor atMonitor vm_stat top ActivityMonitor atMonitor top,ps ActivityMonitor Temp.Monitor opensnoop hfsslower.d df,nfstat iosnoop iopending execsnoopsotop tcpdump dapptrace ping Port traceroute plockstat dtruss,sc_usage errinfo,kill.d dispqlen.d runocc.d latency soconnect_mac.d,soaccept_mac.d httpdstat.d fs_usage priclass.d pridist.d bitesize.d seeksize.d maclife.d macvfssnoop.d Most DTrace scripts are in /usr/bin Some are from my DTrace book and are available online dtrace Instruments Instruments Custom Instruments using
 CPU counters/interrupts can
 be added for bus observability I/O Kit Device Drivers
  • 39. The Focus on Tools • Useful, however, learning tools & metrics becomes laborious. • Still limited by what the tools provide, or provide easily. • You can try to approach this in a different way...
  • 40. Instead of starting with the tools, start with the questions
  • 42. The USE Method • For every resource, check: • 1. Utilization • 2. Saturation • 3. Errors
  • 43. The USE Method • For every resource, check: • 1. Utilization: time resource was busy, or degree used • 2. Saturation: degree of queued extra work • 3. Errors: any errors
  • 44. Queueing System Saturation Utilization Errors X • If it helps, consider
 all resources as a
 a queueing system: • Also check errors
  • 45. Hardware Resources • CPUs • Main Memory • Network Interfaces • Storage Devices • Controllers, Interconnects • Find the functional diagram and examine every item in the data path...
  • 46. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge Hardware Functional Diagram Disk Disk Port Port DRAM Southbridge DMI GPU Other Devices • For each check: • 1. Utilization • 2. Saturation • 3. Errors
  • 47. USE Method Checklists • Build a checklist for all combinations, identifying tools/metrics to use
  • 48. OS X Checklist Resource Type Metric CPU Utilization CPU Saturation CPU Errors
  • 49. OS X Checklist Resource Type Metric CPU Utilization system-wide: iostat 1, "us" + "sy"; per-cpu: DTrace [1];Activity Monitor → CPU Usage or Floating CPU Window; per-process:top -o cpu, "%CPU";Activity Monitor → Activity Monitor, "%CPU"; ... CPU Saturation system-wide: uptime, "load averages" > CPU count; latency, "SCHEDULER" and "INTERRUPTS"; per-cpu: dispqlen.d (DTT), non-zero "value"; runocc.d (DTT), non-zero "%runocc"; per- process: Instruments → Thread States, "On run queue"; DTrace [2] CPU Errors dmesg; /var/log/system.log; Instruments → Counters, for PMC and whatever error counters are supported (eg, thermal throttling)
  • 50. OS X Checklist Resource Type Metric CPU Utilization system-wide: iostat 1, "us" + "sy"; per-cpu: DTrace [1];Activity Monitor → CPU Usage or Floating CPU Window; per-process:top -o cpu, "%CPU";Activity Monitor → Activity Monitor, "%CPU"; ... CPU Saturation system-wide: uptime, "load averages" > CPU count; latency, "SCHEDULER" and "INTERRUPTS"; per-cpu: dispqlen.d (DTT), non-zero "value"; runocc.d (DTT), non-zero "%runocc"; per- process: Instruments → Thread States, "On run queue"; DTrace [2] CPU Errors dmesg; /var/log/system.log; Instruments → Counters, for PMC and whatever error counters are supported (eg, thermal throttling)
  • 51. OS X Checklist, cont. Resource Type Metric Memory Capacity Utilization Memory Capacity Saturation " Errors
  • 52. OS X Checklist, cont. Resource Type Metric Memory Capacity Utilization system-wide: vm_stat 1, main memory free = "free" + "inactive", in units of pages;Activity Monitor → Activity Monitor → System Memory, "Free" for main memory; per-process: top -o rsize, "RSIZE" is resident main memory size, "VSIZE" is virtual memory size; ps -alx, "RSS" is resident set size, "SZ" is virtual memory size; ps aux similar (legacy format) Memory Capacity Saturation system-wide: vm_stat 1, "pageout"; per-process: anonpgpid.d (DTT), DTrace vminfo:::anonpgin [3] (frequent anonpgin == pain); Instruments → Memory Monitor, high rate of "Page Ins" and "Page Outs"; sysctl vm.memory_pressure [4] ! " Errors System Information → Hardware → Memory, "Status" for physical failures; DTrace failed malloc()s
  • 53. OS X Checklist, cont. Resource Type Metric Memory Capacity Utilization system-wide: vm_stat 1, main memory free = "free" + "inactive", in units of pages;Activity Monitor → Activity Monitor → System Memory, "Free" for main memory; per-process: top -o rsize, "RSIZE" is resident main memory size, "VSIZE" is virtual memory size; ps -alx, "RSS" is resident set size, "SZ" is virtual memory size; ps aux similar (legacy format) Memory Capacity Saturation system-wide: vm_stat 1, "pageout"; per-process: anonpgpid.d (DTT), DTrace vminfo:::anonpgin [3] (frequent anonpgin == pain); Instruments → Memory Monitor, high rate of "Page Ins" and "Page Outs"; sysctl vm.memory_pressure [4] ! " Errors System Information → Hardware → Memory, "Status" for physical failures; DTrace failed malloc()s
  • 54. OS X Checklist, cont. • Full list: http://www.brendangregg.com/USEmethod/use-macosx.html • Includes
 references
 from earlier
 tables

  • 55. Software Resources • Can be studied using USE metrics as well, if possible • OS X Checklist includes some example software resources: • Processes, file descriptors, kernel mutexes, user-level mutexes
  • 56. Mutex Lock • Can you think of what these could mean for a mutex lock?: • Utilization • Saturation • Errors
  • 57. Mutex Lock • Can you think of what these could mean for a mutex lock?: • Utilization: held time per second • Saturation: measure of contention time or waiters • Errors: EDEADLK, EINVAL
  • 59. Future Work • Tools/Metrics for USE Method • More methodologies, and then tools
  • 60. USE Method Tools • Tools can be developed to fetch USE metrics more easily • Especially for busses and interconnects • Would love to see USE metrics in Activity Monitor
  • 61. USE Method New Uses • Can be applied new areas, developing new metrics • May not always work, but worth trying • Find a functional diagram of your system, application, or environment, and look for U.S.E. metrics for each component
  • 62. Device Interconnect (PCIe/USB) Interface Transports I/O Controller Network Controller FSB Memory! Bus CPU Northbridge Darwin Operating System HardwareXNUKernel Disk Disk Port Port DRAM Southbridge DMI GPU Other! Devices USE Metrics for all of: Applications OSFMKBSD Ethernet IP TCP/UDP Block Devices HFS+/... VFS Sockets System Libraries System Call Interface Scheduler Virtual! Memory I/O Kit Device Drivers
  • 63. Stranger Example:TCP $ netstat -s tcp: 80444499 packets sent 28706719 data packets (3613656050 bytes) 76599 data packets (65712152 bytes) retransmitted 68 resends initiated by MTU discovery 41687640 ack-only packets (248964 delayed) 0 URG only packets 0 window probe packets 9286129 window update packets 707685 control packets 0 data packets sent after flow control 177149270 packets received 16296459 acks (for 3602941580 bytes) 556237 duplicate acks 0 acks for unsent data 154775303 packets (1214952475 bytes) received in-sequence 200501 completely duplicate packets (151553377 bytes) 1884 old duplicate packets 79 packets with some dup. data (17270 bytes duped) 6102493 out-of-order packets (4236017281 bytes) 67 packets (0 bytes) of data after window 0 window probes 14180 window update packets 72825 packets received after close 85 bad resets 0 discarded for bad checksums 0 discarded for bad header offset fields 0 discarded because packet too short 378961 connection requests 613 connection accepts 37 bad connection attempts 0 listen queue overflows 332688 connections established (including accepts) 381180 connections closed (including 13038 drops) 14527 connections updated cached RTT on close 14527 connections updated cached RTT variance on close 5495 connections updated cached ssthresh on close 1721 embryonic connections dropped 16204052 segments updated rtt (of 8674926 attempts) 374184 retransmit timeouts 4465 connections dropped by rexmit timeout 0 connections dropped after retransmitting FIN 91 persist timeouts 0 connections dropped by persist timeout 12784 keepalive timeouts 262 keepalive probes sent 1214 connections dropped by keepalive 1312411 correct ACK header predictions 152849516 correct data packet header predictions 17244 SACK recovery episodes 21329 segment rexmits in SACK recovery episodes 25852298 byte rexmits in SACK recovery episodes 180630 SACK options (SACK blocks) received 5682514 SACK options (SACK blocks) sent 0 SACK scoreboard overflow [...] • "netstat -s" output has over 50 metrics
 for TCP • Do you understand them all? • Could USE metrics provide a high level
 summary, treating TCP as a software
 resource? (might be a stretch)
  • 64. USE Method:TCP • TCP as a software resource metrics: • Utilization • Saturation • Errors
  • 65. USE Method:TCP • TCP as a software resource metrics: • Utilization: time data was buffered per second • Saturation: listen queue overflows • Errors: bad connection attempts, bad resets, bad checksums, ... • I think I'd classify retransmits and duplicates as errors.
  • 66. Other Methodologies • Other methodologies include: • Drill Down Analysis Method • Workload Characterization • Thread State Analysis (TSA) Method • These too can pose questions that tools then answer
  • 67. References • http://www.brendangregg.com/USEmethod/use-macosx.html • http://www.brendangregg.com/usemethod.html • http://dtracebook.com - has DTrace book scripts online • http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/ • http://dtrace.org/blogs/brendan/2011/12/18/visualizing-device-utilization/ - utilization heat maps • http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html - flame graphs