Skip to content

Commit

Permalink
feat(cli, core): save addt requests
Browse files Browse the repository at this point in the history
  • Loading branch information
lynchbomb committed Oct 25, 2019
1 parent 17775fc commit 09db45a
Show file tree
Hide file tree
Showing 25 changed files with 718 additions and 291 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Version](https://img.shields.io/npm/v/tracerbench.svg)](https://npmjs.org/package/tracerbench)
[![License](https://img.shields.io/npm/l/tracerbench.svg)](https://github.com/TracerBench/tracerbench/blob/master/package.json)

As it pertains to data analysis, intuition almost always leads us astray. We see patterns in random data and jump to unwarranted conclusions. We need a guide. One that uses statistical rigor so that we can make valid conclusions based upon the data. TracerBench aims to be that guide.
As it pertains to data analysis, intuition almost always leads us astray. We see patterns in random data and jump to unwarranted conclusions. We need a guide. One that uses statistical rigor so that we can make valid conclusions based upon the data. TracerBench aims to be that guide.

TracerBench is a controlled performance benchmarking tool for web applications. Providing clear, actionable and usable insights into performance deltas. By extracting metrics around response, animation, idle, and load through automated chrome traces and controlling that each of our samples is independent. TracerBench is able to provide low variance and reproducible performance data. TracerBench results are packageable and shareable allowing for replicated peer review.

Expand All @@ -16,8 +16,8 @@ The current approach for performance analysis for developers is running a single

TracerBench has been greatly inspired by the Chromium benchmark tool [Telemetry](https://github.com/catapult-project/catapult/blob/master/telemetry/docs/run_benchmarks_locally.md).


## How does TracerBench compare to [Lighthouse](https://github.com/GoogleChrome/lighthouse)?

When comparing TracerBench to the most popular tool Chrome Developer Tools Lighthouse. The primary difference is TracerBench is focused on getting a low variance for a metric across many samples versus getting a hard to replicate “Lighthouse performance report”. Lighthouse is essentially a black-box, with developers unable to customize performance parameters in-depth and lacking proper statistical rigor. TracerBench on the other hand, can be highly instrumented, provides statistical rigor and adequate sampling of data. Additionally, TracerBench instrumentation has minimal impact on the overhead of the application; as such TracerBench instrumentation can be "checked-in" and left in your application without worry of negative performance impacts.

# User-Stories
Expand Down Expand Up @@ -51,13 +51,11 @@ Assuming the TracerBench-CLI is globally [installed](https://github.com/TracerBe
1. Start by having TracerBench record a HAR:

```console
$ tracerbench create-archive --url http://localhost:8000
...
$ tracerbench record-har --url http://localhost:8000 --cookies <path-to-cookies>

✔ DevTools listening on ws://<address>
✔ { timestamp: 241968.79908 }
✔ HAR successfully generated from http://localhost:8000 and available here: ./trace.har
✔ Cookies successfully generated and available here: ./cookies.json
```

2. Now have TracerBench record a Trace of that HAR:
Expand Down Expand Up @@ -109,7 +107,7 @@ In your app you must place a marker to let TracerBench know that you are done re
function renderMyApp() {
// basic "web application"
// literally an app with a single empty p tag
const p = document.createElement("p");
const p = document.createElement('p');
document.body.appendChild(p);
}

Expand Down Expand Up @@ -164,8 +162,8 @@ const browser = {
'--v8-cache-options=none',
'--disable-cache',
'--disable-v8-idle-tasks',
'--crash-dumps-dir=./tmp'
]
'--crash-dumps-dir=./tmp',
],
};

// name, url, markers and browser are all required options
Expand All @@ -178,7 +176,7 @@ const control = new InitialRenderBenchmark({
markers,
browser,
// location to save only the control trace to
saveTraces: () => `./control-trace.json`
saveTraces: () => `./control-trace.json`,
});

const experiment = new InitialRenderBenchmark({
Expand All @@ -187,7 +185,7 @@ const experiment = new InitialRenderBenchmark({
markers,
browser,
// location to save only the experiment trace to
saveTraces: () => `./experiment-trace.json`
saveTraces: () => `./experiment-trace.json`,
});

// the runner uses the config of each benchmark to test against
Expand Down Expand Up @@ -244,6 +242,7 @@ When running the TracerBench-CLI `compare` command, on a successful trace a stdo
TracerBench also exposes an explicit `tracerbench report` command that takes a path to the folder containing your "trace-results.json" file and will create a PDF and HTML report.

### Understanding The Box-Plot Results

![box-plot-results](https://github.com/TracerBench/tracerbench/blob/master/docs/box-plot-transparent.png)

---
Expand Down
1 change: 0 additions & 1 deletion packages/cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
cookies.json
*tracerbench-results*
*trace.json
*trace.har
*tsconfig.tsbuildinfo
*tb-tmp*
*scratch*
Expand Down
86 changes: 29 additions & 57 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,40 +194,14 @@ s?: TRACE_EVENT_SCOPE;

<!-- commands -->

- [`tracerbench`](#tracerbench-)
- [`tracerbench compare`](#tracerbench-compare)
- [`tracerbench compare:analyze RESULTSFILE`](#tracerbench-compareanalyze-resultsfile)
- [`tracerbench create-archive`](#tracerbench-create-archive)
- [`tracerbench help [COMMAND]`](#tracerbench-help-command)
- [`tracerbench marker-timings`](#tracerbench-marker-timings)
- [`tracerbench record-har`](#tracerbench-record-har)
- [`tracerbench report`](#tracerbench-report)
- [`tracerbench trace`](#tracerbench-trace)

## `tracerbench`

Creates an automated HAR file from a URL.

```
USAGE
$ tracerbench
OPTIONS
--browserArgs=browserArgs
(required) [default:
--crash-dumps-dir=./tmp,--disable-background-timer-throttling,--disable-dev-shm-usage,--disable-cache,--disable-v8-i
dle-tasks,--disable-breakpad,--disable-notifications,--disable-hang-monitor,--safebrowsing-disable-auto-update,--ign
ore-certificate-errors,--v8-cache-options=none] (Default Recommended) Additional chrome flags for the TracerBench
render benchmark. TracerBench includes many non-configurable defaults in this category.
--tbResultsFolder=tbResultsFolder
(required) [default: ./tracerbench-results] The output folder path for all tracerbench results
--url=url
(required) [default: http://localhost:8000/] URL to visit for create-archive, timings & trace commands
```

_See code: [dist/src/commands/index.ts](https://github.com/TracerBench/tracerbench/tree/master/packages/cli/blob/v2.3.0/dist/src/commands/index.ts)_

## `tracerbench compare`

Compare the performance delta between an experiment and control
Expand Down Expand Up @@ -324,33 +298,6 @@ OPTIONS
tracerbench results
```

_See code: [dist/src/commands/compare/analyze.ts](https://github.com/TracerBench/tracerbench/tree/master/packages/cli/blob/v2.3.0/dist/src/commands/compare/analyze.ts)_

## `tracerbench create-archive`

Creates an automated HAR file from a URL.

```
USAGE
$ tracerbench create-archive
OPTIONS
--browserArgs=browserArgs
(required) [default:
--crash-dumps-dir=./tmp,--disable-background-timer-throttling,--disable-dev-shm-usage,--disable-cache,--disable-v8-i
dle-tasks,--disable-breakpad,--disable-notifications,--disable-hang-monitor,--safebrowsing-disable-auto-update,--ign
ore-certificate-errors,--v8-cache-options=none] (Default Recommended) Additional chrome flags for the TracerBench
render benchmark. TracerBench includes many non-configurable defaults in this category.
--tbResultsFolder=tbResultsFolder
(required) [default: ./tracerbench-results] The output folder path for all tracerbench results
--url=url
(required) [default: http://localhost:8000/] URL to visit for create-archive, timings & trace commands
```

_See code: [dist/src/commands/create-archive.ts](https://github.com/TracerBench/tracerbench/tree/master/packages/cli/blob/v2.3.0/dist/src/commands/create-archive.ts)_

## `tracerbench help [COMMAND]`

display help for tracerbench
Expand Down Expand Up @@ -384,8 +331,27 @@ OPTIONS
--traceFrame=traceFrame Specify a trace insights frame
--url=url (required) [default: http://localhost:8000/] URL to visit for create-archive,
timings & trace commands
--url=url (required) [default: http://localhost:8000/] URL to visit for record-har, timings &
trace commands
```

## `tracerbench record-har`

Generates a HAR file from a URL.

```
USAGE
$ tracerbench record-har
OPTIONS
--cookiespath=cookiespath (required) The path to a JSON file containing cookies to authenticate against the
correlated URL
--dest=dest (required) The destination path for the generated file
--filename=filename (required) [default: tracerbench] The filename for the generated file
--url=url (required) URL to visit for record-har, timings & trace commands
```

_See code: [dist/src/commands/marker-timings.ts](https://github.com/TracerBench/tracerbench/tree/master/packages/cli/blob/v2.3.0/dist/src/commands/marker-timings.ts)_
Expand Down Expand Up @@ -417,9 +383,15 @@ USAGE
$ tracerbench trace
OPTIONS
--cookiespath=cookiespath
(required) The path to a JSON file containing cookies to authenticate against the correlated URL
--cpuThrottleRate=cpuThrottleRate
(required) [default: 2] CPU throttle multiplier
--harpath=harpath
(required) The path to the HTTP Archive File (HAR)
--insights
Analyze insights from command.
Expand All @@ -436,7 +408,7 @@ OPTIONS
(required) [default: ./tracerbench-results] The output folder path for all tracerbench results
--url=url
(required) [default: http://localhost:8000/] URL to visit for create-archive, timings & trace commands
(required) [default: http://localhost:8000/] URL to visit for record-har, timings & trace commands
```

_See code: [dist/src/commands/trace.ts](https://github.com/TracerBench/tracerbench/tree/master/packages/cli/blob/v2.3.0/dist/src/commands/trace.ts)_
Expand Down
Loading

0 comments on commit 09db45a

Please sign in to comment.