benchmark

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 34 Imported by: 5

Documentation

Index

Constants

View Source
const LevelNotSet = -1

LevelNotSet is the zero value level used to indicate that no level (and thereby no reply) has been set for a correctable quorum call.

Variables

View Source
var Error = func(n1, n2 *Node) bool {
	if n1.lastErr != nil && n2.lastErr == nil {
		return false
	}
	return true
}

Error sorts nodes by their LastErr() status in increasing order. A node with LastErr() != nil is larger than a node with LastErr() == nil.

View Source
var File_benchmark_benchmark_proto protoreflect.FileDescriptor
View Source
var ID = func(n1, n2 *Node) bool {
	return n1.id < n2.id
}

ID sorts nodes by their identifier in increasing order.

View Source
var Latency = func(n1, n2 *Node) bool {
	if n1.latency < 0 {
		return false
	}
	return n1.latency < n2.latency
}

Latency sorts nodes by latency in increasing order. Latencies less then zero (sentinel value) are considered greater than any positive latency.

View Source
var Port = func(n1, n2 *Node) bool {
	p1, _ := strconv.Atoi(n1.Port())
	p2, _ := strconv.Atoi(n2.Port())
	return p1 < p2
}

Port sorts nodes by their port number in increasing order. Warning: This function may be removed in the future.

Functions

func Equal

func Equal(a, b *Configuration) bool

Equal returns a boolean reporting whether a and b represents the same configuration.

func ManagerCreationError

func ManagerCreationError(err error) error

ManagerCreationError returns an error reporting that a Manager could not be created due to err.

func RegisterBenchmarkServer

func RegisterBenchmarkServer(s *grpc.Server, srv BenchmarkServer)

func StartLocalServers

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

StartLocalServers starts benchmark servers locally

Types

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(cfg *Configuration) []Bench

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

type Benchmark

type Benchmark interface {
	StartServerBenchmark(context.Context, *StartRequest, func(*StartResponse, error))
	StopServerBenchmark(context.Context, *StopRequest, func(*Result, error))
	StartBenchmark(context.Context, *StartRequest, func(*StartResponse, error))
	StopBenchmark(context.Context, *StopRequest, func(*MemoryStat, error))
	OrderedQC(context.Context, *Echo, func(*Echo, error))
	OrderedAsync(context.Context, *Echo, func(*Echo, error))
	OrderedSlowServer(context.Context, *Echo, func(*Echo, error))
	Multicast(context.Context, *TimedMsg)
}

Benchmark is the server-side API for the Benchmark Service

type BenchmarkClient

