benchmark

package
v11.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package benchmark package provides tools to run progressive or independent benchmarks against teleport services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportLatencyProfile

func ExportLatencyProfile(path string, h *hdrhistogram.Histogram, ticks int32, valueScale float64) (string, error)

ExportLatencyProfile exports the latency profile and returns the path as a string if no errors

Types

type Config

type Config struct {
	// Rate is requests per second origination rate
	Rate int
	// Command is a command to run
	Command []string
	// Interactive turns on interactive sessions
	Interactive bool
	// MinimumWindow is the min duration
	MinimumWindow time.Duration
	// MinimumMeasurments is the min amount of requests
	MinimumMeasurements int
}

Config specifies benchmark requests to run

func (*Config) Benchmark

func (c *Config) Benchmark(ctx context.Context, tc *client.TeleportClient) (Result, error)

Benchmark connects to remote server and executes requests in parallel according to benchmark spec. It returns benchmark result when completed. This is a blocking function that can be canceled via context argument.

type Linear

type Linear struct {
	// LowerBound is the lower end of rps to execute
	LowerBound int
	// UpperBound is the upper end of rps to execute
	UpperBound int
	// Step is the amount of rps to increment by
	Step int
	// MinimumMeasurements is the minimum measurement a benchmark should execute
	MinimumMeasurements int
	// MinimumWindow is the minimum duration to run benchmark for
	MinimumWindow time.Duration
	// contains filtered or unexported fields
}

Linear generator

func (*Linear) GetBenchmark

func (lg *Linear) GetBenchmark() *Config

GetBenchmark returns the benchmark config for the current generation.

type Result

type Result struct {
	// RequestsOriginated is amount of requests originated
	RequestsOriginated int
	// RequestsFailed is amount of requests failed
	RequestsFailed int
	// Histogram holds the response duration values
	Histogram *hdrhistogram.Histogram
	// LastError contains last recorded error
	LastError error
	// Duration it takes for the whole benchmark to run
	Duration time.Duration
}

Result is a result of the benchmark

func Run

func Run(ctx context.Context, lg *Linear, cmd, host, login, proxy string) ([]Result, error)

Run is used to run the benchmarks, it is given a generator, command to run, a host, host login, and proxy. If host login or proxy is an empty string, it will use the default login

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL