benchmark

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_benchmark_benchmark_proto protoreflect.FileDescriptor

Functions

func Multicast added in v0.11.0

func Multicast(ctx *gorums.ConfigContext, in *TimedMsg, opts ...gorums.CallOption) error

Multicast performs a multicast call to all servers.

func QuorumCall added in v0.11.0

func QuorumCall(ctx *gorums.ConfigContext, in *Echo, opts ...gorums.CallOption) *gorums.Responses[*Echo]

QuorumCall performs an echo quorum call on all servers.

func RegisterBenchmarkServer

func RegisterBenchmarkServer(srv *gorums.Server, impl BenchmarkServer)

func SlowServer added in v0.11.0

func SlowServer(ctx *gorums.ConfigContext, in *Echo, opts ...gorums.CallOption) *gorums.Responses[*Echo]

SlowServer performs an echo quorum call on slow servers.

func StartBenchmark added in v0.11.0

func StartBenchmark(ctx *gorums.ConfigContext, in *StartRequest, opts ...gorums.CallOption) *gorums.Responses[*StartResponse]

StartBenchmark starts a client-side benchmark campaign.

func StartLocalServers

func StartLocalServers(ctx context.Context, n int, opts ...gorums.ServerOption) []string

StartLocalServers starts benchmark servers locally

func StartServerBenchmark added in v0.11.0

func StartServerBenchmark(ctx *gorums.ConfigContext, in *StartRequest, opts ...gorums.CallOption) *gorums.Responses[*StartResponse]

StartServerBenchmark starts a server-side benchmark campaign.

func StopBenchmark added in v0.11.0

func StopBenchmark(ctx *gorums.ConfigContext, in *StopRequest, opts ...gorums.CallOption) *gorums.Responses[*MemoryStat]

StopBenchmark stops a client-side benchmark campaign.

func StopServerBenchmark added in v0.11.0

func StopServerBenchmark(ctx *gorums.ConfigContext, in *StopRequest, opts ...gorums.CallOption) *gorums.Responses[*Result]

StopServerBenchmark stops a server-side benchmark campaign.

Types

type AsyncEcho added in v0.3.0

type AsyncEcho = *gorums.Async[*Echo]

AsyncEcho is a future for async quorum calls returning *Echo.

type AsyncMemoryStat added in v0.11.0

type AsyncMemoryStat = *gorums.Async[*MemoryStat]

AsyncMemoryStat is a future for async quorum calls returning *MemoryStat.

type AsyncResult added in v0.11.0

type AsyncResult = *gorums.Async[*Result]

AsyncResult is a future for async quorum calls returning *Result.

type AsyncStartResponse added in v0.11.0

type AsyncStartResponse = *gorums.Async[*StartResponse]

AsyncStartResponse is a future for async quorum calls returning *StartResponse.

type Bench

type Bench struct {
	Name        string
	Description string
	// contains filtered or unexported fields
}

Bench is a Benchmark with a name and description

func GetBenchmarks

func GetBenchmarks(config Configuration) []Bench

GetBenchmarks returns a list of Benchmarks that can be performed on the configuration

type BenchmarkServer

type BenchmarkServer interface {
	StartServerBenchmark(ctx gorums.ServerCtx, request *StartRequest) (response *StartResponse, err error)
	StopServerBenchmark(ctx gorums.ServerCtx, request *StopRequest) (response *Result, err error)
	StartBenchmark(ctx gorums.ServerCtx, request *StartRequest) (response *StartResponse, err error)
	StopBenchmark(ctx gorums.ServerCtx, request *StopRequest) (response *MemoryStat, err error)
	QuorumCall(ctx gorums.ServerCtx, request *Echo) (response *Echo, err error)
	SlowServer(ctx gorums.ServerCtx, request *Echo) (response *Echo, err error)
	Multicast(ctx gorums.ServerCtx, request *TimedMsg)
}

Benchmark is the server-side API for the Benchmark Service

type Configuration

type Configuration = gorums.Configuration

Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.

func NewConfig

func NewConfig(opts ...gorums.Option) (Configuration, error)

NewConfig returns a new Configuration based on the provided [gorums.Option]s. It accepts exactly one gorums.NodeListOption and multiple [gorums.ManagerOption]s. You may use this function to create the initial configuration for a new manager.

Example:

	cfg, err := NewConfig(
	    gorums.WithNodeList([]string{"localhost:8080", "localhost:8081", "localhost:8082"}),
        gorums.WithDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials())),
	)

This is a convenience function for creating a configuration without explicitly creating a manager first. However, the manager can be accessed using the [Configuration.Manager] method. This method should only be used once since it creates a new manager; if a manager already exists, use NewConfiguration instead, and provide the existing manager as the first argument.

func NewConfiguration added in v0.11.0

func NewConfiguration(mgr *Manager, opt gorums.NodeListOption) (Configuration, error)

NewConfiguration returns a configuration based on the provided list of nodes. Nodes can be supplied using WithNodeMap or WithNodeList, or WithNodeIDs. A new configuration can also be created from an existing configuration, using the And, WithNewNodes, Except, and WithoutNodes methods.

