SlideShare une entreprise Scribd logo
1  sur  55
Télécharger pour lire hors ligne
Velocity NYC 2017 #VelocityConf | @dinagozil
ETW - Monitor Anything,
Anytime, Anywhere
Dina Goldshtein,
1
Velocity NYC 2017 #VelocityConf | @dinagozil
Agenda
• Traditional performance tooling
• Introduction to ETW
• Usage scenarios
• ETW tools
2
Velocity NYC 2017 #VelocityConf | @dinagozil
Introduction
3
Velocity NYC 2017 #VelocityConf | @dinagozil
Challenges with Traditional Profilers
Invasive
•Recompilation
•Performance overhead
http://imgur.com/gallery/qV4hPqk
4
Velocity NYC 2017 #VelocityConf | @dinagozil
Challenges with Traditional Profilers
Live monitoring
•Restart the stock server?
•Restart the aerial radar?
https://commons.wikimedia.org/wiki/File:Ekg_bigeminus_bionerd.jpg
5
Velocity NYC 2017 #VelocityConf | @dinagozil
Challenges with Traditional Profilers
Licensing
•Redistribution
•Per-machine license
https://pics.onsizzle.com/california-driver-license-di-mreinsteinthecat-class-c-exp-06-29-2020-end-2949841.png
6
Velocity NYC 2017 #VelocityConf | @dinagozil
Event Tracing for Windows
• High-speed logging framework supporting more than 100K structured
messages per second
7
Velocity NYC 2017 #VelocityConf | @dinagozil
Event Tracing for Windows
• High-speed logging framework supporting more than 100K structured
messages per second
• Does not require recompilation
• Can be turned on on-demand while running
8
Velocity NYC 2017 #VelocityConf | @dinagozil
Event Tracing for Windows
• High-speed logging framework supporting more than 100K structured
messages per second
• Does not require recompilation
• Can be turned on on-demand while running
• Very small overhead
9
Velocity NYC 2017 #VelocityConf | @dinagozil
Event Tracing for Windows
• High-speed logging framework supporting more than 100K structured
messages per second
• Does not require recompilation
• Can be turned on on-demand while running
• Very small overhead
• User-mode and kernel-mode
• .NET, drivers, services, third party components
10
Velocity NYC 2017 #VelocityConf | @dinagozil
Architecture Overview
• Generate ETW eventsProviders
• Start and stop ETW collectionControllers
• Log, analyze, or process eventsConsumers
11
Velocity NYC 2017 #VelocityConf | @dinagozil
Controller
Producer Consumer
Event Session
Buffer Pool
Log files
Events
Events
Events in Real-Time
Logged Events
12
Velocity NYC 2017 #VelocityConf | @dinagozil
It’s Everywhere
13
Velocity NYC 2017 #VelocityConf | @dinagozil
Let the Monitoring Begin
14
Velocity NYC 2017 #VelocityConf | @dinagozil
PerfView – Your ETW Aid
• Completely free from Microsoft’s GitHub
• Allows fine-grained configuration of ETW collection
• Light-weight (but not very visually appealing…)
• Built-in analysis and statistical views
15
Velocity NYC 2017 #VelocityConf | @dinagozil
DEMO
Profile Visual Studio startup
16
Velocity NYC 2017 #VelocityConf | @dinagozil
Collect Data
17
Velocity NYC 2017 #VelocityConf | @dinagozil
CPU Hot Paths
18
Velocity NYC 2017 #VelocityConf | @dinagozil
Let’s Drill Down
19
Velocity NYC 2017 #VelocityConf | @dinagozil
JIT
20
Velocity NYC 2017 #VelocityConf | @dinagozil
DEMO
GC gone mad
21
Velocity NYC 2017 #VelocityConf | @dinagozil
No Leak but GC-ing Like Crazy
22
Velocity NYC 2017 #VelocityConf | @dinagozil
PerfView Is Your Friend
23
Velocity NYC 2017 #VelocityConf | @dinagozil
Evidence Start Piling Up
24
Velocity NYC 2017 #VelocityConf | @dinagozil
What is Allocated?
25
Velocity NYC 2017 #VelocityConf | @dinagozil
Where Is It Allocated?
26
Velocity NYC 2017 #VelocityConf | @dinagozil
(CPU) (Self-)Profiling
• Use a programmatic API to detect high-CPU and record a trace log
• Microsoft TraceEvent Library on NuGet
• Can be used from external process or from inside the process
• Can use with any limited resource, not only CPU
27
Velocity NYC 2017 #VelocityConf | @dinagozil
Collecting Data
28
Velocity NYC 2017 #VelocityConf | @dinagozil
Collecting Data
using (var s = new TraceEventSession(name, file)) {
using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) {
}
}
A separate session for the
kernel data is required
29
Velocity NYC 2017 #VelocityConf | @dinagozil
Collecting Data
using (var s = new TraceEventSession(name, file)) {
using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) {
ks.EnableKernelProvider(kernelKeywords,
KernelTraceEventParser.Keywords.Profile);
s.EnableProvider(ClrTraceEventParser.ProviderGuid,
TraceEventLevel.Verbose,
(ulong)(ClrTraceEventParser.Keywords.Default));
}
}
Specify the data we’re
interested in
30
Velocity NYC 2017 #VelocityConf | @dinagozil
Collecting Data
using (var s = new TraceEventSession(name, file)) {
using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) {
ks.EnableKernelProvider(kernelKeywords,
KernelTraceEventParser.Keywords.Profile);
s.EnableProvider(ClrTraceEventParser.ProviderGuid,
TraceEventLevel.Verbose,
(ulong)(ClrTraceEventParser.Keywords.Default));
m_collectionToken.WaitHandle.WaitOne();
}
}
Session is closed on Dispose,
so wait for something to stop
tracing…
31
Velocity NYC 2017 #VelocityConf | @dinagozil
Collecting Data
using (var s = new TraceEventSession(name, file)) {
using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) {
ks.EnableKernelProvider(kernelKeywords,
KernelTraceEventParser.Keywords.Profile);
s.EnableProvider(ClrTraceEventParser.ProviderGuid,
TraceEventLevel.Verbose,
(ulong)(ClrTraceEventParser.Keywords.Default));
m_collectionToken.WaitHandle.WaitOne();
generateJitRundownEvents(file, name);
}
}
Generate JIT info to be able
to analyze .NET stacks
32
Velocity NYC 2017 #VelocityConf | @dinagozil
Managed Stacks
private void generateJitRundownEvents(string file, string name) {
using (var session = new TraceEventSession(name + "Rundown", file)) {
session.EnableProvider(ClrRundownTraceEventParser.ProviderGuid,
TraceEventLevel.Verbose,
(ulong)(ClrRundownTraceEventParser.Keywords.Default));
}
}
The ClrRundown provider
holds all needed information
33
Velocity NYC 2017 #VelocityConf | @dinagozil
Managed Stacks
private void generateJitRundownEvents(string file, string name) {
using (var session = new TraceEventSession(name + "Rundown", file)) {
session.EnableProvider(ClrRundownTraceEventParser.ProviderGuid,
TraceEventLevel.Verbose,
(ulong)(ClrRundownTraceEventParser.Keywords.Default));
// Poll until 2 second goes by without growth.
for (var prevLength = new FileInfo(file).Length; ;) {
Thread.Sleep(TimeSpan.FromSeconds(2));
var newLength = new FileInfo(file).Length;
if (newLength == prevLength) break;
prevLength = newLength;
}
}
}
This means the file stopped
writing
34
Velocity NYC 2017 #VelocityConf | @dinagozil
DEMO
Self-profile high CPU
35
Velocity NYC 2017 #VelocityConf | @dinagozil
Self-Profiling Application
36
Velocity NYC 2017 #VelocityConf | @dinagozil
CPU Hot Paths
37
Velocity NYC 2017 #VelocityConf | @dinagozil
EventParsers
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
38
Velocity NYC 2017 #VelocityConf | @dinagozil
Real-Time Analysis with TraceEvent
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
39
Velocity NYC 2017 #VelocityConf | @dinagozil
Real-Time Analysis with TraceEvent
// create a real time user mode session
using (var session = new TraceEventSession("ObserveProcs")) {
// Set up Ctrl-C to stop the session
Console.CancelKeyPress += (s, args) => session.Stop();
}
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
Create our own session
Stop collecting on ^C
40
Velocity NYC 2017 #VelocityConf | @dinagozil
Real-Time Analysis with TraceEvent
// create a real time user mode session
using (var session = new TraceEventSession("ObserveProcs")) {
// Set up Ctrl-C to stop the session
Console.CancelKeyPress += (s, args) => session.Stop();
// Turn on the process events (includes starts and stops).
session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process);
}
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
We’re interested in data
about processes
41
Velocity NYC 2017 #VelocityConf | @dinagozil
Real-Time Analysis with TraceEvent
// create a real time user mode session
using (var session = new TraceEventSession("ObserveProcs")) {
// Set up Ctrl-C to stop the session
Console.CancelKeyPress += (s, args) => session.Stop();
// Subscribe to a callback that prints the information we wish
session.Source.Kernel.ProcessStart += data => {
Console.WriteLine("Process {0} Command Line {1}",
data.ProcessName, data.CommandLine);
};
// Turn on the process events (includes starts and stops).
session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process);
}
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
Register on the event and
analyze
42
Velocity NYC 2017 #VelocityConf | @dinagozil
Real-Time Analysis with TraceEvent
// create a real time user mode session
using (var session = new TraceEventSession("ObserveProcs")) {
// Set up Ctrl-C to stop the session
Console.CancelKeyPress += (s, args) => session.Stop();
// Subscribe to a callback that prints the information we wish
session.Source.Kernel.ProcessStart += data => {
Console.WriteLine("Process {0} Command Line {1}",
data.ProcessName, data.CommandLine);
};
// Turn on the process events (includes starts and stops).
session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process);
session.Source.Process(); // Listen (forever) for events
}
https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md
Start and process forever,
until stopped
43
Velocity NYC 2017 #VelocityConf | @dinagozil
Monitoring a Production System
• TraceEvent allows us to write monitoring systems which can be used
ad-hoc without recompilation or rebooting
44
Velocity NYC 2017 #VelocityConf | @dinagozil
Monitoring a Production System
• TraceEvent allows us to write monitoring systems which can be used
ad-hoc without recompilation or rebooting
• Someone has already done the job for us
• etrace – a free command-line tool for ETW live tracing
• By my dear husband Sasha
45
Velocity NYC 2017 #VelocityConf | @dinagozil
DEMO
Boot performance with WPR and WPA
46
Velocity NYC 2017 #VelocityConf | @dinagozil
Windows Performance Recorder
47
Velocity NYC 2017 #VelocityConf | @dinagozil
Windows Performance Recorder
48
Velocity NYC 2017 #VelocityConf | @dinagozil
Windows Performance Recorder
49
Velocity NYC 2017 #VelocityConf | @dinagozil
Something Is Taking a Long Time
50
Velocity NYC 2017 #VelocityConf | @dinagozil
What’s Running During Boot?
51
Velocity NYC 2017 #VelocityConf | @dinagozil
Drill Down with Good Old PerfView
52
Velocity NYC 2017 #VelocityConf | @dinagozil
Drill Down with Good Old PerfView
53
Velocity NYC 2017 #VelocityConf | @dinagozil
Summary
Omnipresent Performant
Free
54
Velocity NYC 2017 #VelocityConf | @dinagozil
Thank You!
Dina Goldshtein,
@dinagozil
dinazil@gmail.com
55

