Documentation ¶
Index ¶
Constants ¶
const ( // WorkerPerQueue is the value for assigning each worker its own queue of batches WorkerPerQueue = 0 // SingleQueue is the value for using a single shared queue across all workers SingleQueue = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
Batch is an aggregate of points for a particular data system. It needs to have a way to measure it's size to make sure it does not get too large and it needs a way to append a point
type BatchFactory ¶
type BatchFactory interface { // New returns a new Batch to add Points to New() Batch }
BatchFactory returns a new empty batch for storing points.
type Benchmark ¶
type Benchmark interface { // GetPointDecoder returns the PointDecoder to use for this Benchmark GetPointDecoder(br *bufio.Reader) PointDecoder // GetBatchFactory returns the BatchFactory to use for this Benchmark GetBatchFactory() BatchFactory // GetPointIndexer returns the PointIndexer to use for this Benchmark GetPointIndexer(maxPartitions uint) PointIndexer // GetProcessor returns the Processor to use for this Benchmark GetProcessor() Processor // GetDBCreator returns the DBCreator to use for this Benchmark GetDBCreator() DBCreator }
Benchmark is an interface that represents the skeleton of a program needed to run an insert or load benchmark.
type BenchmarkRunner ¶
type BenchmarkRunner struct {
// contains filtered or unexported fields
}
BenchmarkRunner is responsible for initializing and storing common flags across all database systems and ultimately running a supplied Benchmark
func GetBenchmarkRunner ¶
func GetBenchmarkRunner() *BenchmarkRunner
GetBenchmarkRunner returns the singleton BenchmarkRunner for use in a benchmark program with a default batch size
func GetBenchmarkRunnerWithBatchSize ¶
func GetBenchmarkRunnerWithBatchSize(batchSize uint) *BenchmarkRunner
GetBenchmarkRunnerWithBatchSize returns the singleton BenchmarkRunner for use in a benchmark program with specified batch size.
func (*BenchmarkRunner) DatabaseName ¶
func (l *BenchmarkRunner) DatabaseName() string
DatabaseName returns the value of the --db-name flag (name of the database to store data)
func (*BenchmarkRunner) GetBufferedReader ¶
func (l *BenchmarkRunner) GetBufferedReader() *bufio.Reader
GetBufferedReader returns the buffered Reader that should be used by the loader
func (*BenchmarkRunner) RunBenchmark ¶
func (l *BenchmarkRunner) RunBenchmark(b Benchmark, workQueues uint)
RunBenchmark takes in a Benchmark b, a bufio.Reader br, and holders for number of metrics and rows and uses those to run the load benchmark
type ConstantIndexer ¶
type ConstantIndexer struct{}
ConstantIndexer always puts the item on a single channel. This is the typical use case where all the workers share the same channel
func (*ConstantIndexer) GetIndex ¶
func (i *ConstantIndexer) GetIndex(_ *Point) int
GetIndex returns a constant index (0) regardless of Point
type DBCreator ¶
type DBCreator interface { // Init should set up any connection or other setup for talking to the DB, but should NOT create any databases Init() // DBExists checks if a database with the given name currently exists. DBExists(dbName string) bool // CreateDB creates a database with the given name. CreateDB(dbName string) error // RemoveOldDB removes an existing database with the given name. RemoveOldDB(dbName string) error }
DBCreator is an interface for a benchmark to do the initial setup of a database in preparation for running a benchmark against it.
type DBCreatorCloser ¶
type DBCreatorCloser interface { DBCreator // Close cleans up any database connections Close() }
DBCreatorCloser is a DBCreator that also needs a Close method to cleanup any connections after the benchmark is finished.
type DBCreatorPost ¶
type DBCreatorPost interface { DBCreator // PostCreateDB does further initialization after the database is created PostCreateDB(dbName string) error }
DBCreatorPost is a DBCreator that also needs to do some initialization after the database is created (e.g., only one client should actually create the DB, so non-creator clients should still set themselves up for writing)
type Point ¶
type Point struct {
Data interface{}
}
Point acts as a 'holder' for the internal representation of a point in a given load client. Instead of using interface{} as a return type, we get compile safety by using Point
type PointDecoder ¶
type PointDecoder interface { //Decode creates a Point from a data stream Decode(*bufio.Reader) *Point }
PointDecoder decodes the next data point in the process of scanning.
type PointIndexer ¶
type PointIndexer interface { // GetIndex returns a partition for the given Point GetIndex(*Point) int }
PointIndexer determines the index of the Batch (and subsequently the channel) that a particular point belongs to
type Processor ¶
type Processor interface { // Init does per-worker setup needed before receiving data Init(workerNum int, doLoad bool) // ProcessBatch handles a single batch of data ProcessBatch(b Batch, doLoad bool) (metricCount, rowCount uint64) }
Processor is a type that processes the work for a loading worker
type ProcessorCloser ¶
type ProcessorCloser interface { Processor // Close cleans up after a Processor Close(doLoad bool) }
ProcessorCloser is a Processor that also needs to close or cleanup afterwards