requester

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Hey supports two output formats: summary and CSV

The summary output presents a number of statistics about the requests in a human-readable format, including: - general statistics: requests/second, total runtime, and average, fastest, and slowest requests. - a response time histogram. - a percentile latency distribution. - statistics (average, fastest, slowest) on the stages of the requests.

The comma-separated CSV format is proceeded by a header, and consists of the following columns: 1. response-time: Total time taken for request (in seconds) 2. DNS+dialup: Time taken to establish the TCP connection (in seconds) 3. DNS: Time taken to do the DNS lookup (in seconds) 4. Request-write: Time taken to write full request (in seconds) 5. Response-delay: Time taken to first byte received (in seconds) 6. Response-read: Time taken to read full response (in seconds) 7. status-code: HTTP status code of the response (e.g. 200) 8. offset: The time since the start of the benchmark when the request was started. (in seconds)

Package requester provides commands to run load tests and display results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Mark      float64
	Count     int
	Frequency float64
}

type LatencyDistribution

type LatencyDistribution struct {
	Percentage int
	Latency    float64
}

type Report

type Report struct {
	AvgTotal float64
	Fastest  float64
	Slowest  float64
	Average  float64
	Rps      float64

	AvgConn  float64
	AvgDNS   float64
	AvgReq   float64
	AvgRes   float64
	AvgDelay float64
	ConnMax  float64
	ConnMin  float64
	DnsMax   float64
	DnsMin   float64
	ReqMax   float64
	ReqMin   float64
	ResMax   float64
	ResMin   float64
	DelayMax float64
	DelayMin float64

	Lats        []float64
	ConnLats    []float64
	DnsLats     []float64
	ReqLats     []float64
	ResLats     []float64
	DelayLats   []float64
	Offsets     []float64
	StatusCodes []int

	Total time.Duration

	ErrorDist      map[string]int
	StatusCodeDist map[int]int
	SizeTotal      int64
	SizeReq        int64
	NumRes         int64

	LatencyDistribution []LatencyDistribution
	Histogram           []Bucket
}

type Work

type Work struct {
	// Request is the request to be made.
	Request *http.Request

	RequestBody []byte

	// RequestFunc is a function to generate requests. If it is nil, then
	// Request and RequestData are cloned for each request.
	RequestFunc func() *http.Request

	// N is the total number of requests to make.
	N int

	// C is the concurrency level, the number of concurrent workers to run.
	C int

	// H2 is an option to make HTTP/2 requests
	H2 bool

	// Timeout in seconds.
	Timeout int

	// Qps is the rate limit in queries per second.
	QPS float64

	// DisableCompression is an option to disable compression in response
	DisableCompression bool

	// DisableKeepAlives is an option to prevents re-use of TCP connections between different HTTP requests
	DisableKeepAlives bool

	// DisableRedirects is an option to prevent the following of HTTP redirects
	DisableRedirects bool

	// Output represents the output type. If "csv" is provided, the
	// output will be dumped as a csv stream.
	Output string

	// ProxyAddr is the address of HTTP proxy server in the format on "host:port".
	// Optional.
	ProxyAddr *url.URL

	// Writer is where results will be written. If nil, results are written to stdout.
	Writer io.Writer

	// optional tls config
	TLSClientConfig *tls.Config
	// contains filtered or unexported fields
}

func (*Work) Finish

func (b *Work) Finish()

func (*Work) Init

func (b *Work) Init()

Init initializes internal data-structures

func (*Work) Run

func (b *Work) Run()

Run makes all the requests, prints the summary. It blocks until all work is done.

func (*Work) Stop

func (b *Work) Stop()

Jump to

Keyboard shortcuts

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