fortio: Index | Files

package tcprunner

import ""


Package Files



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

func GeneratePayload Uses

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

Generates a 24 bytes unique payload for each runner thread and message sent.

type RunnerOptions Uses

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

RunnerOptions includes the base RunnerOptions plus tcp specific options.

type RunnerResults Uses

type RunnerResults struct {
    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 Uses

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 Uses

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 Uses

type TCPClient struct {
    // contains filtered or unexported fields

TCPClient is the client used for tcp echo testing.

func NewTCPClient Uses

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

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

func (*TCPClient) Close Uses

func (c *TCPClient) Close() int

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

func (*TCPClient) Fetch Uses

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

type TCPOptions Uses

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 Uses

type TCPResultMap map[string]int64

Package tcprunner imports 11 packages (graph) and is imported by 4 packages. Updated 2020-12-01. Refresh now. Tools for package owners.