Top Banner
Now You See Me Too Visual Tooling for Advanced Systems Analysis Suchakra Sharma 2 nd Nov 2017 - San Francisco, CA
90

Now You See Me Too Visual Tooling for Advanced Systems ...

Mar 23, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Now You See Me Too Visual Tooling for Advanced Systems ...

Now You See Me Too

Visual Tooling for Advanced Systems AnalysisSuchakra Sharma2nd Nov 2017 - San Francisco, CA

Page 2: Now You See Me Too Visual Tooling for Advanced Systems ...

whoami

1 Suchakrapani Datt Sharma

Suchakra- Staff Scientist, ShiftLeft Inc.- PhD, DORSAL Lab, École Polytechnique de Montréal (University of Montréal)- Loves tracing, security, performance analysis, low-level hardware stuff, poutine and samosas- @tuxology

Page 3: Now You See Me Too Visual Tooling for Advanced Systems ...

whoami

1 Suchakrapani Datt Sharma

Suchakra- Staff Scientist, ShiftLeft Inc.- PhD, DORSAL Lab, École Polytechnique de Montréal (University of Montréal)- Loves tracing, security, performance analysis, low-level hardware stuff, poutine and samosas- @tuxology

Page 4: Now You See Me Too Visual Tooling for Advanced Systems ...

whoami

1 Suchakrapani Datt Sharma

Suchakra- Staff Scientist, ShiftLeft Inc.- PhD, DORSAL Lab, École Polytechnique de Montréal (University of Montréal)- Loves tracing, security, performance analysis, low-level hardware stuff, poutine and samosas- @tuxology

Page 5: Now You See Me Too Visual Tooling for Advanced Systems ...

whoami

1 Suchakrapani Datt Sharma

Suchakra- Staff Scientist, ShiftLeft Inc.- PhD, DORSAL Lab, École Polytechnique de Montréal (University of Montréal)- Loves tracing, security, performance analysis, low-level hardware stuff, poutine and samosas- @tuxology

Potatoes

Page 6: Now You See Me Too Visual Tooling for Advanced Systems ...

whoami

1 Suchakrapani Datt Sharma

Suchakra- Staff Scientist, ShiftLeft Inc.- PhD, DORSAL Lab, École Polytechnique de Montréal (University of Montréal)- Loves tracing, security, performance analysis, low-level hardware stuff, poutine and samosas- @tuxology

Potatoes

Visualization& Inference

Data Set{P,S}

Page 7: Now You See Me Too Visual Tooling for Advanced Systems ...

AgendaHumans and PerceptionSoftware Systems Visualization

- Analysis Taxonomy- Gathering Systems Data- Store and Visualize- Examples- Role of Colors

Sample Visuals- FlameGraphs/FlameCharts, Timelines, Heatmaps

DemosFuture Stuff

2 Suchakrapani Datt Sharma

Page 8: Now You See Me Too Visual Tooling for Advanced Systems ...

Get Inspired

Page 9: Now You See Me Too Visual Tooling for Advanced Systems ...

Humans and Perception

3 Suchakrapani Datt Sharma

Visual- Brain tirelessly processes information all the time.- Humans don’t just see or hear. They perceive and comprehend.

https://www.smithsonianmag.com/science-nature/rockart-ages-indonesian-cave-paintings-are-40000-years-old-180952970/

Hand stencils from a cave in Sulawesi, Indonesia (~40,000 years old)

Page 10: Now You See Me Too Visual Tooling for Advanced Systems ...

Humans and Perception

4 Suchakrapani Datt Sharma

Visual- Brain tirelessly processes information all the time.- Humans don’t just see or hear. They perceive and comprehend.

http://atlas.cern/updates/physics-briefing/photon-tagged-jet-quenching-quark-gluon-plasma

Event display of a lead-lead collision with a large transverse momentum photon (2017, CERN)

Page 11: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing DataBrief Historical Perspective

5 Suchakrapani Datt Sharma

A Brief History of Data VisualizationMichael Friendly : http://www.datavis.ca/papers/hbook.pdf

Planetary movements shown as cyclic Inclinations over timeY axis is inclination, X axis is time. (Unknown, 10th Century)

Earliest form of

time-series - data

is statistically less

rigorous

Page 12: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing DataBrief Historical Perspective

6 Suchakrapani Datt Sharma

Early prototype of bar Graphs, - The Latitude of Forms (Nicole Orseme, 1350)

Velocity of an object with time

Bar Charts

before they

were cool!

Page 13: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing DataBrief Historical Perspective

7 Suchakrapani Datt Sharma

A Brief History of Data VisualizationMichael Friendly : http://www.datavis.ca/papers/hbook.pdf

A New and Correct Chart Showing the Variations of the Compass in the Western & Southern Oceans (Edmund Halley, c. 1749)

Spatial Data –

