api

package
v0.0.0-...-3a7e411 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api provides the public datastructures that can be used to create a runtime configuration file.

Index

Constants

This section is empty.

Variables

View Source
var MaxRqsts = 1000000

MaxRqsts is a hard-coded upper limit on how many total requests can be made in a single test run. This limit is enforced regardless of whether heyyall is configured for the number of requests to run or the total run duration.

View Source
var MaxRunDuration = time.Duration(time.Hour * 3)

MaxRunDuration is a hard-coded upper limit on how long the test will be allowed to run. This limit is enforced regardless of whether heyyall is configured for the number of requests to run or the total run duration.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	// URL is the endpoint address
	URL string
	// Method is the HTTP Method
	Method string
	// RqstBody is the request data to be sent to the endpoint
	RqstBody string
	// RqstPercent is the relative weight of how often a request
	// to this endpoint will be made. It's a percent of all requests
	// to be made. As such the RqstPercent of all Endpoints in the
	// config must add to 100.
	RqstPercent int
	// NumRequests is the total number of requests to make. See
	// LoadTestConfig.RunDuration for the behavior when both
	// RunDuration and NumRequests are specified.
	NumRequests int
	// KeyFile is the name of a file, in PEM format, that contains an SSL private
	// key. It will only be used if it has a non-empty value. It will override
	// the KeyFile specified at the LoadTestConfig level.
	KeyFile string
	// CertFile is the name of a file, in PEM format, that contains an SSL
	// certificate. It will only be used if it has a non-empty value. It will
	// override the CertificateFile specified at the LoadTestConfig level.
	CertFile string
}

Endpoint contains the information needed to to send a request, in the desired proportion to total requests, to a given HTTP endpoint (e.g., someplace.com).

type EndpointDetail

type EndpointDetail struct {
	// URL is the endpoint URL
	URL string
	// HTTPMethodStatusDist summarizes, by HTTP method, the number of times a
	// given status was returned (e.g., 200, 201, 404, etc). More specifically,
	// it is a map keyed by HTTP method containing a map keyed by HTTP status
	// referencing the number of times that status was returned.
	HTTPMethodStatusDist map[string]map[int]int
	// HTTPMethodRqstStats provides summary request statistics by HTTP Method. It is
	// map of RqstStats keyed by HTTP method.
	HTTPMethodRqstStats map[string]*RqstStats
}

EndpointDetail is used to report an overview of the results of a load test run for a given endpoint.

type LoadTestConfig

type LoadTestConfig struct {
	// RqstRate is the desired overall requests per second
	RqstRate int
	// MaxConcurrentRqsts is the overall number of simulataneously
	// running requests
	MaxConcurrentRqsts int
	// RunDuration is how long the test will run. It can be expressed
	// in seconds or minutes as xs or xm where x is an integer (e.g.,
	// 10s for 10 seconds, 5m for 5 minutes). Only one of NumRequests or
	// RunDuration can be specified. The tool will exit with an appropriate
	// error message if this isn't true.
	RunDuration string
	// NumRequests is the total number of requests to make. Specifying
	// both RunDuration and NumRequests is an error. See RunDuration
	// above for a bit more info.
	NumRequests int
	// KeyFile is the name of a file, in PEM format, that contains an SSL private
	//  key. It will only be used if it has a non-empty value. It can be overridden
	// at the Endpoint level.
	KeyFile string
	// CertFile is the name of a file, in PEM format, that contains ab SSL
	// certificate. It will only be used if it has a non-empty value. It can be
	// overridden, along with the KeyFile, at the Endpoint level.
	CertFile string
	// Endpoints is the set of endpoints (Endpoint) to make requests to
	Endpoints []Endpoint
}

LoadTestConfig contains all the information needed to configure and execute a load test run

type RqstStats

type RqstStats struct {
	// TimingResultsNanos contains the duration of each request.
	TimingResultsNanos []time.Duration
	// TotalRqsts is the overall number of requests made during the run
	TotalRqsts int64
	// TotalRequestDurationNanos is the sum of all request run durations
	TotalRequestDurationNanos time.Duration
	// MaxRqstDurationNanos is the longest request duration
	MaxRqstDurationNanos time.Duration
	// NormalizedMaxRqstDurationNanos is the longest request duration rejecting outlier
	// durations more than 'x' times the MinRqstDuration
	NormalizedMaxRqstDurationNanos time.Duration
	// MinRqstDurationNanos is the smallest request duration for an endpoint
	MinRqstDurationNanos time.Duration
	// AvgRqstDurationNanos is the average duration of a request for an endpoint
	AvgRqstDurationNanos time.Duration
}

RqstStats contains a set of common runtime stats reported at both the Summary and Endpoint level

type RunResults

type RunResults struct {
	// RunSummary is a roll-up of the detailed run results
	RunSummary RunSummary
	// EndpointSummary describes how often each endpoint was called.
	// It is a map keyed by URL of a map keyed by HTTP verb with a value of
	// number of requests. So it's a summary of how often each HTTP verb
	// was called on each endpoint.
	EndpointSummary map[string]map[string]int
	// EndpointDetails is the per endpoint summary of results keyed by URL
	EndpointDetails map[string]*EndpointDetail `json:",omitempty"`
}

RunResults is used to report an overview of the results of a load test run

type RunSummary

type RunSummary struct {
	// RqstRatePerSec is the overall request rate per second
	// rounded to the nearest integer
	RqstRatePerSec float64
	// RunDurationNanos is the wall clock duration of the test
	RunDurationNanos time.Duration

	// RqstStats is a summary of runtime statistics
	RqstStats RqstStats
	// DNSLookupNanos records how long it took to resolve the hostname to an IP Address
	DNSLookupNanos []time.Duration
	// TCPConnSetupNanos records how long it took to setup the TCP connection
	TCPConnSetupNanos []time.Duration
	// RqstRoundTripNanos records duration from the time the TCP connection was setup
	// until the response was received
	RqstRoundTripNanos []time.Duration
	// TLSHandshakeNanos records the time it took to complete the TLS negotiation with
	// the server. It's only meaningful for HTTPS connections
	TLSHandshakeNanos []time.Duration
}

RunSummary is a roll-up of the detailed run results

Jump to

Keyboard shortcuts

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