benchmark

package
v0.0.0-...-553dad5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientEchoCmd = iota
	ClientBroadcastCmd
)
View Source
const (
	MsgServerEcho            = 'e'
	MsgServerBroadcast       = 'b'
	MsgServerBroadcastResult = 'r'
	MsgClientEcho            = 'e'
	MsgClientBroadcast       = 'b'
)

Variables

This section is empty.

Functions

func ParseMessageType

func ParseMessageType(s string) (byte, error)

Types

type ActionCableServerAdapter

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

func (*ActionCableServerAdapter) Receive

func (acsa *ActionCableServerAdapter) Receive() (*serverSentMsg, error)

func (*ActionCableServerAdapter) SendBroadcast

func (acsa *ActionCableServerAdapter) SendBroadcast(payload *Payload) error

func (*ActionCableServerAdapter) SendEcho

func (acsa *ActionCableServerAdapter) SendEcho(payload *Payload) error

func (*ActionCableServerAdapter) Startup

func (acsa *ActionCableServerAdapter) Startup() error

type Benchmark

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

func New

func New(config *Config) *Benchmark

func (*Benchmark) Run

func (b *Benchmark) Run() error

type BinaryServerAdapter

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

func (*BinaryServerAdapter) Receive

func (bsa *BinaryServerAdapter) Receive() (*serverSentMsg, error)

func (*BinaryServerAdapter) SendBroadcast

func (bsa *BinaryServerAdapter) SendBroadcast(payload *Payload) error

func (*BinaryServerAdapter) SendEcho

func (bsa *BinaryServerAdapter) SendEcho(payload *Payload) error

type Client

type Client interface {
	SendEcho() error
	SendBroadcast() error
	ResetRxBroadcastCount() (int, error)
}

type ClientPool

type ClientPool interface {
	New(
		id int,
		dest, origin, serverType string,
		rttResultChan chan time.Duration,
		errChan chan error,
		padding []byte,
	) (Client, error)
	Close() error
}

type Config

type Config struct {
	WebsocketURL       string
	WebsocketOrigin    string
	ServerType         string
	ClientCmd          int
	PayloadPaddingSize int
	InitialClients     int
	StepSize           int
	Concurrent         int
	SampleSize         int
	LimitPercentile    int
	LimitRTT           time.Duration
	TotalSteps         int
	ClientPools        []ClientPool
	ResultRecorder     ResultRecorder
}

type LocalClientPool

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

func NewLocalClientPool

func NewLocalClientPool(laddr *net.TCPAddr) *LocalClientPool

func (*LocalClientPool) Close

func (lcp *LocalClientPool) Close() error

func (*LocalClientPool) New

func (lcp *LocalClientPool) New(
	id int,
	dest, origin, serverType string,
	rttResultChan chan time.Duration,
	errChan chan error,
	padding []byte,
) (Client, error)

type Payload

type Payload struct {
	SendTime time.Time
	Padding  []byte
}

type PhoenixServerAdapter

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

func (*PhoenixServerAdapter) Receive

func (psa *PhoenixServerAdapter) Receive() (*serverSentMsg, error)

func (*PhoenixServerAdapter) SendBroadcast

func (psa *PhoenixServerAdapter) SendBroadcast(payload *Payload) error

func (*PhoenixServerAdapter) SendEcho

func (psa *PhoenixServerAdapter) SendEcho(payload *Payload) error

func (*PhoenixServerAdapter) Startup

func (psa *PhoenixServerAdapter) Startup() error

type RemoteClientPool

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

func NewRemoteClientPool

func NewRemoteClientPool(addr string) (*RemoteClientPool, error)

func (*RemoteClientPool) Close

func (rcp *RemoteClientPool) Close() error

func (*RemoteClientPool) New

func (rcp *RemoteClientPool) New(
	id int,
	dest, origin, serverType string,
	rttResultChan chan time.Duration,
	errChan chan error,
	padding []byte,
) (Client, error)

type ResultRecorder

type ResultRecorder interface {
	Record(
		clientCount int,
		limitPercentile int,
		rttPercentile time.Duration,
		rttMin time.Duration,
		rttMedian time.Duration,
		rttMax time.Duration,
	) error
}

type ServerAdapter

type ServerAdapter interface {
	SendEcho(payload *Payload) error
	SendBroadcast(payload *Payload) error
	Receive() (*serverSentMsg, error)
}

type StandardServerAdapter

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

func (*StandardServerAdapter) Receive

func (ssa *StandardServerAdapter) Receive() (*serverSentMsg, error)

func (*StandardServerAdapter) SendBroadcast

func (ssa *StandardServerAdapter) SendBroadcast(payload *Payload) error

func (*StandardServerAdapter) SendEcho

func (ssa *StandardServerAdapter) SendEcho(payload *Payload) error

type TextResultRecorder

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

func NewTextResultRecorder

func NewTextResultRecorder(w io.Writer) *TextResultRecorder

func (*TextResultRecorder) Record

func (trr *TextResultRecorder) Record(
	clientCount, limitPercentile int,
	rttPercentile, rttMin, rttMedian, rttMax time.Duration,
) error

type Worker

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

func NewWorker

func NewWorker(addr string, port uint16) *Worker

func (*Worker) Serve

func (w *Worker) Serve() error

type WorkerConnectMsg

type WorkerConnectMsg struct {
	Dest       string
	Origin     string
	ServerType string
	Padding    []byte
}

type WorkerErrorMsg

type WorkerErrorMsg struct {
	Msg string
}

type WorkerMsg

type WorkerMsg struct {
	ClientID         int                        `json:"clientID"`
	Type             string                     `json:"type"`
	Connect          *WorkerConnectMsg          `json:"connect,omitempty"`
	RTTResult        *WorkerRTTResultMsg        `json:"rttResult,omitempty"`
	Error            *WorkerErrorMsg            `json:"error,omitempty"`
	RxBroadcastCount *WorkerRxBroadcastCountMsg `json:"rxBroadcastCount,omitempty"`
}

type WorkerRTTResultMsg

type WorkerRTTResultMsg struct {
	Duration time.Duration
}

type WorkerRxBroadcastCountMsg

type WorkerRxBroadcastCountMsg struct {
	Count int
}

Jump to

Keyboard shortcuts

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