Shipping and

cartography

pushed the limits!

Page 14: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing DataBrief Historical Perspective

8 Suchakrapani Datt Sharma

A New Chart of History (Joseph Priestly - 1769)

Time and Space,

development of

Timelines, colors and

their significance

Page 15: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing DataBrief Historical Perspective

9 Suchakrapani Datt Sharma

Imports and Exports from America in 18th Century (William Playfair)

Modern

Time-series and

line graphs,

statistical rigor

Page 16: Now You See Me Too Visual Tooling for Advanced Systems ...

This is not a presentation about Data Viz

Page 17: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Data

Stats & Data 101- OpenIntro Statistics & Advanced High School Statistics

- https://www.openintro.org/stat/

Classification and Process 101- Angela Zoss

- https://guides.library.duke.edu/c.php?g=289678&p=1930713- https://www.slideshare.net/amzoss/everything-data

- Udemy Course- https://www.udemy.com/introduction-to-data-visualization/

10 Suchakrapani Datt Sharma

Page 18: Now You See Me Too Visual Tooling for Advanced Systems ...

Software and Systems Visualizations

Page 19: Now You See Me Too Visual Tooling for Advanced Systems ...

Get Inspired

Page 20: Now You See Me Too Visual Tooling for Advanced Systems ...

Get Inspired...again

Page 21: Now You See Me Too Visual Tooling for Advanced Systems ...

[00:43:52.346539963] (+0.000001999) ubuntu-lisa kmem_cache_alloc: { cpu_id = 1 }, { call_site = 0xFFFFFFFF81211A3C, ptr = 0xFFFF880036C5BB00, bytes_req = 256, bytes_alloc = 256, gfp_flags = 37781696 }[00:43:52.346540662] (+0.000000699) ubuntu-lisa kmem_kmalloc: { cpu_id = 1 }, { call_site = 0xFFFFFFFF8139460C, ptr = 0xFFFF88003117DCC0, bytes_req = 24, bytes_alloc = 32, gfp_flags = 37781696 }[00:43:52.346546536] (+0.000005874) ubuntu-lisa kmem_cache_free: { cpu_id = 1 }, { call_site = 0xFFFFFFFF8121FCF4, ptr = 0xFFFF88007ADC6000 }[00:43:52.346547182] (+0.000000646) ubuntu-lisa syscall_exit_open: { cpu_id = 1 }, { ret = 3 }[00:43:52.346555162] (+0.000007980) ubuntu-lisa syscall_entry_newfstat: { cpu_id = 1 }, { fd = 3 }[00:43:52.346556962] (+0.000001800) ubuntu-lisa syscall_exit_newfstat: { cpu_id = 1 }, { ret = 0, statbuf = 140730433466352 }[00:43:52.346559844] (+0.000002882) ubuntu-lisa kmem_mm_page_alloc: { cpu_id = 1 }, { page = 0xFFFFEA0000B7A040, pfn = 188033, order = 0, gfp_flags = 37912778, migratetype = 1 }[00:43:52.346560899] (+0.000001055) ubuntu-lisa syscall_entry_read: { cpu_id = 1 }, { fd = 3, count = 4096 }[00:43:52.346563739] (+0.000002840) ubuntu-lisa syscall_exit_read: { cpu_id = 1 }, { ret = 19, buf = 94392247288688 }[00:43:52.346569483] (+0.000005744) ubuntu-lisa syscall_entry_read: { cpu_id = 1 }, { fd = 3, count = 4096 }[00:43:52.346570064] (+0.000000581) ubuntu-lisa syscall_exit_read: { cpu_id = 1 }, { ret = 0, buf = 94392247288688 }[00:43:52.346571514] (+0.000001450) ubuntu-lisa syscall_entry_close: { cpu_id = 1 }, { fd = 3 }[00:43:52.346572986] (+0.000001472) ubuntu-lisa syscall_exit_close: { cpu_id = 1 }, { ret = 0 }[00:43:52.346573738] (+0.000000752) ubuntu-lisa kmem_kfree: { cpu_id = 1 }, { call_site = 0xFFFFFFFF811B51FD, ptr = 0xFFFF88003117DCC0 }[00:43:52.346577658] (+0.000003920) ubuntu-lisa kmem_mm_page_alloc: { cpu_id = 1 }, { page = 0xFFFFEA0001DFA600, pfn = 491160, order = 0, gfp_flags = 37912778, migratetype = 1 }[00:43:52.346580365] (+0.000002707) ubuntu-lisa kmem_mm_page_alloc: { cpu_id = 1 }, { page = 0xFFFFEA0001443E40, pfn = 332025, order = 0, gfp_flags = 37912778, migratetype = 1 }[00:43:52.346583219] (+0.000002854) ubuntu-lisa syscall_entry_getuid: { cpu_id = 1 }, { }[00:43:52.346583541] (+0.000000322) ubuntu-lisa syscall_exit_getuid: { cpu_id = 1 }, { ret = 0 }

