Tx/Samples/SyntheticCounters
georgis f16fd39656 Fixing bugs and better docs for Synthetic Counters 2014-06-17 20:14:21 -07:00
..
DemoUI Demo UI fixes for synthetic counters 2013-05-01 20:42:45 -07:00
IEAutomation Imperative code baseline for synthetic counters 2013-03-11 18:04:08 -07:00
SynCtr Fixing bugs and better docs for Synthetic Counters 2014-06-17 20:14:21 -07:00
TcpHog Imperative code baseline for synthetic counters 2013-03-11 18:04:08 -07:00
Overview.jpg Fixing bugs and better docs for Synthetic Counters 2014-06-17 20:14:21 -07:00
Readme.md Fixing bugs and better docs for Synthetic Counters 2014-06-17 20:14:21 -07:00
SynCtr_Performance.JPG Readme.md for synthetic counters 2014-03-22 11:23:45 -07:00
SyntheticCounters.JPG Readme.md for synthetic counters 2014-03-22 11:23:45 -07:00
SyntheticCounters.sln Fixing bugs and better docs for Synthetic Counters 2014-06-17 20:14:21 -07:00

Readme.md

Synthetic Performance Counters

This sample illustrates how to use ETW events to produce "synthetic performance counters" defined as Rx queries:

Overview

Here:

  • The machine receives network traffic over TCP
  • The transport driver TCPIP.sys traces events into ETW
  • Tx copies each event into C# object, and pushes it into IObserver
  • Rx query is used to aggregate the total bytes received per second, per IP adress

Running the demo

The demo is WinForms application that uses Tx and Rx. It is only intended to show the concepts, not to measure performance.

Here is how to run it:

A screenshot looks like this:

SyntheticCounters.JPG

Here the top right is the experience of counters - per each IP address we see the trend of bytes received, aggregated over 1 sec window.

Performance Test

To test performance, we have to avoid CPU-heavy work like drawing UI and running web browsers. More isolated experiment is using console apps:

  • Start SynCtr
  • Start TcpHog
  • Open PerfMon and add counters like in the picture below

TcpHog works by sending/receiving a burst of TCP traffic and then waiting for a while. You can interactively control the bursts and the wait time.

Here is example trend of events logged per second:

SynCtr_Performance.JPG

To do experiment like this on your machine do the following in PerfMon:

  • Expand the node "Data Collector Sets" in the left tree
  • Right click on User Defined, New, Data Collector Set
  • Chose "Create From Template" and browse to SynCtrDCS.xml
  • Start the collector, do some experiments and then stop it
  • Click on the little box (second icon in the menu) and browse for the .blg files that was created

Benefits of "synthetic" counters

The benefits of this approach compared to real performance counters (the one you see in PerfMon) are:

  • The "names" of the counters can be derived from the event payload
  • There are no string restrictions like 128 characters, and symbols that are invalid
  • Counters are not restricted to one-dimensional hierarchy
  • xcopy deployment: no need for creation of counter categories (.Net) or deploying counter manifests via lodctr.exe. No registry changes etc.