mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-02 14:59:53 +08:00
* benchmark package
* use default config if path is not specified
* progressiveBench as a config method
* implement a main.go approach to run progressive tests
* make teleport client, run specified benchmark
* function and method descriptions
* make teleport client
* testing
* change interface method signatures
* dry up bench.go code, move producer goroutines to own function
* output formatting
* remove yaml
* fix linter errors
* remove print
* PR suggested changes, moved export latency profile functionality to the benchmark package
* PR fixes
* method description
* update testing
* linter
* docs and example
* PR suggestion changes
* fix coord omission bug
* remove benchmark struct
* remove threads, using open system
* recover in run
* close channel, check if open with each execution
* update testing, pr suggestions
* add more instructions to readme
* update example.go
* pass back context
* use SyncBuffer
* export response and service histograms
* update readme, exporting profiles section
* return from execute()
* export singular latency profile
* export response profile
* Revert "export response profile"
This reverts commit 5a21cb034c.
* export response profile
* update branch
* format example.go
* remove threads
* update example.go
* update branch
* goimports
* add signal handler & update docs
* PR suggestions
* exit out of interactive session
* revert execute
* PR suggestion
* run commmand on non-interactive instead of nil
52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# `tsh bench`
|
|
|
|
## Using `tsh` bench
|
|
Specify the rps and duration with `--rate` and `--duration`. By default rate is 10 requests per seconds and duration is 1 second. You will need to provide `[user@]host` and a command to run.
|
|
|
|
```
|
|
# generate requests at 100 requests per second
|
|
# for 30 seconds
|
|
tsh bench --rate=100 --duration=30s localhost ls -l /
|
|
```
|
|
|
|
|
|
## Exporting Latency Profile
|
|
Run `tsh bench` as usual and use the `--export` flag to export the response histogram. Use `--path` to specify a directory to save the profile to. If the path is not specified, the file will be saved to your current working directory.
|
|
|
|
Example:
|
|
|
|
`tsh bench --export --rate 100 --duration 10s localhost ls -l /`
|
|
|
|
The file will be saved in the following format:
|
|
`latency_profile_2006-10-27_15:04:05.txt`
|
|
|
|
|
|
### Plot the Profiles
|
|
1. Navigate to [HDR Histogram Plotter](http://hdrhistogram.github.io/HdrHistogram/plotFiles.html)
|
|
2. In the upper left corner of the page you will see a button that reads "choose files" and select the file
|
|
|
|
Your histogram should now be plotted.
|
|
|
|
## Linear Benchmark Generator
|
|
A linear generator generates benchmarks between a lower and upper bound using a fixed step as configured by the user.
|
|
|
|
|
|
### Use case
|
|
Linear generators are useful when benchmarking setups with understood performance profiles or generating graphs for user-facing materials.
|
|
|
|
Example:
|
|
|
|
The following defined linear instance has a lower bound of 10 and upper bound of 50. This means the generator will run 5 benchmarks, starting with 10rps until 50rps incrementing each generation with the specified `Step`, which is 10rps in the example. Each benchmark will run until, `MinimumWindow` and the `MinimumMeasurements` have been reached.
|
|
|
|
```
|
|
linear := &benchmark.Linear{
|
|
LowerBound: 10,
|
|
UpperBound: 50,
|
|
Step: 10,
|
|
MinimumMeasurements: 1000,
|
|
MinimumWindow: 30 * time.Second,
|
|
}
|
|
|
|
```
|
|
|
|
_Full script example, see `examples/bench/example.go`_ |