sender

package
v0.0.0-...-5d3badf Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRampTestFailedSLO = errors.New("ramp test failed SLO")

Functions

func RecordTPSSample

func RecordTPSSample(endpoint, chainID, scenario string, tps float64)

RecordTPSSample publishes the latest TPS sample read by the tps_achieved gauge.

Types

type Dispatcher

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

Dispatcher continuously generates transactions and dispatches them to the sender

func NewDispatcher

func NewDispatcher(gen generator.Generator, sender TxSender) *Dispatcher

NewDispatcher creates a new dispatcher

func (*Dispatcher) GetStats

func (d *Dispatcher) GetStats() DispatcherStats

GetStats returns dispatcher statistics

func (*Dispatcher) Prewarm

func (d *Dispatcher) Prewarm(ctx context.Context) error

Prewarm runs the prewarm generator to completion before starting the main load test

func (*Dispatcher) Run

func (d *Dispatcher) Run(ctx context.Context) error

Start begins the dispatcher's transaction generation and sending loop

func (*Dispatcher) RunBatch

func (d *Dispatcher) RunBatch(ctx context.Context, count int) error

StartBatch generates and sends a specific number of transactions then stops

func (*Dispatcher) SetPrewarmGenerator

func (d *Dispatcher) SetPrewarmGenerator(prewarmGen generator.Generator)

SetPrewarmGenerator sets the prewarm generator for this dispatcher

func (*Dispatcher) SetStatsCollector

func (d *Dispatcher) SetStatsCollector(collector *stats.Collector)

SetStatsCollector sets the statistics collector for this dispatcher

type DispatcherStats

type DispatcherStats struct {
	TotalSent uint64
}

DispatcherStats contains statistics for the dispatcher

type HttpClientOption

type HttpClientOption func(*http.Transport)

HttpClientOption configures the Transport used by newHttpClient.

func WithMaxIdleConns

func WithMaxIdleConns(n int) HttpClientOption

WithMaxIdleConns overrides the global idle-connection pool size.

func WithMaxIdleConnsPerHost

func WithMaxIdleConnsPerHost(n int) HttpClientOption

WithMaxIdleConnsPerHost overrides the per-host idle-connection pool size. Scale with goroutine count to avoid TCP re-dial on each completion.

type RampCurve

type RampCurve interface {
	GetTPS(t time.Duration) float64
	GetCurveStats() string
}

RampCurve is a function that returns the target TPS at a given time in the ramp period

type RampCurveStep

type RampCurveStep struct {
	StartTps         float64
	IncrementTps     float64
	LoadInterval     time.Duration
	RecoveryInterval time.Duration
	Step             int
	CurrentTPS       float64
}

func NewRampCurveStep

func NewRampCurveStep(startTps float64, incrementTps float64, loadInterval time.Duration, recoveryInterval time.Duration) *RampCurveStep

func (*RampCurveStep) GetCurveStats

func (r *RampCurveStep) GetCurveStats() string

this should return the highest target TPS that is PRIOR to the current step

func (*RampCurveStep) GetIncrementTps

func (r *RampCurveStep) GetIncrementTps() float64

func (*RampCurveStep) GetStartTps

func (r *RampCurveStep) GetStartTps() float64

func (*RampCurveStep) GetTPS

func (r *RampCurveStep) GetTPS(t time.Duration) float64

type Ramper

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

func NewRamper

func NewRamper(rampCurve RampCurve, blockCollector stats.BlockStatsProvider, sharedLimiter *rate.Limiter) *Ramper

func (*Ramper) FormatRampStats

func (r *Ramper) FormatRampStats() string

func (*Ramper) LogFinalStats

func (r *Ramper) LogFinalStats()

func (*Ramper) Run

func (r *Ramper) Run(ctx context.Context) error

Start initializes and starts all workers

func (*Ramper) UpdateTPS

func (r *Ramper) UpdateTPS()

func (*Ramper) WatchSLO

func (r *Ramper) WatchSLO(ctx context.Context) <-chan struct{}

WatchSLO will evaluate the chain SLO every 100ms using a 30 second window, and return a channel if the SLO is violated