Contenu connexe

Tendances

Docker Deployments
Docker DeploymentsDocker Deployments
Docker Deployments
Docker, Inc.
 

Tendances (19)

Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
PuppetConf 2017: Cloud, Containers, Puppet and You- Carl Caum, Puppet
PuppetConf 2017: Cloud, Containers, Puppet and You- Carl Caum, PuppetPuppetConf 2017: Cloud, Containers, Puppet and You- Carl Caum, Puppet
PuppetConf 2017: Cloud, Containers, Puppet and You- Carl Caum, Puppet
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
 
Integrating Applications: the Reactive Way
Integrating Applications: the Reactive WayIntegrating Applications: the Reactive Way
Integrating Applications: the Reactive Way
 
Cncf explore k8s_api_go
Cncf explore k8s_api_goCncf explore k8s_api_go
Cncf explore k8s_api_go
 
Open design at large scale
Open design at large scaleOpen design at large scale
Open design at large scale
 
Sprint 18
Sprint 18Sprint 18
Sprint 18
 
JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...
JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...
JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...
 
Docker Deployments
Docker DeploymentsDocker Deployments
Docker Deployments
 
OW2con'16 Keynote address: Kubernetes, the rising tide of systems administrat...
OW2con'16 Keynote address: Kubernetes, the rising tide of systems administrat...OW2con'16 Keynote address: Kubernetes, the rising tide of systems administrat...
OW2con'16 Keynote address: Kubernetes, the rising tide of systems administrat...
 