type CorrectableEcho added in v0.11.0

type CorrectableEcho = *gorums.Correctable[*Echo]

CorrectableEcho is a correctable object for quorum calls returning *Echo.

type CorrectableMemoryStat added in v0.11.0

type CorrectableMemoryStat = *gorums.Correctable[*MemoryStat]

CorrectableMemoryStat is a correctable object for quorum calls returning *MemoryStat.

type CorrectableResult added in v0.11.0

type CorrectableResult = *gorums.Correctable[*Result]

CorrectableResult is a correctable object for quorum calls returning *Result.

type CorrectableStartResponse added in v0.11.0

type CorrectableStartResponse = *gorums.Correctable[*StartResponse]

CorrectableStartResponse is a correctable object for quorum calls returning *StartResponse.

type Echo

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

Echo is a simple message used for echo benchmarks.

func (*Echo) GetPayload

func (x *Echo) GetPayload() []byte

func (*Echo) ProtoMessage

func (*Echo) ProtoMessage()

func (*Echo) ProtoReflect

func (x *Echo) ProtoReflect() protoreflect.Message

func (*Echo) Reset

func (x *Echo) Reset()

func (*Echo) SetPayload added in v0.8.0

func (x *Echo) SetPayload(v []byte)

func (*Echo) String

func (x *Echo) String() string

type Echo_builder added in v0.8.0

type Echo_builder struct {
	Payload []byte
	// contains filtered or unexported fields
}

func (Echo_builder) Build added in v0.8.0

func (b0 Echo_builder) Build() *Echo

type Manager

type Manager = gorums.Manager

Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.

func NewManager

func NewManager(opts ...gorums.ManagerOption) *Manager

NewManager returns a new Manager for managing connection to nodes added to the manager. This function accepts manager options used to configure various aspects of the manager.

type MemoryStat

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

MemoryStat contains memory statistics for a single server.

func (*MemoryStat) GetAllocs

func (x *MemoryStat) GetAllocs() uint64

func (*MemoryStat) GetMemory

func (x *MemoryStat) GetMemory() uint64

func (*MemoryStat) ProtoMessage

func (*MemoryStat) ProtoMessage()

func (*MemoryStat) ProtoReflect

func (x *MemoryStat) ProtoReflect() protoreflect.Message

func (*MemoryStat) Reset

func (x *MemoryStat) Reset()

func (*MemoryStat) SetAllocs added in v0.8.0

func (x *MemoryStat) SetAllocs(v uint64)

func (*MemoryStat) SetMemory added in v0.8.0

func (x *MemoryStat) SetMemory(v uint64)

func (*MemoryStat) String

func (x *MemoryStat) String() string

type MemoryStat_builder added in v0.8.0

type MemoryStat_builder struct {
	Allocs uint64
	Memory uint64
	// contains filtered or unexported fields
}

func (MemoryStat_builder) Build added in v0.8.0

func (b0 MemoryStat_builder) Build() *MemoryStat

type Node

type Node = gorums.Node

Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.

type Options

type Options struct {
	Concurrent int           // Number of concurrent calls
	Duration   time.Duration // Duration of benchmark
	MaxAsync   int           // Max async calls at once
	NumNodes   int           // Number of nodes to include in configuration
	Payload    int           // Size of message payload
	QuorumSize int           // Number of messages to wait for
	Warmup     time.Duration // Warmup time
	Remote     bool          // Whether the servers are remote (true) or local (false)
}

Options controls different options for the benchmarks

type Result

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

Result contains the results of a server-side benchmarking campaign.

func RunBenchmarks

func RunBenchmarks(benchRegex *regexp.Regexp, options Options, config Configuration) ([]*Result, error)

RunBenchmarks runs all the benchmarks that match the given regex with the given options

func StopServerBenchmarkQF added in v0.11.0

func StopServerBenchmarkQF(replies map[uint32]*Result) (*Result, error)

StopServerBenchmarkQF aggregates StopServerBenchmark responses from all nodes. It combines results, calculating averages and pooled variance.

func (*Result) Format

func (r *Result) Format() string

Format returns a tab formatted string representation of the result

func (*Result) GetAllocsPerOp

func (x *Result) GetAllocsPerOp() uint64

func (*Result) GetLatencyAvg

func (x *Result) GetLatencyAvg() float64

func (*Result) GetLatencyVar

func (x *Result) GetLatencyVar() float64

func (*Result) GetMemPerOp

func (x *Result) GetMemPerOp() uint64

func (*Result) GetName

func (x *Result) GetName() string

func (*Result) GetServerStats

func (x *Result) GetServerStats() []*MemoryStat

func (*Result) GetThroughput

func (x *Result) GetThroughput() float64

func (*Result) GetTotalOps

func (x *Result) GetTotalOps() uint64

func (*Result) GetTotalTime

func (x *Result) GetTotalTime() int64

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) ProtoReflect

func (x *Result) ProtoReflect() protoreflect.Message

func (*Result) Reset

func (x *Result) Reset()

func (*Result) SetAllocsPerOp added in v0.8.0

func (x *Result) SetAllocsPerOp(v uint64)