type ShardedSender

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

ShardedSender implements TxSender with multiple workers, one per endpoint

func NewShardedSender

func NewShardedSender(cfg *config.LoadConfig, bufferSize int, workers int, limiter *rate.Limiter) (*ShardedSender, error)

NewShardedSender creates a new sharded sender with workers for each endpoint

func (*ShardedSender) GetNumShards

func (s *ShardedSender) GetNumShards() int

GetNumShards returns the number of shards (workers)

func (*ShardedSender) GetWorkerStats

func (s *ShardedSender) GetWorkerStats() []WorkerStats

GetWorkerStats returns statistics for all workers

func (*ShardedSender) Run

func (s *ShardedSender) Run(ctx context.Context) error

Start initializes and starts all workers

func (*ShardedSender) Send

func (s *ShardedSender) Send(ctx context.Context, tx *types.LoadTx) error

Send implements TxSender interface - calculates shard ID and routes to appropriate worker

func (*ShardedSender) SetDebug

func (s *ShardedSender) SetDebug(debug bool)

func (*ShardedSender) SetDryRun

func (s *ShardedSender) SetDryRun(dryRun bool)

SetDryRun sets the dry-run flag for the sender and its workers

func (*ShardedSender) SetStatsCollector

func (s *ShardedSender) SetStatsCollector(collector *stats.Collector, logger *stats.Logger)

SetStatsCollector sets the statistics collector for all workers

func (*ShardedSender) SetTrackBlocks

func (s *ShardedSender) SetTrackBlocks(trackBlocks bool)

SetTrackBlocks sets the track-blocks flag (placeholder - blocks are tracked separately)

func (*ShardedSender) SetTrackReceipts

func (s *ShardedSender) SetTrackReceipts(trackReceipts bool)

SetTrackReceipts sets the track-receipts flag for the sender and its workers

type TxSender

type TxSender interface {
	Send(ctx context.Context, tx *types.LoadTx) error
}

type TxWriteData

type TxWriteData struct {
	TxPayloads [][]byte `json:"tx_payloads"`
}

type TxsWriter

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

func NewTxsWriter

func NewTxsWriter(gasPerBlock uint64, txsDir string, startHeight uint64, numBlocks uint64) *TxsWriter

func (*TxsWriter) Flush

func (w *TxsWriter) Flush() error

func (*TxsWriter) Send

func (w *TxsWriter) Send(ctx context.Context, tx *types.LoadTx) error

Send writes the transaction to the writer

type Worker

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

Worker handles sending transactions to a specific endpoint

func NewWorker

func NewWorker(id int, seiChainID string, endpoint string, bufferSize int, workers int, limiter *rate.Limiter) *Worker

NewWorker creates a new worker for a specific endpoint

func (*Worker) GetChannelLength

func (w *Worker) GetChannelLength() int

GetChannelLength returns the current length of the worker's channel (for monitoring). This function is safe for concurrent calls.

func (*Worker) GetEndpoint

func (w *Worker) GetEndpoint() string

GetEndpoint returns the worker's endpoint

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Start begins the worker's processing loop

func (*Worker) Send

func (w *Worker) Send(ctx context.Context, tx *types.LoadTx) error

Send queues a transaction for this worker to process

func (*Worker) SetDebug

func (w *Worker) SetDebug(debug bool)

SetDebug sets the dry-run mode for the worker

func (*Worker) SetDryRun

func (w *Worker) SetDryRun(dryRun bool)

SetDryRun sets the dry-run mode for the worker

func (*Worker) SetStatsCollector

func (w *Worker) SetStatsCollector(collector *stats.Collector, logger *stats.Logger)

SetStatsCollector sets the statistics collector for this worker

func (*Worker) SetTrackReceipts

func (w *Worker) SetTrackReceipts(trackReceipts bool)

SetTrackReceipts sets the track-receipts mode for the worker

type WorkerStats

type WorkerStats struct {
	WorkerID      int
	Endpoint      string
	ChannelLength int
}

WorkerStats contains statistics for a single worker

Jump to

Keyboard shortcuts

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