benchlist

package
v1.11.10-prerelease Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: BSD-3-Clause Imports: 15 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Benchable added in v1.4.3

type Benchable interface {
	// Mark that [validatorID] has been benched on the given chain
	Benched(chainID ids.ID, validatorID ids.NodeID)
	// Mark that [validatorID] has been unbenched from the given chain
	Unbenched(chainID ids.ID, validatorID ids.NodeID)
}

Benchable is notified when a validator is benched or unbenched from a given chain

type Benchlist added in v1.2.1

type Benchlist interface {
	// RegisterResponse registers the response to a query message
	RegisterResponse(nodeID ids.NodeID)
	// RegisterFailure registers that we didn't receive a response within the timeout
	RegisterFailure(nodeID ids.NodeID)
	// IsBenched returns true if messages to [validatorID]
	// should not be sent over the network and should immediately fail.
	IsBenched(nodeID ids.NodeID) bool
}

Therefore, nodes that consistently fail are "benched" such that queries to that node fail immediately to avoid waiting up to the full network timeout for a response.

func NewBenchlist added in v1.2.1

func NewBenchlist(
	ctx *snow.ConsensusContext,
	benchable Benchable,
	validators validators.Manager,
	threshold int,
	minimumFailingDuration,
	duration time.Duration,
	maxPortion float64,
	reg prometheus.Registerer,
) (Benchlist, error)

NewBenchlist returns a new Benchlist

type Config

type Config struct {
	Benchable              Benchable             `json:"-"`
	Validators             validators.Manager    `json:"-"`
	BenchlistRegisterer    metrics.MultiGatherer `json:"-"`
	Threshold              int                   `json:"threshold"`
	MinimumFailingDuration time.Duration         `json:"minimumFailingDuration"`
	Duration               time.Duration         `json:"duration"`
	MaxPortion             float64               `json:"maxPortion"`
}

Config defines the configuration for a benchlist

type Manager

type Manager interface {
	// RegisterResponse registers that we receive a request response from [nodeID]
	// regarding [chainID] within the timeout
	RegisterResponse(chainID ids.ID, nodeID ids.NodeID)
	// RegisterFailure registers that a request to [nodeID] regarding
	// [chainID] timed out
	RegisterFailure(chainID ids.ID, nodeID ids.NodeID)
	// RegisterChain registers a new chain with metrics under [namespace]
	RegisterChain(ctx *snow.ConsensusContext) error
	// IsBenched returns true if messages to [nodeID] regarding chain [chainID]
	// should not be sent over the network and should immediately fail.
	// Returns false if such messages should be sent, or if the chain is unknown.
	IsBenched(nodeID ids.NodeID, chainID ids.ID) bool
	// GetBenched returns an array of chainIDs where the specified
	// [nodeID] is benched. If called on an id.ShortID that does
	// not map to a validator, it will return an empty array.
	GetBenched(nodeID ids.NodeID) []ids.ID
}

Manager provides an interface for a benchlist to register whether queries have been successful or unsuccessful and place validators with consistently failing queries on a benchlist to prevent waiting up to the full network timeout for their responses.

func NewManager

func NewManager(config *Config) Manager

NewManager returns a manager for chain-specific query benchlisting

func NewNoBenchlist

func NewNoBenchlist() Manager

NewNoBenchlist returns an empty benchlist that will never stop any queries

Jump to

Keyboard shortcuts

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