query

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BenchmarkTestResultVersion = "0.1"

Variables

View Source
var HTTPPool = sync.Pool{
	New: func() interface{} {
		return &HTTP{
			HumanLabel:       []byte{},
			HumanDescription: []byte{},
			Method:           []byte{},
			Path:             []byte{},
			Body:             []byte{},
			RawQuery:         []byte{},
			StartTimestamp:   0,
			EndTimestamp:     0,
		}
	},
}

HTTPPool is a sync.Pool of HTTP Query types

View Source
var TDenginePool = sync.Pool{
	New: func() interface{} {
		return &TDengine{
			HumanLabel:       make([]byte, 0, 1024),
			HumanDescription: make([]byte, 0, 1024),
			SqlQuery:         make([]byte, 0, 1024),
		}
	},
}

TDenginePool is a sync.Pool of TDengine Query types

View Source
var TimescaleDBPool = sync.Pool{
	New: func() interface{} {
		return &TimescaleDB{
			HumanLabel:       make([]byte, 0, 1024),
			HumanDescription: make([]byte, 0, 1024),
			Hypertable:       make([]byte, 0, 1024),
			SqlQuery:         make([]byte, 0, 1024),
		}
	},
}

TimescaleDBPool is a sync.Pool of TimescaleDB Query types

Functions

This section is empty.

Types

type BenchmarkRunner

type BenchmarkRunner struct {
	BenchmarkRunnerConfig
	// contains filtered or unexported fields
}

BenchmarkRunner contains the common components for running a query benchmarking program against a database.

func NewBenchmarkRunner

func NewBenchmarkRunner(config BenchmarkRunnerConfig) *BenchmarkRunner

NewBenchmarkRunner creates a new instance of BenchmarkRunner which is common functionality to be used by query benchmarker programs

func (*BenchmarkRunner) DatabaseName

func (b *BenchmarkRunner) DatabaseName() string

DatabaseName returns the name of the database to run queries against

func (*BenchmarkRunner) DebugLevel

func (b *BenchmarkRunner) DebugLevel() int

DebugLevel returns the level of debug messages for this benchmark

func (*BenchmarkRunner) DoPrintResponses

func (b *BenchmarkRunner) DoPrintResponses() bool

DoPrintResponses indicates whether responses for queries should be printed

func (*BenchmarkRunner) GetBufferedReader

func (b *BenchmarkRunner) GetBufferedReader() *bufio.Reader

GetBufferedReader returns the buffered Reader that should be used by the loader

func (*BenchmarkRunner) Run

func (b *BenchmarkRunner) Run(queryPool *sync.Pool, processorCreateFn ProcessorCreate)

Run does the bulk of the benchmark execution. It launches a goroutine to track stats, creates workers to process queries, read in the input, execute the queries, and then does cleanup.

func (*BenchmarkRunner) SetLimit

func (b *BenchmarkRunner) SetLimit(limit uint64)

SetLimit changes the number of queries to run, with 0 being all of them

type BenchmarkRunnerConfig

type BenchmarkRunnerConfig struct {
	DBName           string `mapstructure:"db-name"`
	Limit            uint64 `mapstructure:"max-queries"`
	LimitRPS         uint64 `mapstructure:"max-rps"`
	MemProfile       string `mapstructure:"memprofile"`
	HDRLatenciesFile string `mapstructure:"hdr-latencies"`
	Workers          uint   `mapstructure:"workers"`
	PrintResponses   bool   `mapstructure:"print-responses"`
	Debug            int    `mapstructure:"debug"`
	FileName         string `mapstructure:"file"`
	BurnIn           uint64 `mapstructure:"burn-in"`
	PrintInterval    uint64 `mapstructure:"print-interval"`
	PrewarmQueries   bool   `mapstructure:"prewarm-queries"`
	ResultsFile      string `mapstructure:"results-file"`
}

BenchmarkRunnerConfig is the configuration of the benchmark runner.

func (BenchmarkRunnerConfig) AddToFlagSet

func (c BenchmarkRunnerConfig) AddToFlagSet(fs *pflag.FlagSet)

AddToFlagSet adds command line flags needed by the BenchmarkRunnerConfig to the flag set.

type HTTP

type HTTP struct {
	HumanLabel       []byte
	HumanDescription []byte
	Method           []byte
	Path             []byte
	Body             []byte
	RawQuery         []byte
	StartTimestamp   int64
	EndTimestamp     int64
	// contains filtered or unexported fields
}

HTTP encodes an HTTP request. This will typically be serialized for use by the appropriate tsbs_run_queries program.

func NewHTTP

func NewHTTP() *HTTP

NewHTTP returns a new HTTP type Query

func (*HTTP) GetID

func (q *HTTP) GetID() uint64

GetID returns the ID of this Query