CNCF explore k8s_api
CNCF explore k8s_apiCNCF explore k8s_api
CNCF explore k8s_api
 
Prow, ChatOps for open source projects
Prow, ChatOps for open source projectsProw, ChatOps for open source projects
Prow, ChatOps for open source projects
 
Monitoring NGINX (plus): key metrics and how-to
Monitoring NGINX (plus): key metrics and how-toMonitoring NGINX (plus): key metrics and how-to
Monitoring NGINX (plus): key metrics and how-to
 
Automated Testing Environments With Kubernetes & GitLab
Automated Testing Environments With Kubernetes & GitLabAutomated Testing Environments With Kubernetes & GitLab
Automated Testing Environments With Kubernetes & GitLab
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
Comparing GWT Transport Mechanisms
Comparing GWT Transport MechanismsComparing GWT Transport Mechanisms
Comparing GWT Transport Mechanisms
 
Android getting started
Android getting startedAndroid getting started
Android getting started
 
WebRTC Object Model API - Transceivers
WebRTC Object Model API - TransceiversWebRTC Object Model API - Transceivers
WebRTC Object Model API - Transceivers
 
Pipeline interface
Pipeline interfacePipeline interface
Pipeline interface
 

Similaire à ETW - Monitor Anything, Anytime, Anywhere (Velocity NYC 2017)

Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Databricks
 
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
telestax
 