Page 22: Now You See Me Too Visual Tooling for Advanced Systems ...
Page 23: Now You See Me Too Visual Tooling for Advanced Systems ...

Systems Analysis

A Brief Taxonomy of Analysis

14 Suchakrapani Datt Sharma

Page 24: Now You See Me Too Visual Tooling for Advanced Systems ...

Systems Analysis

A Brief Taxonomy of Analysis

14 Suchakrapani Datt Sharma

Conception

Structural Analysis of software and systems

eg. Static analysis of kernel source code for program flow and dependency graphs

Page 25: Now You See Me Too Visual Tooling for Advanced Systems ...

Systems Analysis

A Brief Taxonomy of Analysis

14 Suchakrapani Datt Sharma

Conception Live

Structural Analysis of software and systems

eg. Static analysis of kernel source code for program flow and dependency graphs

Behavioral and Execution Analysis of software systems

Dynamic analysis by instrumenting applications, buffer the events and display results live or at short samples

eg. Live traces, sampled resource usage (CPU, memory)

Page 26: Now You See Me Too Visual Tooling for Advanced Systems ...

Systems Analysis

A Brief Taxonomy of Analysis

14 Suchakrapani Datt Sharma

Conception Live Post-Mortem

Structural Analysis of software and systems

eg. Static analysis of kernel source code for program flow and dependency graphs

Behavioral and Execution Analysis of software systems

Dynamic analysis by instrumenting applications, buffer the events and display results live or at short samples

eg. Live traces, sampled resource usage (CPU, memory)

Behavioral, Execution and Root Cause Analysis of software systems

Gather as much data with as much granularity. Characterize, visualize and infer.

eg. Root cause analysis of abnormal interrupt latency, software/hardware traces

Page 27: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

From Problem to Insight

15 Suchakrapani Datt Sharma

Page 28: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

From Problem to Insight

15 Suchakrapani Datt Sharma

Question

Program is making a bunch of syscalls, some are slow.

Which? Why? Where?

Page 29: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

From Problem to Insight

15 Suchakrapani Datt Sharma

Question Gather

Program is making a bunch of syscalls, some are slow.

Which? Why? Where?

Instrument syscalls with timestamps and observe them as they occur in an execution

Record stack of all functions called inside the syscall and compare executions

Sample or Trace

Page 30: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

From Problem to Insight

15 Suchakrapani Datt Sharma

Question Gather Characterize

Program is making a bunch of syscalls, some are slow.

Which? Why? Where?

Instrument syscalls with timestamps and observe them as they occur in an execution

Record stack of all functions called inside the syscall and compare executions

Sample or Trace

Frequency Analysis

Latency Analysis

Multi-modal Analysis(Hierarchy + Time)

Page 31: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

From Problem to Insight

15 Suchakrapani Datt Sharma

Question Gather Characterize Visualize

Program is making a bunch of syscalls, some are slow.

Which? Why? Where?

Instrument syscalls with timestamps and observe them as they occur in an execution

Record stack of all functions called inside the syscall and compare executions

Sample or Trace

Frequency Analysis

Latency Analysis

Multi-modal Analysis(Hierarchy + Time)

Histograms, Scatter-plots

Heat-maps

Graphs, Timelines, Flamecharts, Flamegraphs

Page 32: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

Case Study -

16 Suchakrapani Datt Sharma

How would the code flow in my web-server?

What are terminal sources and sinks?

Conception

thttpd.c

thttpd.c.212r.expand

Callgraph ExtractionFrom RTL

CFLAGS=-fdump-rtl-expand

Flow Classification

clear_connectionlinger_clear_connection

really_clear_connection

handle_term

shut_down

logstats

idle

handle_usr1

handle_usr2

main

occasional

value_required.part.2

no_value_required.part.1

e_strdup.part.4

show_stats

update_throttles

handle_newconnect

handle_alrm

handle_hup

wakeup_connection

usage

handle_chld

Questions

handle request_pool

new_connect

wakeup_connect

process

shutdown

Gather

Characterize

Visualize

Page 33: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

Case Study -

17 Suchakrapani Datt Sharma

How do we observe disk I/O latencies?

Live

eBPF Program

req_start/stop

HISTOGRAM MAP

kprobe/kretprobesQuestions

Gather

Characterize

Visualize

usecs : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 115 |** | 32 -> 63 : 553 |************** | 64 -> 127 : 1087 |*************************** | 128 -> 255 : 1572 |****************************************| 256 -> 511 : 1040 |************************** | 512 -> 1023 : 54 |* |

Page 34: Now You See Me Too Visual Tooling for Advanced Systems ...

Visualizing Systems Data

Case Study -

18 Suchakrapani Datt Sharma