type BenchmarkClient interface {
	StartServerBenchmark(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
	StopServerBenchmark(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*Result, error)
	StartBenchmark(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
	StopBenchmark(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*MemoryStat, error)
	// benchmarks
	UnorderedQC(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	OrderedQC(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	UnorderedAsync(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	OrderedAsync(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	UnorderedSlowServer(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	OrderedSlowServer(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
	Multicast(ctx context.Context, in *TimedMsg, opts ...grpc.CallOption) (*empty.Empty, error)
}

BenchmarkClient is the client API for Benchmark service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewBenchmarkClient

func NewBenchmarkClient(cc grpc.ClientConnInterface) BenchmarkClient

type BenchmarkServer

type BenchmarkServer interface {
	StartServerBenchmark(context.Context, *StartRequest) (*StartResponse, error)
	StopServerBenchmark(context.Context, *StopRequest) (*Result, error)
	StartBenchmark(context.Context, *StartRequest) (*StartResponse, error)
	StopBenchmark(context.Context, *StopRequest) (*MemoryStat, error)
	// benchmarks
	UnorderedQC(context.Context, *Echo) (*Echo, error)
	OrderedQC(context.Context, *Echo) (*Echo, error)
	UnorderedAsync(context.Context, *Echo) (*Echo, error)
	OrderedAsync(context.Context, *Echo) (*Echo, error)
	UnorderedSlowServer(context.Context, *Echo) (*Echo, error)
	OrderedSlowServer(context.Context, *Echo) (*Echo, error)
	Multicast(context.Context, *TimedMsg) (*empty.Empty, error)
	// contains filtered or unexported methods
}

BenchmarkServer is the server API for Benchmark service. All implementations must embed UnimplementedBenchmarkServer for forward compatibility

type ConfigNotFoundError

type ConfigNotFoundError uint32

A ConfigNotFoundError reports that a specified configuration could not be found.

func (ConfigNotFoundError) Error

func (e ConfigNotFoundError) Error() string

type Configuration

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

A Configuration represents a static set of nodes on which quorum remote procedure calls may be invoked.

func NewConfig

func NewConfig(qspec QuorumSpec, opts ...ManagerOption) (*Configuration, func(), error)

NewConfig returns a configuration for the given node addresses and quorum spec. The returned func() must be called to close the underlying connections. This is an experimental API.

func (*Configuration) ID

func (c *Configuration) ID() uint32

ID reports the identifier for the configuration.

func (*Configuration) Multicast

func (c *Configuration) Multicast(in *TimedMsg) error

Multicast is a one-way multicast call on all nodes in configuration c, with the same in argument. The call is asynchronous and has no return value.

func (*Configuration) NodeIDs

func (c *Configuration) NodeIDs() []uint32

NodeIDs returns a slice containing the local ids of all the nodes in the configuration. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) Nodes

func (c *Configuration) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) OrderedAsync

func (c *Configuration) OrderedAsync(ctx context.Context, in *Echo) *FutureEcho

OrderedAsync asynchronously invokes a quorum call on configuration c and returns a FutureEcho, which can be used to inspect the quorum call reply and error when available.

func (*Configuration) OrderedQC

func (c *Configuration) OrderedQC(ctx context.Context, in *Echo) (resp *Echo, err error)

OrderedQC is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) OrderedSlowServer

func (c *Configuration) OrderedSlowServer(ctx context.Context, in *Echo) (resp *Echo, err error)

OrderedSlowServer is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) Size

func (c *Configuration) Size() int

Size returns the number of nodes in the configuration.

func (*Configuration) StartBenchmark

func (c *Configuration) StartBenchmark(ctx context.Context, in *StartRequest) (resp *StartResponse, err error)

StartBenchmark is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) StartServerBenchmark

func (c *Configuration) StartServerBenchmark(ctx context.Context, in *StartRequest) (resp *StartResponse, err error)

StartServerBenchmark is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) StopBenchmark

func (c *Configuration) StopBenchmark(ctx context.Context, in *StopRequest) (resp *MemoryStatList, err error)

StopBenchmark is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) StopServerBenchmark

func (c *Configuration) StopServerBenchmark(ctx context.Context, in *StopRequest) (resp *Result, err error)

StopServerBenchmark is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) String

func (c *Configuration) String() string

func (*Configuration) SubError

func (c *Configuration) SubError() <-chan GRPCError

SubError returns a channel for listening to individual node errors. Currently only a single listener is supported.

func (*Configuration) UnorderedAsync

func (c *Configuration) UnorderedAsync(ctx context.Context, in *Echo, opts ...grpc.CallOption) *FutureEcho

UnorderedAsync asynchronously invokes a quorum call on configuration c and returns a FutureEcho, which can be used to inspect the quorum call reply and error when available.

func (*Configuration) UnorderedQC

func (c *Configuration) UnorderedQC(ctx context.Context, in *Echo, opts ...grpc.CallOption) (resp *Echo, err error)

benchmarks

func (*Configuration) UnorderedSlowServer

func (c *Configuration) UnorderedSlowServer(ctx context.Context, in *Echo, opts ...grpc.CallOption) (resp *Echo, err error)

UnorderedSlowServer is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

type Echo

type Echo struct {
	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*Echo) Descriptor deprecated

func (*Echo) Descriptor() ([]byte, []int)