func (*Result) SetLatencyAvg added in v0.8.0

func (x *Result) SetLatencyAvg(v float64)

func (*Result) SetLatencyVar added in v0.8.0

func (x *Result) SetLatencyVar(v float64)

func (*Result) SetMemPerOp added in v0.8.0

func (x *Result) SetMemPerOp(v uint64)

func (*Result) SetName added in v0.8.0

func (x *Result) SetName(v string)

func (*Result) SetServerStats added in v0.8.0

func (x *Result) SetServerStats(v []*MemoryStat)

func (*Result) SetThroughput added in v0.8.0

func (x *Result) SetThroughput(v float64)

func (*Result) SetTotalOps added in v0.8.0

func (x *Result) SetTotalOps(v uint64)

func (*Result) SetTotalTime added in v0.8.0

func (x *Result) SetTotalTime(v int64)

func (*Result) String

func (x *Result) String() string

type Result_builder added in v0.8.0

type Result_builder struct {
	Name        string
	TotalOps    uint64
	TotalTime   int64
	Throughput  float64
	LatencyAvg  float64
	LatencyVar  float64
	AllocsPerOp uint64
	MemPerOp    uint64
	ServerStats []*MemoryStat
	// contains filtered or unexported fields
}

func (Result_builder) Build added in v0.8.0

func (b0 Result_builder) Build() *Result

type Server

type Server struct {
	*gorums.Server
	// contains filtered or unexported fields
}

Server is a unified server for both ordered and unordered methods

func NewBenchServer added in v0.3.0

func NewBenchServer(opts ...gorums.ServerOption) *Server

NewBenchServer returns a new benchmark server

type StartRequest

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

StartRequest is an empty message for starting a benchmarking campaign.

func (*StartRequest) ProtoMessage

func (*StartRequest) ProtoMessage()

func (*StartRequest) ProtoReflect

func (x *StartRequest) ProtoReflect() protoreflect.Message

func (*StartRequest) Reset

func (x *StartRequest) Reset()

func (*StartRequest) String

func (x *StartRequest) String() string

type StartRequest_builder added in v0.8.0

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

func (StartRequest_builder) Build added in v0.8.0

func (b0 StartRequest_builder) Build() *StartRequest

type StartResponse

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

StartResponse is an empty message to acknowledge the start of a benchmarking campaign.

func (*StartResponse) ProtoMessage

func (*StartResponse) ProtoMessage()

func (*StartResponse) ProtoReflect

func (x *StartResponse) ProtoReflect() protoreflect.Message

func (*StartResponse) Reset

func (x *StartResponse) Reset()

func (*StartResponse) String

func (x *StartResponse) String() string

type StartResponse_builder added in v0.8.0

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

func (StartResponse_builder) Build added in v0.8.0

type Stats

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

Stats records and processes the raw data of a benchmark

func (*Stats) AddLatency

func (s *Stats) AddLatency(l time.Duration)

AddLatency adds a latency measurement

func (*Stats) Clear

func (s *Stats) Clear()

Clear zeroes out the stats

func (*Stats) End

func (s *Stats) End()

End records the end time and memory stats

func (*Stats) GetResult

func (s *Stats) GetResult() *Result

GetResult computes and returns the result of the benchmark

func (*Stats) Start

func (s *Stats) Start()

Start records the start time and memory stats

type StopRequest

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

StopRequest is an empty message for stopping a benchmarking campaign.

func (*StopRequest) ProtoMessage

func (*StopRequest) ProtoMessage()

func (*StopRequest) ProtoReflect

func (x *StopRequest) ProtoReflect() protoreflect.Message

func (*StopRequest) Reset

func (x *StopRequest) Reset()

func (*StopRequest) String

func (x *StopRequest) String() string

type StopRequest_builder added in v0.8.0

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

func (StopRequest_builder) Build added in v0.8.0

func (b0 StopRequest_builder) Build() *StopRequest

type TimedMsg

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

TimedMsg is a message with a send time and a payload used for multicast benchmarks.

func (*TimedMsg) GetPayload

func (x *TimedMsg) GetPayload() []byte

func (*TimedMsg) GetSendTime

func (x *TimedMsg) GetSendTime() int64

func (*TimedMsg) ProtoMessage

func (*TimedMsg) ProtoMessage()

func (*TimedMsg) ProtoReflect

func (x *TimedMsg) ProtoReflect() protoreflect.Message

func (*TimedMsg) Reset

func (x *TimedMsg) Reset()

func (*TimedMsg) SetPayload added in v0.8.0

func (x *TimedMsg) SetPayload(v []byte)

func (*TimedMsg) SetSendTime added in v0.8.0

func (x *TimedMsg) SetSendTime(v int64)

func (*TimedMsg) String

func (x *TimedMsg) String() string

type TimedMsg_builder added in v0.8.0

type TimedMsg_builder struct {
	SendTime int64
	Payload  []byte
	// contains filtered or unexported fields
}

func (TimedMsg_builder) Build added in v0.8.0

func (b0 TimedMsg_builder) Build() *TimedMsg

Jump to

Keyboard shortcuts

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