Similaire à ETW - Monitor Anything, Anytime, Anywhere (Velocity NYC 2017) (20)

ETW - Monitor Anything, Anytime, Anywhere (NDC Oslo 2017)
ETW - Monitor Anything, Anytime, Anywhere (NDC Oslo 2017)ETW - Monitor Anything, Anytime, Anywhere (NDC Oslo 2017)
ETW - Monitor Anything, Anytime, Anywhere (NDC Oslo 2017)
 
Software Supply Chains for DevOps @ InfoQ Live 2021
Software Supply Chains for DevOps @ InfoQ Live 2021Software Supply Chains for DevOps @ InfoQ Live 2021
Software Supply Chains for DevOps @ InfoQ Live 2021
 
Invited cloud-e-Genome project talk at 2015 NGS Data Congress
Invited cloud-e-Genome project talk at 2015 NGS Data CongressInvited cloud-e-Genome project talk at 2015 NGS Data Congress
Invited cloud-e-Genome project talk at 2015 NGS Data Congress
 
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
 
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
 
Sprint 71
Sprint 71Sprint 71
Sprint 71
 
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
 
Scala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @CourseraScala, ECS, Docker: Delayed Execution @Coursera
Scala, ECS, Docker: Delayed Execution @Coursera
 
DevConf 2017 - Realistic Container Platform Simulations
DevConf 2017 - Realistic Container Platform SimulationsDevConf 2017 - Realistic Container Platform Simulations
DevConf 2017 - Realistic Container Platform Simulations
 
