Professional Documents
Culture Documents
Thenewsystemsperformance 131014005720 Phpapp01
Thenewsystemsperformance 131014005720 Phpapp01
Thenewsystemsperformance 131014005720 Phpapp01
New
Brendan Gregg
(and many others)
Prentice Hall, 2013
A brief talk for: A Midsummer Night’s System, San Francisco, July 2013
Systems Performance
• Analysis of apps to metal. Think LAMP not AMP.
• An activity for everyone: from casual to full time.
• The basis is Operating System
Metal
1990’s Systems Performance
* Proprietary Unix, closed source, static tools
$ vmstat 1
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr cd cd s0 s5 in sy cs us sy id
0 0 0 8475356 565176 2 8 0 0 0 0 1 0 0 -0 13 378 101 142 0 0 99
1 0 0 7983772 119164 0 0 0 0 0 0 0 224 0 0 0 1175 5654 1196 1 15 84
0 0 0 8046208 181600 0 0 0 0 0 0 0 322 0 0 0 1473 6931 1360 1 7 92
[...]
operating system
applications
libraries
syscalls
kernel
2010’s Operating System Internals
• Study the source, observe in production with dynamic tracing
operating system
applications
libraries
syscalls
kernel
1990’s Systems Observability
For example, Solaris 9:
apptrace netstat
Operating System Hardware
sotruss
Applications cpustat
truss lockstat cputrack
DBs, all server types, ...
System Libraries mpstat
kstat System Call Interface CPU
VFS Sockets Scheduler Interconnect
CPU
Solaris Kernel
prstat 1
File Systems TCP/UDP ps
Volume Managers IP Virtual Memory
Block Device Interface Ethernet Memory Bus
vmstat
Device Drivers
DRAM
I/O Bus snoop
iostat
I/O Bridge Expander Interconnect
netstat
kstat
I/O Controller Network Controller Various:
Interface Transports sar
Disk Disk Port Port kstat
2010’s Systems Observability
For example, SmartOS:
dtrace CPU
prstat 1
File Systems TCP/UDP ps
Volume Managers IP Virtual Memory
Block Device Interface Ethernet Memory Bus
vmstat
Device Drivers
DRAM
I/O Bus snoop intrstat
iostat
I/O Bridge Expander Interconnect
nicstat
kstat
I/O Controller Network Controller Various:
Interface Transports sar
Disk Disk Port Port kstat
Dynamic Tracing turned on the light
• Example DTrace scripts from the DTraceToolkit, DTrace book, ...
cifs*.d, iscsi*.d :Services hotuser, umutexmax.d, lib*.d
nfsv3*.d, nfsv4*.d Language Providers: node*.d, erlang*.d, j*.d, js*.d
ssh*.d, httpd*.d php*.d, pl*.d, py*.d, rb*.d, sh*.d
Databases: mysql*.d, postgres*.d, redis*.d, riak*.d
fswho.d, fssnoop.d opensnoop, statsnoop
sollife.d errinfo, dtruss, rwtop
solvfssnoop.d Applications rwsnoop, mmap.d, kill.d
DBs, all server types, ... shellsnoop, zonecalls.d
dnlcsnoop.d System Libraries weblatency.d, fddist
zfsslower.d
ziowait.d System Call Interface
priclass.d, pridist.d
ziostacks.d VFS Sockets Scheduler cv_wakeup_slow.d
spasync.d displat.d, capslat.d
metaslab_free.d File Systems TCP/UDP
Volume Managers IP Virtual minfbypid.d
Memory pgpginbypid.d
iosnoop, iotop Block Device Interface Ethernet
disklatency.d macops.d, ixgbecheck.d
Device Drivers ngesnoop.d, ngelink.d
satacmds.d
satalatency.d
scsicmds.d soconnect.d, soaccept.d, soclose.d, socketio.d, so1stbyte.d
scsilatency.d sotop.d, soerror.d, ipstat.d, ipio.d, ipproto.d, ipfbtsnoop.d
sdretry.d, sdqueue.d ipdropper.d, tcpstat.d, tcpaccept.d, tcpconnect.d, tcpioshort.d
tcpio.d, tcpbytes.d, tcpsize.d, tcpnmap.d, tcpconnlat.d, tcp1stbyte.d
ide*.d, mpt*.d tcpfbtwatch.d, tcpsnoop.d, tcpconnreqmaxq.d, tcprefused.d
tcpretranshosts.d, tcpretranssnoop.d, tcpsackretrans.d, tcpslowstart.d
tcptimewait.d, udpstat.d, udpio.d, icmpstat.d, icmpsnoop.d
Actual DTrace Example
• Given an interesting kernel function, eg, ZFS SPA sync:
usr/src/uts/common/fs/zfs/spa.c:
/*
* Sync the specified transaction group. New blocks may be dirtied as
* part of the process, so we iterate until it converges.
*/
void
spa_sync(spa_t *spa, uint64_t txg)
{
dsl_pool_t *dp = spa->spa_dsl_pool;
[...]