Documentation
¶
Index ¶
- Constants
- Variables
- func Equal(a, b *Configuration) bool
- func ManagerCreationError(err error) error
- func RegisterBenchmarkServer(s *grpc.Server, srv BenchmarkServer)
- func StartLocalServers(ctx context.Context, n int, opts ...ServerOption) []string
- type Bench
- type Benchmark
- type BenchmarkClient
- type BenchmarkServer
- type ConfigNotFoundError
- type Configuration
- func (c *Configuration) ConcurrentAsync(ctx context.Context, in *Echo) *FutureEcho
- func (c *Configuration) ConcurrentMulticast(in *TimedMsg) error
- func (c *Configuration) ConcurrentQC(ctx context.Context, in *Echo) (resp *Echo, err error)
- func (c *Configuration) ConcurrentSlowServer(ctx context.Context, in *Echo) (resp *Echo, err error)
- func (c *Configuration) ID() uint32
- func (c *Configuration) Multicast(in *TimedMsg) error
- func (c *Configuration) NodeIDs() []uint32
- func (c *Configuration) Nodes() []*Node
- func (c *Configuration) OrderedAsync(ctx context.Context, in *Echo) *FutureEcho
- func (c *Configuration) OrderedQC(ctx context.Context, in *Echo) (resp *Echo, err error)
- func (c *Configuration) OrderedSlowServer(ctx context.Context, in *Echo) (resp *Echo, err error)
- func (c *Configuration) Size() int
- func (c *Configuration) StartBenchmark(ctx context.Context, in *StartRequest) (resp *StartResponse, err error)
- func (c *Configuration) StartServerBenchmark(ctx context.Context, in *StartRequest) (resp *StartResponse, err error)
- func (c *Configuration) StopBenchmark(ctx context.Context, in *StopRequest) (resp *MemoryStatList, err error)
- func (c *Configuration) StopServerBenchmark(ctx context.Context, in *StopRequest) (resp *Result, err error)
- func (c *Configuration) String() string
- func (c *Configuration) SubError() <-chan GRPCError
- func (c *Configuration) UnorderedAsync(ctx context.Context, in *Echo, opts ...grpc.CallOption) *FutureEcho
- func (c *Configuration) UnorderedQC(ctx context.Context, in *Echo, opts ...grpc.CallOption) (resp *Echo, err error)
- func (c *Configuration) UnorderedSlowServer(ctx context.Context, in *Echo, opts ...grpc.CallOption) (resp *Echo, err error)
- type Echo
- type FutureEcho
- type GRPCError
- type GorumsServer
- type IllegalConfigError
- type Manager
- func (m *Manager) AddNode(addr string) error
- func (m *Manager) Close()
- func (m *Manager) Configuration(id uint32) (config *Configuration, found bool)
- func (m *Manager) ConfigurationIDs() []uint32
- func (m *Manager) Configurations() []*Configuration
- func (m *Manager) NewConfiguration(ids []uint32, qspec QuorumSpec) (*Configuration, error)
- func (m *Manager) Node(id uint32) (node *Node, found bool)
- func (m *Manager) NodeIDs() []uint32
- func (m *Manager) Nodes() []*Node
- func (m *Manager) Size() (nodes, configs int)
- type ManagerOption
- func WithBackoff(backoff backoff.Config) ManagerOption
- func WithDialTimeout(timeout time.Duration) ManagerOption
- func WithGrpcDialOptions(opts ...grpc.DialOption) ManagerOption
- func WithLogger(logger *log.Logger) ManagerOption
- func WithNoConnect() ManagerOption
- func WithSendBufferSize(size uint) ManagerOption
- func WithTracing() ManagerOption
- type MemoryStat
- type MemoryStatList
- type MultiSorter
- type Node
- func (n *Node) Address() string
- func (n *Node) FullString() string
- func (n *Node) ID() uint32
- func (n *Node) LastErr() error
- func (n *Node) Latency() time.Duration
- func (n *Node) Port() string
- func (n *Node) String() string
- func (n *Node) UnorderedAsync(ctx context.Context, in *Echo, replyChan chan<- internalEcho)
- func (n *Node) UnorderedQC(ctx context.Context, in *Echo, replyChan chan<- internalEcho)
- func (n *Node) UnorderedSlowServer(ctx context.Context, in *Echo, replyChan chan<- internalEcho)
- type NodeNotFoundError
- type Options
- type QSpec
- func (qspec *QSpec) ConcurrentAsyncQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) ConcurrentQCQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) ConcurrentSlowServerQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) OrderedAsyncQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) OrderedQCQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) OrderedSlowServerQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) StartBenchmarkQF(_ *StartRequest, replies []*StartResponse) (*StartResponse, bool)
- func (qspec *QSpec) StartServerBenchmarkQF(_ *StartRequest, replies []*StartResponse) (*StartResponse, bool)
- func (qspec *QSpec) StopBenchmarkQF(_ *StopRequest, replies []*MemoryStat) (*MemoryStatList, bool)
- func (qspec *QSpec) StopServerBenchmarkQF(_ *StopRequest, replies []*Result) (*Result, bool)
- func (qspec *QSpec) UnorderedAsyncQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) UnorderedQCQF(_ *Echo, replies []*Echo) (*Echo, bool)
- func (qspec *QSpec) UnorderedSlowServerQF(_ *Echo, replies []*Echo) (*Echo, bool)
- type QuorumCallError
- type QuorumSpec
- type Result
- func (*Result) Descriptor() ([]byte, []int)deprecated
- func (r *Result) Format() string
- func (x *Result) GetAllocsPerOp() uint64
- func (x *Result) GetLatencyAvg() float64
- func (x *Result) GetLatencyVar() float64
- func (x *Result) GetMemPerOp() uint64
- func (x *Result) GetName() string
- func (x *Result) GetServerStats() []*MemoryStat
- func (x *Result) GetThroughput() float64
- func (x *Result) GetTotalOps() uint64
- func (x *Result) GetTotalTime() int64
- func (*Result) ProtoMessage()
- func (x *Result) ProtoReflect() protoreflect.Message
- func (x *Result) Reset()
- func (x *Result) String() string
- type Server
- type ServerOption
- type StartRequest
- type StartResponse
- type Stats
- type StopRequest
- type TimedMsg
- type UnimplementedBenchmarkServer
- func (*UnimplementedBenchmarkServer) ConcurrentAsync(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) ConcurrentMulticast(context.Context, *TimedMsg) (*empty.Empty, error)
- func (*UnimplementedBenchmarkServer) ConcurrentQC(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) ConcurrentSlowServer(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) Multicast(context.Context, *TimedMsg) (*empty.Empty, error)
- func (*UnimplementedBenchmarkServer) OrderedAsync(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) OrderedQC(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) OrderedSlowServer(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) StartBenchmark(context.Context, *StartRequest) (*StartResponse, error)
- func (*UnimplementedBenchmarkServer) StartServerBenchmark(context.Context, *StartRequest) (*StartResponse, error)
- func (*UnimplementedBenchmarkServer) StopBenchmark(context.Context, *StopRequest) (*MemoryStat, error)
- func (*UnimplementedBenchmarkServer) StopServerBenchmark(context.Context, *StopRequest) (*Result, error)
- func (*UnimplementedBenchmarkServer) UnorderedAsync(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) UnorderedQC(context.Context, *Echo) (*Echo, error)
- func (*UnimplementedBenchmarkServer) UnorderedSlowServer(context.Context, *Echo) (*Echo, error)
Constants ¶
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 ¶
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.
var File_benchmark_benchmark_proto protoreflect.FileDescriptor
var ID = func(n1, n2 *Node) bool {
return n1.id < n2.id
}
ID sorts nodes by their identifier in increasing order.
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.
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 ¶
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 ¶
func GetBenchmarks ¶
func GetBenchmarks(cfg *Configuration) []Bench
type Benchmark ¶
type Benchmark interface {
StartServerBenchmark(*StartRequest) *StartResponse
StopServerBenchmark(*StopRequest) *Result
StartBenchmark(*StartRequest) *StartResponse
StopBenchmark(*StopRequest) *MemoryStat
OrderedQC(*Echo) *Echo
ConcurrentQC(*Echo) *Echo
OrderedAsync(*Echo) *Echo
ConcurrentAsync(*Echo) *Echo
OrderedSlowServer(*Echo) *Echo
ConcurrentSlowServer(*Echo) *Echo
Multicast(*TimedMsg)
ConcurrentMulticast(*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)
ConcurrentQC(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)
ConcurrentAsync(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)
ConcurrentSlowServer(ctx context.Context, in *Echo, opts ...grpc.CallOption) (*Echo, error)
Multicast(ctx context.Context, in *TimedMsg, opts ...grpc.CallOption) (*empty.Empty, error)
ConcurrentMulticast(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)
ConcurrentQC(context.Context, *Echo) (*Echo, error)
UnorderedAsync(context.Context, *Echo) (*Echo, error)
OrderedAsync(context.Context, *Echo) (*Echo, error)
ConcurrentAsync(context.Context, *Echo) (*Echo, error)
UnorderedSlowServer(context.Context, *Echo) (*Echo, error)
OrderedSlowServer(context.Context, *Echo) (*Echo, error)
ConcurrentSlowServer(context.Context, *Echo) (*Echo, error)
Multicast(context.Context, *TimedMsg) (*empty.Empty, error)
ConcurrentMulticast(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(addrs []string, 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 experimental API.
func (*Configuration) ConcurrentAsync ¶
func (c *Configuration) ConcurrentAsync(ctx context.Context, in *Echo) *FutureEcho
ConcurrentAsync 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) ConcurrentMulticast ¶
func (c *Configuration) ConcurrentMulticast(in *TimedMsg) error
ConcurrentMulticast 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) ConcurrentQC ¶
ConcurrentQC is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.
func (*Configuration) ConcurrentSlowServer ¶
ConcurrentSlowServer is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.
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 ¶
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 ¶
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) GetPayload ¶
func (*Echo) ProtoMessage ¶
func (*Echo) ProtoMessage()
func (*Echo) ProtoReflect ¶
func (x *Echo) ProtoReflect() protoreflect.Message
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 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)
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(nodeAddrs []string, 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 ¶
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 ¶
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) NodeIDs ¶
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.
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 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 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) 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.
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) FullString ¶
FullString returns a more descriptive string representation of n that includes id, network address and latency information.
func (*Node) LastErr ¶
LastErr returns the last error encountered (if any) when invoking a remote procedure call on this node.
func (*Node) Latency ¶
Latency returns the latency of the last successful remote procedure call made to this node.
func (*Node) UnorderedAsync ¶
func (*Node) UnorderedQC ¶
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 ¶
QSpec is the quorum specification object for the benchmark
func (*QSpec) ConcurrentAsyncQF ¶
ConcurrentAsyncQF is the quorum function for the ConcurrentAsync quorumcall
func (*QSpec) ConcurrentQCQF ¶
ConcurrentQCQF is the quorum function for the ConcurrentQC quorumcall
func (*QSpec) ConcurrentSlowServerQF ¶
ConcurrentSlowServerQF is the quorum function for the ConcurrentSlowServer quorumcall
func (*QSpec) OrderedAsyncQF ¶
OrderedAsyncQF is the quorum function for the OrderedAsync quorumcall
func (*QSpec) OrderedQCQF ¶
OrderedQCQF is the quorum function for the OrderedQC quorumcall
func (*QSpec) OrderedSlowServerQF ¶
OrderedSlowServerQF is the quorum function for the OrderedSlowServer quorumcall
func (*QSpec) StartBenchmarkQF ¶
func (qspec *QSpec) StartBenchmarkQF(_ *StartRequest, replies []*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 []*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 []*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 []*Result) (*Result, bool)
StopServerBenchmarkQF is the quorum function for the StopServerBenchmark quorumcall. It requires a response from all nodes.
func (*QSpec) UnorderedAsyncQF ¶
UnorderedAsyncQF is the quorum function for the UnorderedAsync quorumcall
func (*QSpec) UnorderedQCQF ¶
UnorderedQCQF is the quorum function for the UnorderedQC quorumcall
type QuorumCallError ¶
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 []*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 []*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 []*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 []*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 []*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 []*Echo) (*Echo, bool)
// ConcurrentQCQF is the quorum function for the ConcurrentQC
// ordered quorum call method. The in parameter is the request object
// supplied to the ConcurrentQC 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'.
ConcurrentQCQF(in *Echo, replies []*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 []*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 []*Echo) (*Echo, bool)
// ConcurrentAsyncQF is the quorum function for the ConcurrentAsync
// asynchronous ordered quorum call method. The in parameter is the request object
// supplied to the ConcurrentAsync 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'.
ConcurrentAsyncQF(in *Echo, replies []*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 []*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 []*Echo) (*Echo, bool)
// ConcurrentSlowServerQF is the quorum function for the ConcurrentSlowServer
// ordered quorum call method. The in parameter is the request object
// supplied to the ConcurrentSlowServer 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'.
ConcurrentSlowServerQF(in *Echo, replies []*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 ¶
RunBenchmarks runs all the benchmarks that match the given regex with the given options
func (*Result) Descriptor
deprecated
func (*Result) GetAllocsPerOp ¶
func (*Result) GetLatencyAvg ¶
func (*Result) GetLatencyVar ¶
func (*Result) GetMemPerOp ¶
func (*Result) GetServerStats ¶
func (x *Result) GetServerStats() []*MemoryStat
func (*Result) GetThroughput ¶
func (*Result) GetTotalOps ¶
func (*Result) GetTotalTime ¶
func (*Result) ProtoMessage ¶
func (*Result) ProtoMessage()
func (*Result) ProtoReflect ¶
func (x *Result) ProtoReflect() protoreflect.Message
type Server ¶
type Server struct {
*GorumsServer
// contains filtered or unexported fields
}
Server is a unified server for both ordered and unordered methods
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 ¶
AddLatency adds a latency measurement
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) GetPayload ¶
func (*TimedMsg) GetSendTime ¶
func (*TimedMsg) ProtoMessage ¶
func (*TimedMsg) ProtoMessage()
func (*TimedMsg) ProtoReflect ¶
func (x *TimedMsg) ProtoReflect() protoreflect.Message
type UnimplementedBenchmarkServer ¶
type UnimplementedBenchmarkServer struct {
}
UnimplementedBenchmarkServer must be embedded to have forward compatible implementations.
func (*UnimplementedBenchmarkServer) ConcurrentAsync ¶
func (*UnimplementedBenchmarkServer) ConcurrentMulticast ¶
func (*UnimplementedBenchmarkServer) ConcurrentQC ¶
func (*UnimplementedBenchmarkServer) ConcurrentSlowServer ¶
func (*UnimplementedBenchmarkServer) OrderedAsync ¶
func (*UnimplementedBenchmarkServer) OrderedSlowServer ¶
func (*UnimplementedBenchmarkServer) StartBenchmark ¶
func (*UnimplementedBenchmarkServer) StartBenchmark(context.Context, *StartRequest) (*StartResponse, error)
func (*UnimplementedBenchmarkServer) StartServerBenchmark ¶
func (*UnimplementedBenchmarkServer) StartServerBenchmark(context.Context, *StartRequest) (*StartResponse, error)
func (*UnimplementedBenchmarkServer) StopBenchmark ¶
func (*UnimplementedBenchmarkServer) StopBenchmark(context.Context, *StopRequest) (*MemoryStat, error)
func (*UnimplementedBenchmarkServer) StopServerBenchmark ¶
func (*UnimplementedBenchmarkServer) StopServerBenchmark(context.Context, *StopRequest) (*Result, error)