httpbench

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

[TOC]

Purpose

Fine tuned http/s benchmark framework with synchronization across requests and detailed trace.

Motivation

In order to reliably test invocation latency and benchmark FaaS providers, a benchmark tool with fine grained control over the request and the results. The major issue with current benchmarking tools is that they didn't allow us to synchronize between the stages of request while testing.

For example, a simple test of 3 concurrent requests with a delay of 20ms to an endpoint resulted in an unreliable invocation latency results, because it took into affect the dns resolve time, the tcp handshake and tlshandshake time, and the delay didn't have the desired effect, requests invoked the endpoint in random times.

This was due to the fact that the invocation accord AFTER the tlshandshake.

httpbench allowed us to wait for the 3 concurrent requests to finished the tls handshake, and then release each one with 20ms delay between them.

Hooks

Hooks

	GetConn
	DNSStart
	DNSDone
	ConnectStart
	ConnectDone
	TLSHandshakeStart
	TLSHandshakeDone
	GotConn
	WroteHeaders
	WroteRequest
	Got100Continue
	GotFirstResponseByte
	Wait100Continue

Presets

Over time presets where added to enable more test types:

RequestPerDuration

RequestPerDuration

ConcurrentRequestsUnsynced

ConcurrentRequestsUnsynced

ConcurrentRequestsSynced

ConcurrentRequestsSynced

ConcurrentRequestsSyncedOnce

ConcurrentRequestsSyncedOnce

RequestsForTimeGraph

RequestsForTimeGraph

ConcurrentForTimeGraph

ConcurrentForTimeGraph

Test

Should trust the included private key in order to run locally (or add your own trusted one) Integration tests cannot run parallel at the moment (TODO: add different server process for each test in order to run parallel)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentGraph

type ConcurrentGraph []RequestsPerTime

type HitsGraph

type HitsGraph []RequestsPerTime

type Preset

type Preset struct {
	ResultCh   chan *engine.TraceResult
	NewRequest func(uniqueId string) (*http.Request, error)
	Hook       syncedtrace.TraceHookType
	TLSConfig  *tls.Config
}

func New

func New(newRequest func(uniqueId string) (*http.Request, error), hook syncedtrace.TraceHookType, tlsConfig *tls.Config) *Preset

func (*Preset) ConcurrentForTimeGraph

func (p *Preset) ConcurrentForTimeGraph(concurrentGraph ConcurrentGraph) *PresetResult

Unlike RequestsForTimeGraph, in this preset Time represents the absolute time in which the concurrent amount changes, and not the time difference between one point and the next.

func (*Preset) ConcurrentRequestsSynced

func (p *Preset) ConcurrentRequestsSynced(concurrencyLimit uint64, reqDelay time.Duration, duration time.Duration) *PresetResult

func (*Preset) ConcurrentRequestsSyncedOnce

func (p *Preset) ConcurrentRequestsSyncedOnce(concurrencyLimit uint64, reqDelay time.Duration) *PresetResult

func (*Preset) ConcurrentRequestsUnsynced

func (p *Preset) ConcurrentRequestsUnsynced(maxConcurrencyLimit uint64, reqDelay time.Duration, duration time.Duration) *PresetResult

func (*Preset) RequestPerDuration

func (p *Preset) RequestPerDuration(reqDelay time.Duration, duration time.Duration) *PresetResult

func (*Preset) RequestsForTimeGraph

func (p *Preset) RequestsForTimeGraph(hitsGraph HitsGraph) *PresetResult

type PresetResult

type PresetResult struct {
	Start         time.Time `json:"start_time"`
	Done          time.Time `json:"done_time"`
	ReqCount      uint64    `json:"request_count"`
	MaxConcurrent uint64    `json:"max_concurrent"`
}

type PresetType

type PresetType int
const (
	RequestPerDuration PresetType = iota
	ConcurrentRequestsUnsynced
	ConcurrentRequestsSynced
	ConcurrentRequestsSyncedOnce
	RequestsForTimeGraph
	ConcurrentForTimeGraph
	PresetCount
)

func (PresetType) String

func (pt PresetType) String() string

type RequestsPerTime

type RequestsPerTime struct {
	Concurrent uint64        `json:"concurrent"`
	Time       time.Duration `json:"time"`
}

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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