Ontrack - Keeping track of your CI/CD mess
Ontrack - Keeping track of your CI/CD messOntrack - Keeping track of your CI/CD mess
Ontrack - Keeping track of your CI/CD mess
 
Intellias CQRS Framework
Intellias CQRS FrameworkIntellias CQRS Framework
Intellias CQRS Framework
 
FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023
 
Building a Better BaaS
Building a Better BaaSBuilding a Better BaaS
Building a Better BaaS
 
Cloud Native Applications on Kubernetes: a DevOps Approach
Cloud Native Applications on Kubernetes: a DevOps ApproachCloud Native Applications on Kubernetes: a DevOps Approach
Cloud Native Applications on Kubernetes: a DevOps Approach
 
Sprint 62
Sprint 62Sprint 62
Sprint 62
 
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
 
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
Jörg Schad - Hybrid Cloud (Kubernetes, Spark, HDFS, …)-as-a-Service - Codemot...
 
Declarative benchmarking of cassandra and it's data models
Declarative benchmarking of cassandra and it's data modelsDeclarative benchmarking of cassandra and it's data models
Declarative benchmarking of cassandra and it's data models
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with java
 

Plus de Dina Goldshtein

Plus de Dina Goldshtein (16)

How Does the Internet Work? (Wix she codes; branch)
How Does the Internet Work? (Wix she codes; branch)How Does the Internet Work? (Wix she codes; branch)
How Does the Internet Work? (Wix she codes; branch)
 
Self-Aware Applications: Automatic Production Monitoring (SDP November 2017)
Self-Aware Applications: Automatic Production Monitoring (SDP November 2017)Self-Aware Applications: Automatic Production Monitoring (SDP November 2017)
Self-Aware Applications: Automatic Production Monitoring (SDP November 2017)
 
Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)
 
Self-Aware Applications: Automatic Production Monitoring (TechDays NL 2017)
Self-Aware Applications: Automatic Production Monitoring (TechDays NL 2017)Self-Aware Applications: Automatic Production Monitoring (TechDays NL 2017)
Self-Aware Applications: Automatic Production Monitoring (TechDays NL 2017)
 
Look Mommy, no GC! (.NET Summit 2017)
Look Mommy, no GC! (.NET Summit 2017)Look Mommy, no GC! (.NET Summit 2017)
Look Mommy, no GC! (.NET Summit 2017)
 
Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)
Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)
Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)
 
Look Mommy, no GC! (BrightSource)
Look Mommy, no GC! (BrightSource)Look Mommy, no GC! (BrightSource)
Look Mommy, no GC! (BrightSource)
 
Look Mommy, no GC! (SDP May 2017)
Look Mommy, no GC! (SDP May 2017)Look Mommy, no GC! (SDP May 2017)
Look Mommy, no GC! (SDP May 2017)
 
Look Mommy, No GC! (Codecamp Iasi 2017)
Look Mommy, No GC! (Codecamp Iasi 2017)Look Mommy, No GC! (Codecamp Iasi 2017)
Look Mommy, No GC! (Codecamp Iasi 2017)
 
Look Mommy, No GC! (NDC London 2017)
Look Mommy, No GC! (NDC London 2017)Look Mommy, No GC! (NDC London 2017)
Look Mommy, No GC! (NDC London 2017)
 
How does the Internet Work?
How does the Internet Work?How does the Internet Work?
How does the Internet Work?
 
How does the Internet Work?
How does the Internet Work?How does the Internet Work?
How does the Internet Work?
 
Things They Don’t Teach You @ School
Things They Don’t Teach You @ SchoolThings They Don’t Teach You @ School
Things They Don’t Teach You @ School
 
What's New in C++ 11/14?
What's New in C++ 11/14?What's New in C++ 11/14?
What's New in C++ 11/14?
 
HTML5 Canvas
HTML5 CanvasHTML5 Canvas
HTML5 Canvas
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

