loader

package
v0.0.0-...-73a077e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	USER_AGENT = "go-wrk"
)

Variables

Functions

func DoRequest

func DoRequest(httpClient *http.Client, header map[string]string, method, host, loadUrl, reqBody string, script *ScriptContext) (respSize int, duration time.Duration)

DoRequest single request implementation. Returns the size of the response and its duration On error - returns -1 on both

Types

type Config

type Config struct {
	Duration           int    `json:"duration"` //seconds
	Goroutines         int    `json:"goroutines"`
	Timeoutms          int    `json:"timeoutms"`
	AllowRedirects     bool   `json:"redir"`
	DisableCompression bool   `json:"no_comp"`
	DisableKeepAlive   bool   `json:"no_keepalive"`
	SkipVerify         bool   `json:"skip_verify"`
	ClientCert         string `json:"client_cert"`
	ClientKey          string `json:"client_key"`
	CaCert             string `json:"ca_cert"`
	Http2              bool   `json:"http2"`
	RequestConfig
	Id int64 `json:"id"`
}

func NewConfig

func NewConfig() Config

func (Config) Clone

func (c Config) Clone() Config

type RequestConfig

type RequestConfig struct {
	Method  string            `json:"method"`
	Host    string            `json:"host"`
	Header  map[string]string `json:"header"`
	TestUrl string            `json:"url"`
	ReqBody string            `json:"body"`
}

type RequesterStats

type RequesterStats struct {
	TotRespSize    int64
	TotDuration    time.Duration
	MinRequestTime time.Duration
	MaxRequestTime time.Duration
	NumRequests    int
	NumErrs        int
}

RequesterStats used for colelcting aggregate statistics

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(cfg Config, statsAggregater chan *RequesterStats) *Runner

func (*Runner) RunSingleSession

func (runner *Runner) RunSingleSession(script *ScriptContext)

Requester a go function for repeatedly making requests and aggregating statistics as long as required When it is done, it sends the results using the statsAggregator channel

func (*Runner) Stop

func (runner *Runner) Stop()

type ScriptContext

type ScriptContext struct {
	Config Config
	// contains filtered or unexported fields
}

func LoadScript

func LoadScript(cfg Config, fn string) (*ScriptContext, error)

Jump to

Keyboard shortcuts

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