package hammer

import "github.com/google/trillian/testonly/hammer"

Index

Constants

const (
	GetLeavesName    = MapEntrypointName("GetLeaves")
	GetLeavesRevName = MapEntrypointName("GetLeavesRev")
	GetSMRName       = MapEntrypointName("GetSMR")
	GetSMRRevName    = MapEntrypointName("GetSMRRev")
	SetLeavesName    = MapEntrypointName("SetLeaves") // TODO(mhutchinson): rename to WriteLeaves.
)

Constants for entrypoint names, as exposed in statistics/logging.

const (
	ExistingKey    = Choice("ExistingKey")
	NonexistentKey = Choice("NonexistentKey")
	MalformedKey   = Choice("MalformedKey")
	DuplicateKey   = Choice("DuplicateKey")
	RevTooBig      = Choice("RevTooBig")
	RevIsNegative  = Choice("RevIsNegative")
	CreateLeaf     = Choice("CreateLeaf")
	UpdateLeaf     = Choice("UpdateLeaf")
	DeleteLeaf     = Choice("DeleteLeaf")
)

Constants for both valid and invalid operation choices.

Functions

func HitMap

func HitMap(ctx context.Context, cfg MapConfig) error

HitMap performs load/stress operations according to given config.

func NewRecordingInterceptor

func NewRecordingInterceptor(filename string) (grpc.UnaryClientInterceptor, error)

NewRecordingInterceptor returns a grpc.UnaryClientInterceptor that logs outgoing requests to file.

func ReplayFile

ReplayFile reads recorded gRPC requests and re-issues them using the given client. If a request has a MapId field, and its value is present in mapmap, then the MapId field is replaced before replay.

Types

type Choice

type Choice string

Choice is a readable representation of a choice about how to perform a hammering operation.

type MapBias

type MapBias struct {
	Bias map[MapEntrypointName]int

	// InvalidChance gives the odds of performing an invalid operation, as the N in 1-in-N.
	InvalidChance map[MapEntrypointName]int
	// contains filtered or unexported fields
}

MapBias indicates the bias for selecting different map operations.

type MapConfig

type MapConfig struct {
	MapID                  int64 // 0 to use an ephemeral tree
	MetricFactory          monitoring.MetricFactory
	Client                 trillian.TrillianMapClient
	Write                  trillian.TrillianMapWriteClient
	Admin                  trillian.TrillianAdminClient
	RandSource             rand.Source
	EPBias                 MapBias
	LeafSize, ExtraSize    uint
	MinLeavesR, MaxLeavesR int
	MinLeavesW, MaxLeavesW int
	Operations             uint64
	EmitInterval           time.Duration
	RetryErrors            bool
	OperationDeadline      time.Duration
	// NumCheckers indicates how many separate inclusion checker goroutines
	// to run.  Note that the behaviour of these checkers is not governed by
	// RandSource.
	NumCheckers int
	// KeepFailedTree indicates whether ephemeral trees should be left intact
	// after a failed hammer run.
	KeepFailedTree bool
}

MapConfig provides configuration for a stress/load test.

func (MapConfig) String

func (c MapConfig) String() string

String conforms with Stringer for MapConfig.

type MapEntrypointName

type MapEntrypointName string

MapEntrypointName identifies a Map RPC entrypoint

Source Files

hammer.go reader.go record.go replay.go tree.go

Directories

PathSynopsis
testonly/hammer/maphammermaphammer is a stress/load test for a Trillian Map.
testonly/hammer/mapreplaymapreplay replays a log of Trillian Map requests.
Version
v1.3.4
Published
Oct 23, 2019
Platform
js/wasm
Imports
26 packages
Last checked
37 seconds ago

Tools for package owners.