Deprecated: Use Echo.ProtoReflect.Descriptor instead.

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) String

func (x *Echo) String() string

type FutureEcho

type FutureEcho struct {
	// the actual reply
	*Echo
	NodeIDs []uint32
	// contains filtered or unexported fields
}

FutureEcho is a future object for processing replies.

func (*FutureEcho) Done

func (f *FutureEcho) Done() bool

Done reports if a reply and/or error is available for the called method.

func (*FutureEcho) Get

func (f *FutureEcho) Get() (*Echo, error)

Get returns the reply and any error associated with the called method. The method blocks until a reply or error is available.

type GRPCError

type GRPCError struct {
	NodeID uint32
	Cause  error
}

GRPCError is used to report that a single gRPC call failed.

func (GRPCError) Error

func (e GRPCError) Error() string

type GorumsServer

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

GorumsServer serves all ordering based RPCs using registered handlers.

func NewGorumsServer

func NewGorumsServer(opts ...ServerOption) *GorumsServer

NewGorumsServer returns a new instance of GorumsServer.

func (*GorumsServer) GracefulStop

func (s *GorumsServer) GracefulStop()

GracefulStop waits for all RPCs to finish before stopping.

func (*GorumsServer) RegisterBenchmarkServer

func (s *GorumsServer) RegisterBenchmarkServer(srv Benchmark)

func (*GorumsServer) Serve

func (s *GorumsServer) Serve(listener net.Listener) error

Serve starts serving on the listener.

func (*GorumsServer) Stop

func (s *GorumsServer) Stop()

Stop stops the server immediately.

type IllegalConfigError

type IllegalConfigError string

An IllegalConfigError reports that a specified configuration could not be created.

func (IllegalConfigError) Error

func (e IllegalConfigError) Error() string

type Manager

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

Manager manages a pool of node configurations on which quorum remote procedure calls can be made.

func NewManager

func NewManager(opts ...ManagerOption) (*Manager, error)

NewManager attempts to connect to the given set of node addresses and if successful returns a new Manager containing connections to those nodes.

func (*Manager) AddNode

func (m *Manager) AddNode(addr string) error

AddNode attempts to dial to the provide node address. The node is added to the Manager's pool of nodes if a connection was established.

func (*Manager) Close

func (m *Manager) Close()

Close closes all node connections and any client streams.

func (*Manager) Configuration

func (m *Manager) Configuration(id uint32) (config *Configuration, found bool)

Configuration returns the configuration with the given global identifier if present.

func (*Manager) ConfigurationIDs

func (m *Manager) ConfigurationIDs() []uint32

ConfigurationIDs returns the identifier of each available configuration.

func (*Manager) Configurations

func (m *Manager) Configurations() []*Configuration

Configurations returns a slice of each available configuration.

func (*Manager) NewConfiguration

func (m *Manager) NewConfiguration(ids []uint32, qspec QuorumSpec) (*Configuration, error)

NewConfiguration returns a new configuration given quorum specification and a timeout.

func (*Manager) Node

func (m *Manager) Node(id uint32) (node *Node, found bool)

Node returns the node with the given identifier if present.

func (*Manager) NodeIDs

func (m *Manager) NodeIDs() []uint32

NodeIDs returns the identifier of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Nodes

func (m *Manager) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Size

func (m *Manager) Size() (nodes, configs int)

Size returns the number of nodes and configurations in the Manager.

type ManagerOption

type ManagerOption func(*managerOptions)

ManagerOption provides a way to set different options on a new Manager.

func WithBackoff

func WithBackoff(backoff backoff.Config) ManagerOption

WithBackoff allows for changing the backoff delays used by Gorums.

func WithDialTimeout

func WithDialTimeout(timeout time.Duration) ManagerOption

WithDialTimeout returns a ManagerOption which is used to set the dial context timeout to be used when initially connecting to each node in its pool.

func WithGrpcDialOptions

func WithGrpcDialOptions(opts ...grpc.DialOption) ManagerOption

