loadgen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerPort     = 8001
	DefaultMonitoringPort = 2118
)

Default configuration values for the load generator.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	servicepb.UnimplementedLoadGenServiceServer
	// contains filtered or unexported fields
}

Client for applying load on the services.

func NewLoadGenClient

func NewLoadGenClient(conf *ClientConfig) (*Client, error)

NewLoadGenClient creates a new client instance.

func (*Client) AppendBatch

func (c *Client) AppendBatch(ctx context.Context, batch *servicepb.LoadGenBatch) (*emptypb.Empty, error)

AppendBatch appends a batch to the stream.

func (*Client) GetRateLimit added in v0.1.8

func (c *Client) GetRateLimit(context.Context, *emptypb.Empty) (*servicepb.RateLimit, error)

GetRateLimit reads the stream limit.

func (*Client) RegisterService added in v0.1.5

func (c *Client) RegisterService(s serve.Servers)

RegisterService registers the loadgen's gRPC services and monitoring server.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run applies load on the service.

func (*Client) SetRateLimit added in v0.1.8

func (c *Client) SetRateLimit(_ context.Context, limit *servicepb.RateLimit) (*emptypb.Empty, error)

SetRateLimit sets the stream limit.

func (*Client) WaitForReady

func (*Client) WaitForReady(context.Context) bool

WaitForReady indicates if the service is ready to be exposed as a gRPC service. This implementation always returns true as the service is considered ready immediately.

type ClientConfig

type ClientConfig struct {
	Monitoring metrics.Config `mapstructure:"monitoring" yaml:"monitoring"`

	Adapter     adapters.AdapterConfig  `mapstructure:",squash" yaml:",inline"`
	Stream      *workload.StreamOptions `mapstructure:"stream" yaml:"stream"`
	LoadProfile *workload.Profile       `mapstructure:"load-profile" yaml:"load-profile"`
	Limit       *adapters.GenerateLimit `mapstructure:"limit" yaml:"limit"`

	// Generate If omitted, all phases will be generated by default.
	Generate adapters.Phases `mapstructure:"generate" yaml:"generate"`
}

ClientConfig is a struct that contains the configuration for the client.

func DefaultClientConf

func DefaultClientConf(t *testing.T) *ClientConfig

DefaultClientConf returns default config values for client testing.

type ServiceAdapter

type ServiceAdapter interface {
	// RunWorkload apply the generated workload.
	RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error
	// Progress returns a value that indicates progress as the number grows.
	Progress() uint64
	// Supports specify which phases an adapter supports.
	Supports() adapters.Phases
}

ServiceAdapter encapsulates the common interface for adapters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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