loadgen

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

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(server *grpc.Server)

RegisterService registers for the load-gen's GRPC services.

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 (c *Client) WaitForReady(ctx context.Context) bool

WaitForReady waits for the service resources to initialize, so it is ready to answers requests. If the context ended before the service is ready, returns false.

type ClientConfig

type ClientConfig struct {
	// Server for a gRPC server for the full load-generator's gRPC API.
	Server *connection.ServerConfig `mapstructure:"server"`
	// HTTPServer for an HTTP server to set/get the limiter's rate.
	HTTPServer *connection.ServerConfig `mapstructure:"http-server"`
	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, serverTLS connection.TLSConfig) *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