WithGrpcDialOptions returns a ManagerOption which sets any gRPC dial options the Manager should use when initially connecting to each node in its pool.

func WithLogger

func WithLogger(logger *log.Logger) ManagerOption

WithLogger returns a ManagerOption which sets an optional error logger for the Manager.

func WithMetadata added in v0.2.1

func WithMetadata(md metadata.MD) ManagerOption

WithMetadata returns a ManagerOption that sets the metadata that is sent to each node when the connection is initially established. This metadata can be retrieved from the server-side method handlers.

func WithNoConnect

func WithNoConnect() ManagerOption

WithNoConnect returns a ManagerOption which instructs the Manager not to connect to any of its nodes. Mainly used for testing purposes.

func WithNodeList added in v0.2.1

func WithNodeList(addrsList []string) ManagerOption

WithNodeList returns a ManagerOption containing the provided list of node addresses. With this option, NodeIDs are generated by the Manager.

func WithNodeMap added in v0.2.1

func WithNodeMap(idMap map[string]uint32) ManagerOption

WithNodeMap returns a ManagerOption containing the provided mapping from node addresses to application-specific IDs.

func WithPerNodeMetadata added in v0.2.1

func WithPerNodeMetadata(f func(uint32) metadata.MD) ManagerOption

WithPerNodeMetadata returns a ManagerOption that allows you to set metadata for each node individually.

func WithSendBufferSize

func WithSendBufferSize(size uint) ManagerOption

WithSendBufferSize allows for changing the size of the send buffer used by Gorums. A larger buffer might achieve higher throughput for asynchronous calltypes, but at the cost of latency.

func WithTracing

func WithTracing() ManagerOption

WithTracing controls whether to trace quorum calls for this Manager instance using the golang.org/x/net/trace package. Tracing is currently only supported for regular quorum calls.

type MemoryStat

type MemoryStat struct {
	Allocs uint64 `protobuf:"varint,1,opt,name=Allocs,proto3" json:"Allocs,omitempty"`
	Memory uint64 `protobuf:"varint,2,opt,name=Memory,proto3" json:"Memory,omitempty"`
	// contains filtered or unexported fields
}

func (*MemoryStat) Descriptor deprecated

func (*MemoryStat) Descriptor() ([]byte, []int)

Deprecated: Use MemoryStat.ProtoReflect.Descriptor instead.

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) String

func (x *MemoryStat) String() string

type MemoryStatList

type MemoryStatList struct {
	MemoryStats []*MemoryStat `protobuf:"bytes,1,rep,name=MemoryStats,proto3" json:"MemoryStats,omitempty"`
	// contains filtered or unexported fields
}

func (*MemoryStatList) Descriptor deprecated

func (*MemoryStatList) Descriptor() ([]byte, []int)

Deprecated: Use MemoryStatList.ProtoReflect.Descriptor instead.

func (*MemoryStatList) GetMemoryStats

func (x *MemoryStatList) GetMemoryStats() []*MemoryStat

func (*MemoryStatList) ProtoMessage

func (*MemoryStatList) ProtoMessage()

func (*MemoryStatList) ProtoReflect

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

func (*MemoryStatList) Reset

func (x *MemoryStatList) Reset()

func (*MemoryStatList) String

func (x *MemoryStatList) String() string

type MultiSorter

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

MultiSorter implements the Sort interface, sorting the nodes within.

func OrderedBy

func OrderedBy(less ...lessFunc) *MultiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func (*MultiSorter) Len

func (ms *MultiSorter) Len() int

Len is part of sort.Interface.

func (*MultiSorter) Less

func (ms *MultiSorter) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by looping along the less functions until it finds a comparison that is either Less or !Less. Note that it can call the less functions twice per call. We could change the functions to return -1, 0, 1 and reduce the number of calls for greater efficiency: an exercise for the reader.

func (*MultiSorter) Sort

func (ms *MultiSorter) Sort(nodes []*Node)