func (*HTTP) HumanDescriptionName

func (q *HTTP) HumanDescriptionName() []byte

HumanDescriptionName returns the human readable description of this Query

func (*HTTP) HumanLabelName

func (q *HTTP) HumanLabelName() []byte

HumanLabelName returns the human readable name of this Query

func (*HTTP) Release

func (q *HTTP) Release()

Release resets and returns this Query to its pool

func (*HTTP) SetID

func (q *HTTP) SetID(n uint64)

SetID sets the ID for this Query

func (*HTTP) String

func (q *HTTP) String() string

String produces a debug-ready description of a Query.

type LoaderTestResult

type LoaderTestResult struct {
	// Format Configs
	ResultFormatVersion string `json:"ResultFormatVersion"`

	// RunnerConfig Configs
	RunnerConfig BenchmarkRunnerConfig `json:"RunnerConfig"`

	// Run info
	StartTime      int64 `json:"StartTime`
	EndTime        int64 `json:"EndTime"`
	DurationMillis int64 `json:"DurationMillis"`

	// Totals
	Totals map[string]interface{} `json:"Totals"`
}

LoaderTestResult aggregates the results of an query benchmark in a common format across targets

type Processor

type Processor interface {
	// Init initializes at global state for the Processor, possibly based on its worker number / ID
	Init(workerNum int)

	// ProcessQuery handles a given query and reports its stats
	ProcessQuery(q Query, isWarm bool) ([]*Stat, error)
}

Processor is an interface that handles the setup of a query processing worker and executes queries one at a time

type ProcessorCreate

type ProcessorCreate func() Processor

ProcessorCreate is a function that creates a new Processor (called in Run)

type Query

type Query interface {
	Release()
	HumanLabelName() []byte
	HumanDescriptionName() []byte
	GetID() uint64
	SetID(uint64)
	fmt.Stringer
}

Query is an interface used for encoding a benchmark query for different databases

type Stat

type Stat struct {
	// contains filtered or unexported fields
}

Stat represents one statistical measurement, typically used to store the latency of a query (or part of query).

func GetPartialStat

func GetPartialStat() *Stat

GetPartialStat returns a partial Stat for use from a pool

func GetStat

func GetStat() *Stat

GetStat returns a Stat for use from a pool

func (*Stat) Init

func (s *Stat) Init(label []byte, value float64) *Stat

Init safely initializes a Stat while minimizing heap allocations.

type TDengine

type TDengine struct {
	HumanLabel       []byte
	HumanDescription []byte
	SqlQuery         []byte
	// contains filtered or unexported fields
}

TDengine encodes a TDengine request. This will be serialized for use by the run_queries_tdengine program.

func NewTDengine

func NewTDengine() *TDengine

NewTDengine returns a new TDengine Query instance

func (*TDengine) GetID

func (q *TDengine) GetID() uint64

GetID returns the ID of this Query

func (*TDengine) HumanDescriptionName

func (q *TDengine) HumanDescriptionName() []byte

HumanDescriptionName returns the human-readable description of this Query

func (*TDengine) HumanLabelName

func (q *TDengine) HumanLabelName() []byte

HumanLabelName returns the human-readable name of this Query

func (*TDengine) Release

func (q *TDengine) Release()

Release resets and returns this Query to its pool

func (*TDengine) SetID

func (q *TDengine) SetID(n uint64)

SetID sets the ID for this Query

func (*TDengine) String

func (q *TDengine) String() string

String produces a debug-ready description of a Query.

type TimescaleDB

type TimescaleDB struct {
	HumanLabel       []byte
	HumanDescription []byte

	Hypertable []byte // e.g. "cpu"
	SqlQuery   []byte
	// contains filtered or unexported fields
}

TimescaleDB encodes a TimescaleDB request. This will be serialized for use by the run_queries_timescaledb program.

func NewTimescaleDB

func NewTimescaleDB() *TimescaleDB

NewTimescaleDB returns a new TimescaleDB Query instance

func (*TimescaleDB) GetID

func (q *TimescaleDB) GetID() uint64

GetID returns the ID of this Query

func (*TimescaleDB) HumanDescriptionName

func (q *TimescaleDB) HumanDescriptionName() []byte

HumanDescriptionName returns the human readable description of this Query

func (*TimescaleDB) HumanLabelName

func (q *TimescaleDB) HumanLabelName() []byte

HumanLabelName returns the human readable name of this Query

func (*TimescaleDB) Release

func (q *TimescaleDB) Release()

Release resets and returns this Query to its pool

func (*TimescaleDB) SetID

func (q *TimescaleDB) SetID(n uint64)

SetID sets the ID for this Query

func (*TimescaleDB) String

func (q *TimescaleDB) String() string

String produces a debug-ready description of a Query.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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