ETW - Monitor Anything, Anytime, Anywhere (Velocity NYC 2017)

  • 1. Velocity NYC 2017 #VelocityConf | @dinagozil ETW - Monitor Anything, Anytime, Anywhere Dina Goldshtein, 1
  • 2. Velocity NYC 2017 #VelocityConf | @dinagozil Agenda • Traditional performance tooling • Introduction to ETW • Usage scenarios • ETW tools 2
  • 3. Velocity NYC 2017 #VelocityConf | @dinagozil Introduction 3
  • 4. Velocity NYC 2017 #VelocityConf | @dinagozil Challenges with Traditional Profilers Invasive •Recompilation •Performance overhead http://imgur.com/gallery/qV4hPqk 4
  • 5. Velocity NYC 2017 #VelocityConf | @dinagozil Challenges with Traditional Profilers Live monitoring •Restart the stock server? •Restart the aerial radar? https://commons.wikimedia.org/wiki/File:Ekg_bigeminus_bionerd.jpg 5
  • 6. Velocity NYC 2017 #VelocityConf | @dinagozil Challenges with Traditional Profilers Licensing •Redistribution •Per-machine license https://pics.onsizzle.com/california-driver-license-di-mreinsteinthecat-class-c-exp-06-29-2020-end-2949841.png 6
  • 7. Velocity NYC 2017 #VelocityConf | @dinagozil Event Tracing for Windows • High-speed logging framework supporting more than 100K structured messages per second 7
  • 8. Velocity NYC 2017 #VelocityConf | @dinagozil Event Tracing for Windows • High-speed logging framework supporting more than 100K structured messages per second • Does not require recompilation • Can be turned on on-demand while running 8
  • 9. Velocity NYC 2017 #VelocityConf | @dinagozil Event Tracing for Windows • High-speed logging framework supporting more than 100K structured messages per second • Does not require recompilation • Can be turned on on-demand while running • Very small overhead 9
  • 10. Velocity NYC 2017 #VelocityConf | @dinagozil Event Tracing for Windows • High-speed logging framework supporting more than 100K structured messages per second • Does not require recompilation • Can be turned on on-demand while running • Very small overhead • User-mode and kernel-mode • .NET, drivers, services, third party components 10
  • 11. Velocity NYC 2017 #VelocityConf | @dinagozil Architecture Overview • Generate ETW eventsProviders • Start and stop ETW collectionControllers • Log, analyze, or process eventsConsumers 11
  • 12. Velocity NYC 2017 #VelocityConf | @dinagozil Controller Producer Consumer Event Session Buffer Pool Log files Events Events Events in Real-Time Logged Events 12
  • 13. Velocity NYC 2017 #VelocityConf | @dinagozil It’s Everywhere 13
  • 14. Velocity NYC 2017 #VelocityConf | @dinagozil Let the Monitoring Begin 14
  • 15. Velocity NYC 2017 #VelocityConf | @dinagozil PerfView – Your ETW Aid • Completely free from Microsoft’s GitHub • Allows fine-grained configuration of ETW collection • Light-weight (but not very visually appealing…) • Built-in analysis and statistical views 15
  • 16. Velocity NYC 2017 #VelocityConf | @dinagozil DEMO Profile Visual Studio startup 16
  • 17. Velocity NYC 2017 #VelocityConf | @dinagozil Collect Data 17
  • 18. Velocity NYC 2017 #VelocityConf | @dinagozil CPU Hot Paths 18
  • 19. Velocity NYC 2017 #VelocityConf | @dinagozil Let’s Drill Down 19
  • 20. Velocity NYC 2017 #VelocityConf | @dinagozil JIT 20
  • 21. Velocity NYC 2017 #VelocityConf | @dinagozil DEMO GC gone mad 21
  • 22. Velocity NYC 2017 #VelocityConf | @dinagozil No Leak but GC-ing Like Crazy 22
  • 23. Velocity NYC 2017 #VelocityConf | @dinagozil PerfView Is Your Friend 23
  • 24. Velocity NYC 2017 #VelocityConf | @dinagozil Evidence Start Piling Up 24
  • 25. Velocity NYC 2017 #VelocityConf | @dinagozil What is Allocated? 25
  • 26. Velocity NYC 2017 #VelocityConf | @dinagozil Where Is It Allocated? 26
  • 27. Velocity NYC 2017 #VelocityConf | @dinagozil (CPU) (Self-)Profiling • Use a programmatic API to detect high-CPU and record a trace log • Microsoft TraceEvent Library on NuGet • Can be used from external process or from inside the process • Can use with any limited resource, not only CPU 27
  • 28. Velocity NYC 2017 #VelocityConf | @dinagozil Collecting Data 28
  • 29. Velocity NYC 2017 #VelocityConf | @dinagozil Collecting Data using (var s = new TraceEventSession(name, file)) { using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) { } } A separate session for the kernel data is required 29
  • 30. Velocity NYC 2017 #VelocityConf | @dinagozil Collecting Data using (var s = new TraceEventSession(name, file)) { using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) { ks.EnableKernelProvider(kernelKeywords, KernelTraceEventParser.Keywords.Profile); s.EnableProvider(ClrTraceEventParser.ProviderGuid, TraceEventLevel.Verbose, (ulong)(ClrTraceEventParser.Keywords.Default)); } } Specify the data we’re interested in 30
  • 31. Velocity NYC 2017 #VelocityConf | @dinagozil Collecting Data using (var s = new TraceEventSession(name, file)) { using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) { ks.EnableKernelProvider(kernelKeywords, KernelTraceEventParser.Keywords.Profile); s.EnableProvider(ClrTraceEventParser.ProviderGuid, TraceEventLevel.Verbose, (ulong)(ClrTraceEventParser.Keywords.Default)); m_collectionToken.WaitHandle.WaitOne(); } } Session is closed on Dispose, so wait for something to stop tracing… 31
  • 32. Velocity NYC 2017 #VelocityConf | @dinagozil Collecting Data using (var s = new TraceEventSession(name, file)) { using (var ks = new TraceEventSession("NT Kernel Logger", kFile)) { ks.EnableKernelProvider(kernelKeywords, KernelTraceEventParser.Keywords.Profile); s.EnableProvider(ClrTraceEventParser.ProviderGuid, TraceEventLevel.Verbose, (ulong)(ClrTraceEventParser.Keywords.Default)); m_collectionToken.WaitHandle.WaitOne(); generateJitRundownEvents(file, name); } } Generate JIT info to be able to analyze .NET stacks 32
  • 33. Velocity NYC 2017 #VelocityConf | @dinagozil Managed Stacks private void generateJitRundownEvents(string file, string name) { using (var session = new TraceEventSession(name + "Rundown", file)) { session.EnableProvider(ClrRundownTraceEventParser.ProviderGuid, TraceEventLevel.Verbose, (ulong)(ClrRundownTraceEventParser.Keywords.Default)); } } The ClrRundown provider holds all needed information 33
  • 34. Velocity NYC 2017 #VelocityConf | @dinagozil Managed Stacks private void generateJitRundownEvents(string file, string name) { using (var session = new TraceEventSession(name + "Rundown", file)) { session.EnableProvider(ClrRundownTraceEventParser.ProviderGuid, TraceEventLevel.Verbose, (ulong)(ClrRundownTraceEventParser.Keywords.Default)); // Poll until 2 second goes by without growth. for (var prevLength = new FileInfo(file).Length; ;) { Thread.Sleep(TimeSpan.FromSeconds(2)); var newLength = new FileInfo(file).Length; if (newLength == prevLength) break; prevLength = newLength; } } } This means the file stopped writing 34
  • 35. Velocity NYC 2017 #VelocityConf | @dinagozil DEMO Self-profile high CPU 35
  • 36. Velocity NYC 2017 #VelocityConf | @dinagozil Self-Profiling Application 36
  • 37. Velocity NYC 2017 #VelocityConf | @dinagozil CPU Hot Paths 37
  • 38. Velocity NYC 2017 #VelocityConf | @dinagozil EventParsers https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md 38
  • 39. Velocity NYC 2017 #VelocityConf | @dinagozil Real-Time Analysis with TraceEvent https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md 39
  • 40. Velocity NYC 2017 #VelocityConf | @dinagozil Real-Time Analysis with TraceEvent // create a real time user mode session using (var session = new TraceEventSession("ObserveProcs")) { // Set up Ctrl-C to stop the session Console.CancelKeyPress += (s, args) => session.Stop(); } https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md Create our own session Stop collecting on ^C 40
  • 41. Velocity NYC 2017 #VelocityConf | @dinagozil Real-Time Analysis with TraceEvent // create a real time user mode session using (var session = new TraceEventSession("ObserveProcs")) { // Set up Ctrl-C to stop the session Console.CancelKeyPress += (s, args) => session.Stop(); // Turn on the process events (includes starts and stops). session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process); } https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md We’re interested in data about processes 41
  • 42. Velocity NYC 2017 #VelocityConf | @dinagozil Real-Time Analysis with TraceEvent // create a real time user mode session using (var session = new TraceEventSession("ObserveProcs")) { // Set up Ctrl-C to stop the session Console.CancelKeyPress += (s, args) => session.Stop(); // Subscribe to a callback that prints the information we wish session.Source.Kernel.ProcessStart += data => { Console.WriteLine("Process {0} Command Line {1}", data.ProcessName, data.CommandLine); }; // Turn on the process events (includes starts and stops). session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process); } https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md Register on the event and analyze 42
  • 43. Velocity NYC 2017 #VelocityConf | @dinagozil Real-Time Analysis with TraceEvent // create a real time user mode session using (var session = new TraceEventSession("ObserveProcs")) { // Set up Ctrl-C to stop the session Console.CancelKeyPress += (s, args) => session.Stop(); // Subscribe to a callback that prints the information we wish session.Source.Kernel.ProcessStart += data => { Console.WriteLine("Process {0} Command Line {1}", data.ProcessName, data.CommandLine); }; // Turn on the process events (includes starts and stops). session.EnableKernelProvider(KernelTraceEventParser.Keywords.Process); session.Source.Process(); // Listen (forever) for events } https://github.com/Microsoft/dotnetsamples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md Start and process forever, until stopped 43
  • 44. Velocity NYC 2017 #VelocityConf | @dinagozil Monitoring a Production System • TraceEvent allows us to write monitoring systems which can be used ad-hoc without recompilation or rebooting 44
  • 45. Velocity NYC 2017 #VelocityConf | @dinagozil Monitoring a Production System • TraceEvent allows us to write monitoring systems which can be used ad-hoc without recompilation or rebooting • Someone has already done the job for us • etrace – a free command-line tool for ETW live tracing • By my dear husband Sasha 45
  • 46. Velocity NYC 2017 #VelocityConf | @dinagozil DEMO Boot performance with WPR and WPA 46
  • 47. Velocity NYC 2017 #VelocityConf | @dinagozil Windows Performance Recorder 47
  • 48. Velocity NYC 2017 #VelocityConf | @dinagozil Windows Performance Recorder 48
  • 49. Velocity NYC 2017 #VelocityConf | @dinagozil Windows Performance Recorder 49
  • 50. Velocity NYC 2017 #VelocityConf | @dinagozil Something Is Taking a Long Time 50
  • 51. Velocity NYC 2017 #VelocityConf | @dinagozil What’s Running During Boot? 51
  • 52. Velocity NYC 2017 #VelocityConf | @dinagozil Drill Down with Good Old PerfView 52
  • 53. Velocity NYC 2017 #VelocityConf | @dinagozil Drill Down with Good Old PerfView 53
  • 54. Velocity NYC 2017 #VelocityConf | @dinagozil Summary Omnipresent Performant Free 54
  • 55. Velocity NYC 2017 #VelocityConf | @dinagozil Thank You! Dina Goldshtein, @dinagozil dinazil@gmail.com 55