Sort sorts the argument slice according to the less functions passed to OrderedBy.

func (*MultiSorter) Swap

func (ms *MultiSorter) Swap(i, j int)

Swap is part of sort.Interface.

type Node

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

Node encapsulates the state of a node on which a remote procedure call can be performed.

func (*Node) Address

func (n *Node) Address() string

Address returns network address of n.

func (*Node) FullString

func (n *Node) FullString() string

FullString returns a more descriptive string representation of n that includes id, network address and latency information.

func (*Node) ID

func (n *Node) ID() uint32

ID returns the ID of n.

func (*Node) LastErr

func (n *Node) LastErr() error

LastErr returns the last error encountered (if any) when invoking a remote procedure call on this node.

func (*Node) Latency

func (n *Node) Latency() time.Duration

Latency returns the latency of the last successful remote procedure call made to this node.

func (*Node) Port

func (n *Node) Port() string

Port returns network port of n.

func (*Node) String

func (n *Node) String() string

func (*Node) UnorderedAsync

func (n *Node) UnorderedAsync(ctx context.Context, in *Echo, replyChan chan<- internalEcho)

func (*Node) UnorderedQC

func (n *Node) UnorderedQC(ctx context.Context, in *Echo, replyChan chan<- internalEcho)

func (*Node) UnorderedSlowServer

func (n *Node) UnorderedSlowServer(ctx context.Context, in *Echo, replyChan chan<- internalEcho)

type NodeNotFoundError

type NodeNotFoundError uint32

A NodeNotFoundError reports that a specified node could not be found.

func (NodeNotFoundError) Error

func (e NodeNotFoundError) Error() string

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 QSpec

type QSpec struct {
	CfgSize int
	QSize   int
}

QSpec is the quorum specification object for the benchmark

func (*QSpec) ConcurrentAsyncQF

func (qspec *QSpec) ConcurrentAsyncQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

ConcurrentAsyncQF is the quorum function for the ConcurrentAsync quorumcall

func (*QSpec) ConcurrentQCQF

func (qspec *QSpec) ConcurrentQCQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

ConcurrentQCQF is the quorum function for the ConcurrentQC quorumcall

func (*QSpec) ConcurrentSlowServerQF

func (qspec *QSpec) ConcurrentSlowServerQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

ConcurrentSlowServerQF is the quorum function for the ConcurrentSlowServer quorumcall

func (*QSpec) OrderedAsyncQF

func (qspec *QSpec) OrderedAsyncQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

OrderedAsyncQF is the quorum function for the OrderedAsync quorumcall

func (*QSpec) OrderedQCQF

func (qspec *QSpec) OrderedQCQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

OrderedQCQF is the quorum function for the OrderedQC quorumcall

func (*QSpec) OrderedSlowServerQF

func (qspec *QSpec) OrderedSlowServerQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

OrderedSlowServerQF is the quorum function for the OrderedSlowServer quorumcall

func (*QSpec) StartBenchmarkQF

func (qspec *QSpec) StartBenchmarkQF(_ *StartRequest, replies map[uint32]*StartResponse) (*StartResponse, bool)

StartBenchmarkQF is the quorum function for the StartBenchmark quorumcall. It requires a response from all nodes.

func (*QSpec) StartServerBenchmarkQF

func (qspec *QSpec) StartServerBenchmarkQF(_ *StartRequest, replies map[uint32]*StartResponse) (*StartResponse, bool)

StartServerBenchmarkQF is the quorum function for the StartServerBenchmark quorumcall. It requires a response from all nodes.

func (*QSpec) StopBenchmarkQF

func (qspec *QSpec) StopBenchmarkQF(_ *StopRequest, replies map[uint32]*MemoryStat) (*MemoryStatList, bool)

StopBenchmarkQF is the quorum function for the StopBenchmark quorumcall. It requires a response from all nodes.

func (*QSpec) StopServerBenchmarkQF

