Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFailedToReachTargetTPS = errors.New("failed to reach target TPS")
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener[T TxID] interface { // Listen for the final status of transactions and notify the tracker // Listen stops if the context is done, an error occurs, or if it received // all the transactions issued and the issuer no longer issues any. // Listen MUST return a nil error if the context is canceled. Listen(ctx context.Context) error // RegisterIssued informs the listener that a transaction was issued. RegisterIssued(txID T) // IssuingDone informs the listener that no more transactions will be issued. IssuingDone() }
type Orchestrator ¶
type Orchestrator[T TxID] struct { // contains filtered or unexported fields }
Orchestrator tests the network by continuously sending transactions at a given rate (currTargetTPS) and increasing that rate until it detects that the network can no longer make progress (i.e. the rate at the network accepts transactions is less than currTargetTPS).
func NewOrchestrator ¶
func NewOrchestrator[T TxID]( agents []Agent[T], tracker *Tracker[T], log logging.Logger, config OrchestratorConfig, ) *Orchestrator[T]
func (*Orchestrator[_]) GetMaxObservedTPS ¶
func (o *Orchestrator[_]) GetMaxObservedTPS() int64
GetObservedIssued returns the max TPS the orchestrator observed
type OrchestratorConfig ¶
type OrchestratorConfig struct { // The maximum TPS the orchestrator should aim for. // // If set to -1, the orchestrator will behave in a burst fashion, instead // sending MinTPS transactions at once and waiting sustainedTime seconds // before checking if MinTPS transactions were confirmed as accepted. MaxTPS int64 // The minimum TPS the orchestrator should start with. MinTPS int64 // The step size to increase the TPS by. Step int64 // The factor by which to pad the number of txs an issuer sends per second // for example, if targetTPS = 1000 and numIssuers = 10, then each issuer // will send (1000/10)*TxRateMultiplier transactions per second. // // Maintaining a multiplier above target provides a toggle to keep load // persistently above instead of below target. This ensures load generation // does not pause issuance at the target and persistently under-issue and // fail to account for the time it takes to add more load. TxRateMultiplier float64 // The time period which TPS is averaged over // Similarly, the time period which the orchestrator will wait before // computing the average TPS. SustainedTime time.Duration // The number of attempts to try achieving a given target TPS before giving up. MaxAttempts uint64 // Whether the orchestrator should return if the maxTPS has been reached Terminate bool }
func NewOrchestratorConfig ¶
func NewOrchestratorConfig() OrchestratorConfig
NewOrchestratorConfig returns a default OrchestratorConfig with pre-set parameters for gradual load testing.
type Tracker ¶
type Tracker[T TxID] struct { // contains filtered or unexported fields }
Tracker keeps track of the status of transactions. This is thread-safe and can be called in parallel by the issuer(s) or orchestrator.
func NewTracker ¶
func NewTracker[T TxID](reg *prometheus.Registry) (*Tracker[T], error)
NewTracker returns a new Tracker instance which records metrics for the number of transactions issued, confirmed, and failed. It also tracks the latency of transactions.
func (*Tracker[_]) GetObservedConfirmed ¶
GetObservedConfirmed returns the number of transactions that the tracker has confirmed were accepted.
func (*Tracker[_]) GetObservedFailed ¶
GetObservedFailed returns the number of transactions that the tracker has confirmed failed.
func (*Tracker[_]) GetObservedIssued ¶
GetObservedIssued returns the number of transactions that the tracker has confirmed were issued.
func (*Tracker[T]) Issue ¶
func (t *Tracker[T]) Issue(txID T)
Issue records a transaction that was submitted, but whose final status is not yet known.
func (*Tracker[T]) ObserveConfirmed ¶
func (t *Tracker[T]) ObserveConfirmed(txID T)
ObserveConfirmed records a transaction that was confirmed.
func (*Tracker[T]) ObserveFailed ¶
func (t *Tracker[T]) ObserveFailed(txID T)
ObserveFailed records a transaction that failed (e.g. expired)