What were most frequent calls made? What did those call-stacks looked like? How did they interact with the underlying system?

SimpleWebServer.jar

perf-<pid>.data

Callstack Extraction(count + hierarchy)

Perf

Questions

Gather

Characterize Visualize

Post-MortemSearch

java/i..pe..

__pe..

_..

_..

C..pthr..

d..

p..

JavaThread::run

__per..

do_..

page_fault

java_start

x86_p..

x86_..

fut..

d..

finis..

thread_entry

java/io/..

s..su..

rwsem_..

fute..native_w..

pth..sys..

[u..

o..intel_pm..

Th..

sche..su..

perf_pmu..

j..

call_r..do_page..

jni_..

__mmap64

Java_..

inte..

nati..

ja..

s..

j..

j..

do_f..sys_mmap

perf..

f..

ent..

perf_..

rwsem_..

p..

ja..

fute..

[unknown]pth..

vm_mmap..

in..J..

java..

entry_S..

perf_..

entr..

x..

na..

JNU_..

__perf_e..

down_w..

x86_..

sched..

Int..

j..

ja..

JavaCalls::call_virtual

x8..

__do_pa..

sys_..

_..

inte..

x8..

i..

s..

start_thread

fut..

c..

java/..__..

p..

__s..sch..

JV..

fin..

__sche..

__sc..JN..

JavaThread::thread_main_inner

__sch..

d..

fini..

d..

Monitor::no..

na..down_r..

__p..

p..

ret_from_..

jav..

[u.. os::start_t..[unknown]

fut..

finish_ta..

finish..

d..

JavaThread::~Jav..

org/jibble/simplewebserver/RequestThread:::run

__per..

fi..Java..

nati..

sch..

Jav..

in..

ja..

intel..

call_stub

java

jni..

nati..

JavaCalls::call_virtual

schedule

M..

_..

r..

java/net/PlainSo..

pe..

schedule_..

ja..

x86_pmu_..

ca..

sys..

call_r..

[unknown] ent..

j..

do_..

sys_mma..

fut..

__clone

_..

JavaCalls::call_helper

s..

__s..

Ja..

perf-map-agent

Page 35: Now You See Me Too Visual Tooling for Advanced Systems ...

Gathering Systems Data

Page 36: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

19 Suchakrapani Datt Sharma

Page 37: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

Hardware

Host OS Kernel functions, hardware perf counters

20 Suchakrapani Datt Sharma

Page 38: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

Hardware

Virtualization Containerization

Host OS

Guest OS

Kernel functions, hardware perf counters

Kernel functions, Hypervisor, Custom APIs

21 Suchakrapani Datt Sharma

Page 39: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

ApplicationsApplications

LibsLibs

Kernel functions, hardware perf counters

Kernel functions, Hypervisor, Custom APIs

Library functions, Syscalls

22 Suchakrapani Datt Sharma

Hardware

Virtualization Containerization

Host OS

Guest OS

Page 40: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

Functions

Kernel functions, hardware perf counters

Kernel functions, Hypervisor, Custom APIs

Library functions, Syscalls

Application functions

23 Suchakrapani Datt Sharma

ApplicationsApplications

LibsLibs

Hardware

Virtualization Containerization

Host OS

Guest OS

Page 41: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

Instructions

Kernel functions, hardware perf counters

Kernel functions, Hypervisor, Custom APIs

Library functions, Syscalls

Application functions

Branches, calls

24 Suchakrapani Datt Sharma

Functions

ApplicationsApplications

LibsLibs

Hardware

Virtualization Containerization

Host OS

Guest OS

Page 42: Now You See Me Too Visual Tooling for Advanced Systems ...

Observability Layers

Logic

Subatomic Particles

Kernel functions, hardware perf counters

Kernel functions, Hypervisor, Custom APIs

Library functions, Syscalls

Application functions

Branches, calls

CPU pins

EM waves ??

25 Suchakrapani Datt Sharma

Instructions

Functions

ApplicationsApplications

LibsLibs

Hardware

Virtualization Containerization

Host OS

Guest OS

Page 43: Now You See Me Too Visual Tooling for Advanced Systems ...

Data Sources

System - Functions: Static Tracing (Tracepoints, Ftrace)- Functions: Dynamic Tracing (Kprobes, Kretprobes)- PMU Events (Perf)- Hardware Counters (Perf)- Hardware Tracing Blocks (Intel PT, ARM CoreSight)- Kernel Logs (LSM Audit logs)

Applications- Application Logs/Traces (JUL)- Userspace tracing (eg. Uftrace, compiler instrumentation)

26 Suchakrapani Datt Sharma

Page 44: Now You See Me Too Visual Tooling for Advanced Systems ...

Deep DiveTracing

Page 45: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing Functions

bar()

foo()

baz()

call_me_maybe()call_me_maybe()

Fill Buffer

Collect Data

Event Event Event

Program Flow, Arguments, Latency, Data Flow

Observation Function

27 Suchakrapani Datt Sharma

Page 46: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing Functions

Kernel Example- Dynamically instrument with Kprobes

do_sys_open()

jmp

Restore registers

Save registersCALL pre_handler

ORIG INSN

CALL pre_handler Custom handlereBPF program

JMP back

Patched Instruction

Supported by eBPF (Stored in Maps Perf →

Data), LTTng (CTF)

28 Suchakrapani Datt Sharma

Page 47: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing Functions

bar()

__cyg_profile_func_enter

Generate Event

TimestampEvent Event Event

-finstrument-functions

Userspace Example- Compiler-assisted instrumentation

__cyg_profile_func_exit

CTFSupported by LTTng$ lttng create

$ lttng enable-event -a -u$ lttng add-context -u -t vpid -t vtid -t procname$ lttng start$ LD_PRELOAD=/usr/lib/liblttng-ust-cyg-profile.so ./thttpd$ lttng stop

29 Suchakrapani Datt Sharma

Page 48: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing Functions

CTF Trace Events

[17:43:26.548312332] (+0.000000098) ubuntu-lisa lttng_ust_cyg_profile:func_entry: { cpu_id = 0 }, { vpid = 2293, vtid = 2293, procname = "thttpd" }, { addr = 0x410B50, call_site = 0x411414 }

[17:43:26.548312980] (+0.000000104) ubuntu-lisa lttng_ust_cyg_profile:func_entry: { cpu_id = 0 }, { vpid = 2293, vtid = 2293, procname = "thttpd" }, { addr = 0x410AE0, call_site = 0x410B86 }

[17:43:26.548313787] (+0.000000103) ubuntu-lisa lttng_ust_cyg_profile:func_exit: { cpu_id = 0 }, { vpid = 2293, vtid = 2293, procname = "thttpd" }, { addr = 0x410AE0, call_site = 0x410B86 }

[17:43:26.548314427] (+0.000000103) ubuntu-lisa lttng_ust_cyg_profile:func_exit: { cpu_id = 0 }, { vpid = 2293, vtid = 2293, procname = "thttpd" }, { addr = 0x410B50, call_site = 0x411414 }

29 Suchakrapani Datt Sharma

Time Delta Event name TracePayloadTimestamp

Page 49: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing FunctionseBPF + Kprobes

BPF Code

KprobeKernel Function

trace.bpf

LLVM/Clang

Perf Buffer

bpf() bpf()

30 Suchakrapani Datt Sharma

Page 50: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing Functions

Kernel Example- Dynamically instrument with Kprobes

do_sys_open()

jmp

Restore registers

Save registersCALL pre_handler

ORIG INSN

CALL pre_handler Custom handlereBPF program

JMP back

Patched Instruction

Supported by eBPF (Stored in Maps Perf →

Data), LTTng (CTF)

28 Suchakrapani Datt Sharma

Page 51: Now You See Me Too Visual Tooling for Advanced Systems ...

Observing FunctionseBPF + Kprobes

BPF Code

KprobeKernel Function

trace.bpf

LLVM/Clang

Perf Buffer

bpf() bpf()

30 Suchakrapani Datt Sharma

Page 52: Now You See Me Too Visual Tooling for Advanced Systems ...

eBPF + Kprobes- IOVisor BCC – Python, C++, Lua, Go (gobpf) APIs- Compile BPF programs directly via LLVM interface- Helper functions to manage maps, buffers, probes

from bcc import BPF

prog = """int hello(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0;}"""b = BPF(text=prog)b.attach_kprobe(event="sys_clone", fn_name="hello")print "PID MESSAGE"b.trace_print(fmt="{1} {5}")

Attach to Kprobe event

prog compiled to BPF bytecode

Print trace pipe

Complete Program

trace_fields.py

Observing Functions

31 Suchakrapani Datt Sharma

Page 53: Now You See Me Too Visual Tooling for Advanced Systems ...

Some Formats

Formats and Storage- Scaled Storage (Time-series): OpenTSDB, Graphite, InfluxDB, Prometheus- Compact Storage (Binary formats): CTF, Perf- Graph Storage (Source Analysis): CPG (Titan/JanusDB)- Custom

- JSON (Uftrace)- XML Traces

32 Suchakrapani Datt Sharma

Page 54: Now You See Me Too Visual Tooling for Advanced Systems ...

Characterization and Visualization of Data

Page 55: Now You See Me Too Visual Tooling for Advanced Systems ...

Popular Means

From Events to Visuals- Latency/Density (Syscalls) → Histograms → Heatmaps- Latency (Syscalls) vs Time → Scatter Plots- Throughput → Line Charts- Resource Consumption → Line Charts- Per-Entity (Process/Host/VM) Events → Timeline/Gantt- Event Summaries → Pie, Donut, Bar Charts- Function Graphs (Time) → Flame Charts- Function Graphs (Count) → Flame Graphs- Callgraphs : Graphs/TreeMap/Sunburst

33 Suchakrapani Datt Sharma

Page 56: Now You See Me Too Visual Tooling for Advanced Systems ...

Histograms

Latency Histograms- Periodic snapshots in simple ASCII

35 Suchakrapani Datt Sharma

$ sudo ./biolatency.py

usecs : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 115 |** | 32 -> 63 : 553 |************** | 64 -> 127 : 1087 |*************************** | 128 -> 255 : 1572 |****************************************| 256 -> 511 : 1040 |************************** | 512 -> 1023 : 54 |* |

eBPF-BCC Tools

Page 57: Now You See Me Too Visual Tooling for Advanced Systems ...

Histograms

Latency Histograms- Periodic snapshots in simple ASCII

36 Suchakrapani Datt Sharma

$ sudo ./biolatency.py

usecs : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 115 |** | 32 -> 63 : 553 |************** | 64 -> 127 : 1087 |*************************** | 128 -> 255 : 1572 |****************************************| 256 -> 511 : 1040 |************************** | 512 -> 1023 : 54 |* |

Page 58: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

37 Suchakrapani Datt Sharma

Count

Laten

cy (us

)

28

32

553

128512

Page 59: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

38 Suchakrapani Datt Sharma

Time

Page 60: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

38 Suchakrapani Datt Sharma

Bi-modal

Outlier

Time

Page 61: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

38 Suchakrapani Datt Sharma

Bi-modal

Outlier

Time

Averages don’t do justice

Page 62: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

39 Suchakrapani Datt Sharma

Time

Page 63: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

40 Suchakrapani Datt Sharma

Time

Encode Counts as colors

Page 64: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

41 Suchakrapani Datt Sharma

Time

Latency

Outliers

Page 65: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Latency Heatmaps

42 Suchakrapani Datt Sharma

Btw, this is really derived

from an eBPF tool

Page 66: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Moaaaarr! Heatmaps

43 Suchakrapani Datt Sharma

Luca Canali from

CERN uses this!

Page 67: Now You See Me Too Visual Tooling for Advanced Systems ...

Heatmaps

Moaaaarr! Heatmaps

44 Suchakrapani Datt Sharma

..and apparently

Honeycomb users

as well..

Netflix as well!

https://honeycomb.io/blog/2017/09/heatmaps-are-the-new-hotness/

Page 68: Now You See Me Too Visual Tooling for Advanced Systems ...

More Stuff

More Latency Visualizations- http://www.brendangregg.com/HeatMaps/latency.html- http://queue.acm.org/detail.cfm?id=1809426- https://honeycomb.io/blog/2017/09/heatmaps-are-the-new-hotness/- https://github.com/LucaCanali/PyLatencyMap

Extra Reading: Utilization Heatmaps- http://www.brendangregg.com/HeatMaps/utilization.html

45 Suchakrapani Datt Sharma

Page 69: Now You See Me Too Visual Tooling for Advanced Systems ...

Flames

Function Graph (Uftrace)

46 Suchakrapani Datt Sharma

[ 8898] | tmr_init() { 0.667 us [ 8898] | tmr_init(); 1.782 us [ 8898] | } /* tmr_init */ [ 8898] | httpd_initialize() { [ 8898] | httpd_initialize() { [ 8898] | check_options() { 0.435 us [ 8898] | check_options(); 1.501 us [ 8898] | } /* check_options */ 1.342 us [ 8898] | malloc(); [ 8898] | gethostname() { 4.893 us [ 8898] | gethostname(); 6.201 us [ 8898] | } /* gethostname */ 0.910 us [ 8898] | __strdup(); 0.744 us [ 8898] | __strdup(); 0.572 us [ 8898] | __strdup(); [ 8898] | httpd_set_logfp() { 0.448 us [ 8898] | httpd_set_logfp(); 1.393 us [ 8898] | } /* httpd_set_logfp */

6.198 ms [ 8898] | } /* poll_init */ 6.203 ms [ 8898] | } /* poll_init */ 8.656 ms [ 8898] | } /* fdwatch_get_nfiles */ 8.657 ms [ 8898] | } /* fdwatch_get_nfiles */ 18.768 us [ 8898] | chroot(); 2.505 us [ 8898] | strncmp(); [ 8898] | syslog() { 727.596 us [ 8898] | __syslog_chk(); 730.243 us [ 8898] | } /* syslog */ [ 8898] | fprintf() { 1.194 us [ 8898] | __fprintf_chk(); 2.664 us [ 8898] | } /* fprintf */ 0.430 us [ 8898] | strcpy(); 4.179 us [ 8898] | chdir(); 8.285 us [ 8898] | sigset(); 1.497 us [ 8898] | sigset(); 1.385 us [ 8898] | sigset(); 6.322 us [ 8898] | alarm();