func (qspec *QSpec) StopServerBenchmarkQF(_ *StopRequest, replies map[uint32]*Result) (*Result, bool)

StopServerBenchmarkQF is the quorum function for the StopServerBenchmark quorumcall. It requires a response from all nodes.

func (*QSpec) UnorderedAsyncQF

func (qspec *QSpec) UnorderedAsyncQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

UnorderedAsyncQF is the quorum function for the UnorderedAsync quorumcall

func (*QSpec) UnorderedQCQF

func (qspec *QSpec) UnorderedQCQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

UnorderedQCQF is the quorum function for the UnorderedQC quorumcall

func (*QSpec) UnorderedSlowServerQF

func (qspec *QSpec) UnorderedSlowServerQF(_ *Echo, replies map[uint32]*Echo) (*Echo, bool)

UnorderedSlowServerQF is the quorum function for the UnorderedSlowServer quorumcall

type QuorumCallError

type QuorumCallError struct {
	Reason     string
	ReplyCount int
	Errors     []GRPCError
}

A QuorumCallError is used to report that a quorum call failed.

func (QuorumCallError) Error

func (e QuorumCallError) Error() string

type QuorumSpec

type QuorumSpec interface {

	// StartServerBenchmarkQF is the quorum function for the StartServerBenchmark
	// ordered quorum call method. The in parameter is the request object
	// supplied to the StartServerBenchmark method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *StartRequest'.
	StartServerBenchmarkQF(in *StartRequest, replies map[uint32]*StartResponse) (*StartResponse, bool)

	// StopServerBenchmarkQF is the quorum function for the StopServerBenchmark
	// ordered quorum call method. The in parameter is the request object
	// supplied to the StopServerBenchmark method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *StopRequest'.
	StopServerBenchmarkQF(in *StopRequest, replies map[uint32]*Result) (*Result, bool)

	// StartBenchmarkQF is the quorum function for the StartBenchmark
	// ordered quorum call method. The in parameter is the request object
	// supplied to the StartBenchmark method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *StartRequest'.
	StartBenchmarkQF(in *StartRequest, replies map[uint32]*StartResponse) (*StartResponse, bool)

	// StopBenchmarkQF is the quorum function for the StopBenchmark
	// ordered quorum call method. The in parameter is the request object
	// supplied to the StopBenchmark method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *StopRequest'.
	StopBenchmarkQF(in *StopRequest, replies map[uint32]*MemoryStat) (*MemoryStatList, bool)

	// UnorderedQCQF is the quorum function for the UnorderedQC
	// quorum call method. The in parameter is the request object
	// supplied to the UnorderedQC method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	UnorderedQCQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)

	// OrderedQCQF is the quorum function for the OrderedQC
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderedQC method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	OrderedQCQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)

	// UnorderedAsyncQF is the quorum function for the UnorderedAsync
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the UnorderedAsync method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	UnorderedAsyncQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)

	// OrderedAsyncQF is the quorum function for the OrderedAsync
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderedAsync method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	OrderedAsyncQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)

	// UnorderedSlowServerQF is the quorum function for the UnorderedSlowServer
	// quorum call method. The in parameter is the request object
	// supplied to the UnorderedSlowServer method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	UnorderedSlowServerQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)

	// OrderedSlowServerQF is the quorum function for the OrderedSlowServer
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderedSlowServer method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Echo'.
	OrderedSlowServerQF(in *Echo, replies map[uint32]*Echo) (*Echo, bool)
}

QuorumSpec is the interface of quorum functions for Benchmark.

type Result

