Documentation
¶
Index ¶
- Variables
- type Agent
- type CallDepthTest
- type ContractCreationTest
- type ExternalCallTest
- type HashingTest
- type Issuer
- type LargeEventTest
- type Listener
- type LoadGenerator
- type MemoryTest
- type Metrics
- type Orchestrator
- type OrchestratorConfig
- type PureComputeTest
- type RandomWeightedTest
- type ReadTest
- type StateModificationTest
- type Test
- type Tracker
- type TransferTest
- type TrieStressTest
- type TxID
- type Wallet
- type WeightedTest
- type Worker
- type WriteTest
Constants ¶
This section is empty.
Variables ¶
var ErrFailedToReachTargetTPS = errors.New("failed to reach target TPS")
Functions ¶
This section is empty.
Types ¶
type CallDepthTest ¶ added in v1.11.14
type CallDepthTest struct {
Contract *contracts.EVMLoadSimulator
Count *big.Int
}
func (CallDepthTest) Run ¶ added in v1.11.14
func (c CallDepthTest) Run(tc tests.TestContext, wallet *Wallet)
type ContractCreationTest ¶ added in v1.11.14
type ContractCreationTest struct {
Contract *contracts.EVMLoadSimulator
}
func (ContractCreationTest) Run ¶ added in v1.11.14
func (c ContractCreationTest) Run(tc tests.TestContext, wallet *Wallet)
type ExternalCallTest ¶ added in v1.11.14
type ExternalCallTest struct {
Contract *contracts.EVMLoadSimulator
}
func (ExternalCallTest) Run ¶ added in v1.11.14
func (e ExternalCallTest) Run(tc tests.TestContext, wallet *Wallet)
type HashingTest ¶ added in v1.11.14
type HashingTest struct {
Contract *contracts.EVMLoadSimulator
Count *big.Int
}
func (HashingTest) Run ¶ added in v1.11.14
func (h HashingTest) Run(tc tests.TestContext, wallet *Wallet)
type LargeEventTest ¶ added in v1.11.14
type LargeEventTest struct {
Contract *contracts.EVMLoadSimulator
NumEvents *big.Int
}
func (LargeEventTest) Run ¶ added in v1.11.14
func (l LargeEventTest) Run(tc tests.TestContext, wallet *Wallet)
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 LoadGenerator ¶ added in v1.11.14
type LoadGenerator struct {
// contains filtered or unexported fields
}
func NewLoadGenerator ¶ added in v1.11.14
type MemoryTest ¶ added in v1.11.14
type MemoryTest struct {
Contract *contracts.EVMLoadSimulator
Count *big.Int
}
func (MemoryTest) Run ¶ added in v1.11.14
func (m MemoryTest) Run(tc tests.TestContext, wallet *Wallet)
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(registry *prometheus.Registry) (*Metrics, error)
func (*Metrics) IncIssuedTx ¶
func (m *Metrics) IncIssuedTx()
func (*Metrics) RecordConfirmedTx ¶
func (*Metrics) RecordFailedTx ¶
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
GetMaxObservedTPS 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 PureComputeTest ¶ added in v1.11.14
type PureComputeTest struct {
Contract *contracts.EVMLoadSimulator
NumIterations *big.Int
}
func (PureComputeTest) Run ¶ added in v1.11.14
func (p PureComputeTest) Run(tc tests.TestContext, wallet *Wallet)
type RandomWeightedTest ¶ added in v1.11.14
type RandomWeightedTest struct {
// contains filtered or unexported fields
}
func NewRandomTest ¶ added in v1.11.14
func NewRandomTest( ctx context.Context, chainID *big.Int, worker *Worker, source rand.Source, ) (*RandomWeightedTest, error)
NewRandomTest creates a RandomWeightedTest containing a collection of EVM load testing scenarios.
This function handles the setup of the tests and also assigns each test an equal weight, making them equally likely to be selected during random test execution.
func NewRandomWeightedTest ¶ added in v1.11.14
func NewRandomWeightedTest( weightedTests []WeightedTest, source rand.Source, ) (*RandomWeightedTest, error)
func (*RandomWeightedTest) Run ¶ added in v1.11.14
func (r *RandomWeightedTest) Run(tc tests.TestContext, wallet *Wallet)
type ReadTest ¶ added in v1.11.14
type ReadTest struct {
Contract *contracts.EVMLoadSimulator
Count *big.Int
}
type StateModificationTest ¶ added in v1.11.14
type StateModificationTest struct {
Contract *contracts.EVMLoadSimulator
Count *big.Int
}
func (StateModificationTest) Run ¶ added in v1.11.14
func (s StateModificationTest) Run(tc tests.TestContext, wallet *Wallet)
type Test ¶ added in v1.11.14
type Test interface {
Run(tc tests.TestContext, wallet *Wallet)
}
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 ¶
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)
type TransferTest ¶ added in v1.11.14
func (TransferTest) Run ¶ added in v1.11.14
func (t TransferTest) Run(tc tests.TestContext, wallet *Wallet)
type TrieStressTest ¶ added in v1.11.14
type TrieStressTest struct {
Contract *contracts.TrieStressTest
NumValues *big.Int
}
func (TrieStressTest) Run ¶ added in v1.11.14
func (t TrieStressTest) Run(tc tests.TestContext, wallet *Wallet)