Documentation
¶
Index ¶
- type ClientMap
- type ExperimentConfig
- func (c *ExperimentConfig) AllHosts() []string
- func (c *ExperimentConfig) AssignClients() ClientMap
- func (c *ExperimentConfig) AssignReplicas(srcReplicaOpts *orchestrationpb.ReplicaOpts) ReplicaMap
- func (c *ExperimentConfig) ClientsForHost(hostIndex int) int
- func (c *ExperimentConfig) CreateClientOpts() *orchestrationpb.ClientOpts
- func (c *ExperimentConfig) CreateReplicaOpts() *orchestrationpb.ReplicaOpts
- func (c *ExperimentConfig) IsLocal() bool
- func (c *ExperimentConfig) ReplicasForHost(hostIndex int) int
- func (c *ExperimentConfig) String() string
- func (c *ExperimentConfig) TreePosIDs() []hotstuff.ID
- type ReplicaMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExperimentConfig ¶
type ExperimentConfig struct {
// ReplicaHosts is a list of hosts that will run replicas.
ReplicaHosts []string
// ClientHosts is a list of hosts that will run clients.
ClientHosts []string
// Replicas is the total number of replicas.
Replicas int
// Clients is the total number of clients.
Clients int
// Locations is a list of locations for the replicas (optional, but required if TreePositions is set).
// The length of Locations must be equal to the number of replicas, but it may contain duplicates.
// The locations are indexed by the replica ID.
// Entries in Locations must exist in the latency matrix.
Locations []string
// ByzantineStrategy is a map from each strategy to a list of replica IDs exhibiting that strategy.
ByzantineStrategy map[string][]uint32
// TreePositions is a list of tree positions for the replicas (optional).
// The length of TreePositions must be equal to the number of replicas and the entries must be unique.
// The tree positions are indexed by the replica ID.
// The 0th entry in TreePositions is the tree's root, the 1st entry is the root's left child,
// the 2nd entry is the root's right child, and so on.
TreePositions []uint32
// BranchFactor is the branch factor for the tree (required if TreePositions is set).
BranchFactor uint32
// TreeDelta is the waiting time for intermediate nodes in the tree.
TreeDelta time.Duration
// Shuffles the tree exisiting positions if true.
RandomTree bool
// Consensus is the name of the consensus implementation to use.
Consensus string
// Crypto is the name of the crypto implementation to use.
Crypto string
// LeaderRotation is the name of the leader rotation algorithm to use.
LeaderRotation string
// Modules is a list of additional modules to load.
Modules []string
// Metrics is a list of metrics to log.
Metrics []string
// Cue is the path to optional .cue config file.
Cue string
// Exe is the path to the executable deployed to remote hosts.
Exe string
// Output is the path to the experiment data output directory.
Output string
// SshConfig is the path to the SSH config file.
SshConfig string
// CpuProfile enables CPU profiling if true.
CpuProfile bool
// FgProfProfile enables fgprof library if true.
FgProfProfile bool
// MemProfile enables memory profiling if true.
MemProfile bool
// DurationSamples is the number of previous views to consider when predicting view duration.
DurationSamples uint32
// MaxConcurrent is the maximum number of commands sent concurrently by each client.
MaxConcurrent uint32
// PayloadSize is the fixed size, in bytes, of each command sent in a batch by the client.
PayloadSize uint32
// RateLimit is the maximum commands per second a client is allowed to send.
RateLimit float64
// RateStep is the number of commands per second that the client can increase to up its rate.
RateStep float64
// The number of client commands that should be batched together.
BatchSize uint32
// TimeoutMultiplies is the number to multiply the view duration by in case of a timeout.
TimeoutMultiplier float64
// Worker spawns a local worker on the controller.
Worker bool
SharedSeed int64
// Trace enables runtime tracing.
Trace bool
// LogLevel is the string specifying the log level.
LogLevel string
// UseTLS enables TLS.
UseTLS bool
// ClientTimeout specifies the timeout duration of a client.
ClientTimeout time.Duration
// ConnectTimeout specifies the duration of the initial connection timeout.
ConnectTimeout time.Duration
// RateStepInterval is how often the client rate limit should be increased.
RateStepInterval time.Duration
// MeasurementInterval is the time interval between measurements
MeasurementInterval time.Duration
// Duration specifies the entire duration of the experiment.
Duration time.Duration
// ViewTimeout is the duration of the first view.
ViewTimeout time.Duration
// MaxTimeout is the upper limit on view timeouts.
MaxTimeout time.Duration
}
ExperimentConfig holds the configuration for an experiment.
func NewCue ¶
func NewCue(filename string, base *ExperimentConfig) (*ExperimentConfig, error)
NewCue loads a cue configuration from filename and returns a ExperimentConfig struct. The configuration is validated against the schema embedded in the binary. One can specify the `base` config to overwrite its values from the Cue config. Leave `base` nil to construct a Cue config from scratch.
func NewViper ¶
func NewViper() (*ExperimentConfig, error)
func (*ExperimentConfig) AllHosts ¶
func (c *ExperimentConfig) AllHosts() []string
AllHosts returns the list of all hostnames, including replicas and clients. If the configuration is set to run locally, the function returns a list with one entry called "localhost".
func (*ExperimentConfig) AssignClients ¶
func (c *ExperimentConfig) AssignClients() ClientMap
AssignClients assigns clients to hosts.
func (*ExperimentConfig) AssignReplicas ¶
func (c *ExperimentConfig) AssignReplicas(srcReplicaOpts *orchestrationpb.ReplicaOpts) ReplicaMap
AssignReplicas assigns replicas to hosts.
func (*ExperimentConfig) ClientsForHost ¶
func (c *ExperimentConfig) ClientsForHost(hostIndex int) int
ClientsForHost returns the number of clients assigned to the host at the given index.
func (*ExperimentConfig) CreateClientOpts ¶
func (c *ExperimentConfig) CreateClientOpts() *orchestrationpb.ClientOpts
CreateClientOpts creates a new ClientOpts based on the experiment configuration.
func (*ExperimentConfig) CreateReplicaOpts ¶
func (c *ExperimentConfig) CreateReplicaOpts() *orchestrationpb.ReplicaOpts
CreateReplicaOpts creates a new ReplicaOpts based on the experiment configuration.
func (*ExperimentConfig) IsLocal ¶
func (c *ExperimentConfig) IsLocal() bool
IsLocal returns true if both the replica and client hosts slices contain one instance of "localhost". See NewLocal.
func (*ExperimentConfig) ReplicasForHost ¶
func (c *ExperimentConfig) ReplicasForHost(hostIndex int) int
ReplicasForHost returns the number of replicas assigned to the host at the given index.
func (*ExperimentConfig) String ¶
func (c *ExperimentConfig) String() string
func (*ExperimentConfig) TreePosIDs ¶
func (c *ExperimentConfig) TreePosIDs() []hotstuff.ID
TreePosIDs returns a slice of hotstuff.IDs ordered by the tree positions.
type ReplicaMap ¶
type ReplicaMap map[string][]*orchestrationpb.ReplicaOpts
ReplicaMap maps from a host to a slice of replica options.
func (ReplicaMap) ReplicaIDs ¶
func (r ReplicaMap) ReplicaIDs(host string) []uint32
ReplicaIDs returns the IDs of the replicas running on the given host.