tcprunner

package
Version: v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TCPURLPrefix is the URL prefix for triggering tcp load.
	TCPURLPrefix = "tcp://"
	// TCPStatusOK is the map key on success.
	TCPStatusOK = "OK"
)

Functions

func GeneratePayload

func GeneratePayload(t int, i int64) []byte

GeneratePayload generates a default 24 bytes unique payload for each runner thread and message sent when no other payload is set.

Types

type RunnerOptions

type RunnerOptions struct {
	periodic.RunnerOptions
	TCPOptions // Need to call Init() to initialize
}

RunnerOptions includes the base RunnerOptions plus tcp specific options.

type RunnerResults

type RunnerResults struct {
	periodic.RunnerResults
	TCPOptions
	RetCodes      TCPResultMap
	SocketCount   int
	BytesSent     int64
	BytesReceived int64
	// contains filtered or unexported fields
}

RunnerResults is the aggregated result of an TCPRunner. Also is the internal type used per thread/goroutine.

func RunTCPTest

func RunTCPTest(o *RunnerOptions) (*RunnerResults, error)

RunTCPTest runs an tcp test and returns the aggregated stats. Some refactoring to avoid copy-pasta between the now 3 runners would be good.

func (*RunnerResults) Run

func (tcpstate *RunnerResults) Run(t int)

Run tests tcp request fetching. Main call being run at the target QPS. To be set as the Function in RunnerOptions.

type TCPClient

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

TCPClient is the client used for tcp echo testing.

func NewTCPClient

func NewTCPClient(o *TCPOptions) (*TCPClient, error)

NewTCPClient creates and initialize and returns a client based on the TCPOptions.

func (*TCPClient) Close

func (c *TCPClient) Close() int

Close closes the last connection and returns the total number of sockets used for the run.

func (*TCPClient) Fetch

func (c *TCPClient) Fetch() ([]byte, error)

type TCPOptions

type TCPOptions struct {
	Destination      string
	Payload          []byte // what to send (and check)
	UnixDomainSocket string // Path of unix domain socket to use instead of host:port from URL
	ReqTimeout       time.Duration
}

TCPOptions are options to the TCPClient.

type TCPResultMap

type TCPResultMap map[string]int64

Source Files

Jump to

Keyboard shortcuts

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