Snippet (thttpd request-resp

onse)

Page 70: Now You See Me Too Visual Tooling for Advanced Systems ...

Flames

Flame Chart (Uftrace)

47 Suchakrapani Datt Sharma

Time

Stac

k D e

pth

Handle New

Connection (137us)

Service First Request

https://github.com/namhyung/uftrace

Page 71: Now You See Me Too Visual Tooling for Advanced Systems ...

Flames

Flame Graph (Java mixed-mode)

48 Suchakrapani Datt Sharma

Java Application

System (Kernel)

Search

java/i..pe..

__pe..

_..

_..

C..pthr..

d..

p..

JavaThread::run

__per..

do_..

page_fault

java_start

x86_p..

x86_..

fut..

d..

finis..

thread_entry

java/io/..

s..su..

rwsem_..

fute..native_w..

pth..sys..

[u..

o..intel_pm..

Th..

sche..su..

perf_pmu..

j..

call_r..do_page..

jni_..

__mmap64

Java_..

inte..

nati..

ja..

s..

j..

j..

do_f..sys_mmap

perf..

f..

ent..

perf_..

rwsem_..

p..

ja..

fute..

[unknown]pth..

vm_mmap..

in..J..

java..

entry_S..

perf_..

entr..

x..

na..

JNU_..

__perf_e..

down_w..

x86_..

sched..

Int..

j..

ja..

JavaCalls::call_virtual

x8..

__do_pa..

sys_..

_..

inte..

x8..

i..

s..

start_thread

fut..

c..

java/..__..

p..

__s..sch..

JV..

fin..

__sche..

__sc..JN..

JavaThread::thread_main_inner

__sch..

d..

fini..

d..

Monitor::no..

na..down_r..

__p..

p..

ret_from_..

jav..

[u.. os::start_t..[unknown]

fut..

finish_ta..

finish..

d..

JavaThread::~Jav..

org/jibble/simplewebserver/RequestThread:::run

__per..

fi..Java..

nati..

sch..

Jav..

in..

ja..

intel..

call_stub

java

jni..

nati..

JavaCalls::call_virtual

schedule

M..

_..

r..

java/net/PlainSo..

pe..

schedule_..

ja..

x86_pmu_..

ca..

sys..

call_r..

[unknown] ent..

j..

do_..

sys_mma..

fut..

__clone

_..

JavaCalls::call_helper

s..

__s..

Ja..

JVM

Single Request

(SimpleWebServer.jar)

Page 72: Now You See Me Too Visual Tooling for Advanced Systems ...

Old Flames

Moooaaaar! Flaming Stuff

49 Suchakrapani Datt Sharma

Java App

GC

HotSpot

Flame Charts.. before

they were cool! (Java)

http://www.oracle.com/technetwork/server-storage/solaris/perftools-141913.html

Page 73: Now You See Me Too Visual Tooling for Advanced Systems ...

Old Flames

Moooaaaar! Flaming Stuff

50 Suchakrapani Datt Sharma

CPUs

DTrace + Solaris

Kernel (CPU Stacks)

http://www.oracle.com/technetwork/server-storage/solaris/perftools-141913.html

Page 74: Now You See Me Too Visual Tooling for Advanced Systems ...

Flames

Flame Charts- Function Graphs (Time): Keeps on running. Horizontal-axis is time.- Sourced from Chrome traces, LTTng traces, Uftrace

Flame Graphs- Function Graphs (Count): Callstacks visualized during execution with population on horizontal-axis and depth of stack on vertical-axis- Sourced from perf events, eBPF stack traces, LTTng traces

51 Suchakrapani Datt Sharma

Page 75: Now You See Me Too Visual Tooling for Advanced Systems ...

Callgraphs, Treemaps & Sunbursts

52 Suchakrapani Datt Sharma

https://stackoverflow.com/a/6617588

Valgrind + Callgrind

Baobab(Disk Usage)

Page 76: Now You See Me Too Visual Tooling for Advanced Systems ...

Timelines

Control Flow (LTTng/Custom Trace)

53 Suchakrapani Datt Sharma

Usermode Syscallwget

CPU0

Usermode Interrupted

Usermode SyscallUsermode SoftIRQ 3

States

Time

IRQ 3(Network)

2.6us

IRQ raised

1.96 "

Page 77: Now You See Me Too Visual Tooling for Advanced Systems ...

Timelines

Critical Flow (LTTng)

Identify the critical path of execution by following a process’ execution and its relation with other processes

54 Suchakrapani Datt Sharma

Preemptedwget

bash

Running

Running Running

Network

Page 78: Now You See Me Too Visual Tooling for Advanced Systems ...

Tooling Demo

Page 79: Now You See Me Too Visual Tooling for Advanced Systems ...

tracecompass.org

Page 80: Now You See Me Too Visual Tooling for Advanced Systems ...

Short Note on Colors

Page 81: Now You See Me Too Visual Tooling for Advanced Systems ...

Colors

Diverging Trends- Think of it as temperature (heatmaps)

Sequential Trend- Related but changing (heatmaps, flamegraphs)

Qualitative Trend- Distinct entities (process states, timelines)

55 Suchakrapani Datt Sharma

http://colorbrewer2.org

Page 82: Now You See Me Too Visual Tooling for Advanced Systems ...

What Next?

Wishlist for an Ultimate Analysis Pipeline- Pluggable sources- Distributed systems support- Diffs of executions- Time-synchronized views- Summarization of events and observations- Intuitive UIs- Filtering- Hardware Traces! Lolwut?

56 Suchakrapani Datt Sharma

Page 83: Now You See Me Too Visual Tooling for Advanced Systems ...

Future Fun

Hardware Trace Visualizations- Targeted Intel Processor Trace (PT) snapshot of mmap() - Sunburst of syscall latency (insn). Tracerception!

57 Suchakrapani Datt Sharma

173 ns and 917

instructions more

Page 84: Now You See Me Too Visual Tooling for Advanced Systems ...

Future Fun

Data Driven Visuals (Intel PT)

58 Suchakrapani Datt Sharma

<bundle> <PIP> 32423545 </PIP>

<NR> 1 </NR><VMCS> 243241334 </VMCS><TSC> 2342353646 </TSC>

</bundle>

perf.data PTParse + VMPT

vCPUs

Consumption

Process

Control Flow

Perf PT traces

Page 85: Now You See Me Too Visual Tooling for Advanced Systems ...

- Linux Performance/Tracing- http://www.brendangregg.com/linuxperf.html- https://jvns.ca/blog/2017/07/05/linux-tracing-systems/- https://www.kernel.org/doc/Documentation/trace/ftrace.txt- https://github.com/namhyung/uftrace- http://lttng.org/docs- http://tracecompass.org/#docs- https://www.kernel.org/doc/Documentation/kprobes.txt- https://github.com/jvm-profiling-tools/perf-map-agent- https://github.com/goldshtn/linux-tracing-workshop

More References

60 Suchakrapani Datt Sharma

Page 86: Now You See Me Too Visual Tooling for Advanced Systems ...

- Visualizations- A Tour Through the Visualization Zoo http://queue.acm.org/detail.cfm?id=1805128- https://www.slideshare.net/brendangregg/javaone-2015-java-mixedmode- flame-graphs

More References

60 Suchakrapani Datt Sharma

Page 87: Now You See Me Too Visual Tooling for Advanced Systems ...

- Research and Future

[Begel et al. 1999] BPF+: exploiting global data-flow optimization in a generalized packet filter architecture, ACM SIGCOMM ‘99

[Desnoyers et al. 2009] The LTTng tracer: A low impact performance and behavior monitor for GNU/Linux, Ottawa Linux Symposium 2009

[Desnoyers et al.] Low-Impact Operating Systems Tracing, PhD Thesis (polymtl.ca)

[Clement 2016] Linux Kernel packet transmission performance in high-speed networks Masters Thesis (2016), KTH, Stockholm

[Borkmann 2016] Advanced programmability and recent updates with tc’s cls_bpf NetDev 1.2 (2016) Tokyo

More References

60 Suchakrapani Datt Sharma

Page 88: Now You See Me Too Visual Tooling for Advanced Systems ...

- Research and Future

[Philippe Moret et al. 2010] Visualizing and exploring profiles with calling context ring charts, Sofware: Practice and Experience, Wiley

[J. Trümper et al.] Multiscale Visual Comparison of Execution Traces. Proceedings of the International Conference on Program Comprehension, IEEE Computer Society, 2013.

[Johannes Bohnet et. al.] Analyzing Feature Implementation by Visual Exploration of Architecturally-Embedded Call-Graphs. 4th International Workshop on Dynamic Analysis, ACM, 2006.

[Sharma 2017] Low-Impact System Performance Analysis Using Hardware Assisted Tracing Techniques, PhD Thesis (polymtl.ca)

More References

60 Suchakrapani Datt Sharma

Page 89: Now You See Me Too Visual Tooling for Advanced Systems ...

- LTTng developers- eBPF and BCC developers- Trace Compass developers- Geneviève Bastien, Mohamad Gebai, Francis Giraldeau and Hani Nemati!- Whole ShiftLeft Inc. team!- DORSAL Lab @ Polytechnique Montreal

Ack

LTTng

61 Suchakrapani Datt Sharma

Page 90: Now You See Me Too Visual Tooling for Advanced Systems ...

[email protected]@polymtl.ca@tuxology