type Result struct {
	Name        string        `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
	TotalOps    uint64        `protobuf:"varint,2,opt,name=TotalOps,proto3" json:"TotalOps,omitempty"`
	TotalTime   int64         `protobuf:"varint,3,opt,name=TotalTime,proto3" json:"TotalTime,omitempty"`
	Throughput  float64       `protobuf:"fixed64,4,opt,name=Throughput,proto3" json:"Throughput,omitempty"`
	LatencyAvg  float64       `protobuf:"fixed64,5,opt,name=LatencyAvg,proto3" json:"LatencyAvg,omitempty"`
	LatencyVar  float64       `protobuf:"fixed64,6,opt,name=LatencyVar,proto3" json:"LatencyVar,omitempty"`
	AllocsPerOp uint64        `protobuf:"varint,7,opt,name=AllocsPerOp,proto3" json:"AllocsPerOp,omitempty"`
	MemPerOp    uint64        `protobuf:"varint,8,opt,name=MemPerOp,proto3" json:"MemPerOp,omitempty"`
	ServerStats []*MemoryStat `protobuf:"bytes,9,rep,name=ServerStats,proto3" json:"ServerStats,omitempty"`
	// contains filtered or unexported fields
}

func RunBenchmarks

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

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

func (*Result) Descriptor deprecated

func (*Result) Descriptor() ([]byte, []int)

Deprecated: Use Result.ProtoReflect.Descriptor instead.

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) String

func (x *Result) String() string

type Server

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

Server is a unified server for both ordered and unordered methods

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer returns a new Server

type ServerOption

type ServerOption func(*serverOptions)

ServerOption is used to change settings for the GorumsServer

func WithGRPCServerOptions

func WithGRPCServerOptions(opts ...grpc.ServerOption) ServerOption

func WithServerBufferSize

func WithServerBufferSize(size uint) ServerOption

WithServerBufferSize sets the buffer size for the server. A larger buffer may result in higher throughput at the cost of higher latency.

type StartRequest

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

func (*StartRequest) Descriptor deprecated

func (*StartRequest) Descriptor() ([]byte, []int)

Deprecated: Use StartRequest.ProtoReflect.Descriptor instead.

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 StartResponse

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

func (*StartResponse) Descriptor deprecated

func (*StartResponse) Descriptor() ([]byte, []int)

Deprecated: Use StartResponse.ProtoReflect.Descriptor instead.

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 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
}

func (*StopRequest) Descriptor deprecated

func (*StopRequest) Descriptor() ([]byte, []int)

Deprecated: Use StopRequest.ProtoReflect.Descriptor instead.

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 TimedMsg

type TimedMsg struct {
	SendTime int64  `protobuf:"varint,1,opt,name=SendTime,proto3" json:"SendTime,omitempty"`
	Payload  []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*TimedMsg) Descriptor deprecated

func (*TimedMsg) Descriptor() ([]byte, []int)

Deprecated: Use TimedMsg.ProtoReflect.Descriptor instead.

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) String

func (x *TimedMsg) String() string

type UnimplementedBenchmarkServer

type UnimplementedBenchmarkServer struct {
}

UnimplementedBenchmarkServer must be embedded to have forward compatible implementations.

func (*UnimplementedBenchmarkServer) Multicast

func (*UnimplementedBenchmarkServer) OrderedAsync

func (*UnimplementedBenchmarkServer) OrderedQC

func (*UnimplementedBenchmarkServer) OrderedSlowServer

func (*UnimplementedBenchmarkServer) OrderedSlowServer(context.Context, *Echo) (*Echo, error)

func (*UnimplementedBenchmarkServer) StartBenchmark

func (*UnimplementedBenchmarkServer) StartServerBenchmark

func (*UnimplementedBenchmarkServer) StopBenchmark

func (*UnimplementedBenchmarkServer) StopServerBenchmark

func (*UnimplementedBenchmarkServer) UnorderedAsync

func (*UnimplementedBenchmarkServer) UnorderedAsync(context.Context, *Echo) (*Echo, error)

func (*UnimplementedBenchmarkServer) UnorderedQC

func (*UnimplementedBenchmarkServer) UnorderedSlowServer

func (*UnimplementedBenchmarkServer) UnorderedSlowServer(context.Context, *Echo) (*Echo, error)

Jump to

Keyboard shortcuts

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