benchmark

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBDriverMySQL   = "mysql"
	DBDriverPgSQL   = "pgsql"
	DBDriverSpanner = "spanner"
)
View Source
const (
	NameOLTPReadOnly  = "oltp_read_only"
	NameOLTPReadWrite = "oltp_read_write"

	OptSSLOn  = "on"
	OptSSLOff = "off"

	OptIgnoreErrsAll = "all"

	OptDBPreparedStmtAuto    = "auto"
	OptDBPreparedStmtDisable = "disable"
)

Variables

This section is empty.

Functions

func BenchmarkNames

func BenchmarkNames() []string

Types

type Benchmark

type Benchmark interface {
	// initialize before both Prepare and Event
	Init(context.Context) error
	// finalize after both Prepare and Event
	Done() error
	// when prepare command is issued
	Prepare(context.Context) error
	// when run command is issued, PreEvent() is called once in a benchmark
	PreEvent(context.Context) error
	// when run command is issued, Event() is called in a loop
	Event(context.Context) (numReads, numWrites, numOthers, numIgnoredErros uint64, err error)
}

func BenchmarkFactory

func BenchmarkFactory(testname string, opt *BenchmarkOpts) (Benchmark, error)

type BenchmarkOpts

type BenchmarkOpts struct {
	CommonOpts
	MySQLOpts   `group:"MySQL" description:"MySQL options"`
	PgSQLOpts   `group:"PostgreSQL" description:"PostgreSQL options"`
	SpannerOpts `group:"Spanner" description:"Google Cloud Spanner options"`
}

type CommonOpts

type CommonOpts struct {
	Tables     int    `long:"tables" description:"number of tables" default:"1"`
	TableSize  int    `long:"table_size" description:"number of rows per table" default:"10000"`
	TableSizeP int    `long:"table-size" description:"alias of --table_size"`
	DBDriver   string `` //nolint:staticcheck
	/* 126-byte string literal not displayed */
	DBPreparedStmt string `long:"db-ps-mode" choice:"auto" choice:"disable" description:"prepared statements usage mode" default:"auto"` //nolint:staticcheck
}

type MySQLOpts

type MySQLOpts struct {
	MySQLHost       string `long:"mysql-host" description:"MySQL server host" default:"localhost"`
	MySQLPort       int    `long:"mysql-port" description:"MySQL server port" default:"3306"`
	MySQLUser       string `long:"mysql-user" description:"MySQL user" default:"sbtest"`
	MySQLPassword   string `long:"mysql-password" env:"MYSQL_PWD" description:"MySQL password" default:""`
	MySQLDB         string `long:"mysql-db" description:"MySQL database name" default:"sbtest"`
	MySQLSSL        string `long:"mysql-ssl" choice:"on" choice:"off" description:"use SSL connections" default:"off"` //nolint:staticcheck
	MySQLIgnoreErrs string `long:"mysql-ignore-errors" description:"list of errors to ignore, or \"all\"" default:"1213,1020,1205"`
}

type OLTPBench

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

func (*OLTPBench) Done

func (o *OLTPBench) Done() error

func (*OLTPBench) Event

func (o *OLTPBench) Event(ctx context.Context) (numReads, numWrites, numOthers, numIgnoredErros uint64, err error)

func (*OLTPBench) Init

func (o *OLTPBench) Init(ctx context.Context) error

func (*OLTPBench) PreEvent

func (o *OLTPBench) PreEvent(ctx context.Context) error

func (*OLTPBench) Prepare

func (o *OLTPBench) Prepare(ctx context.Context) error

type PgSQLOpts

type PgSQLOpts struct {
	PgSQLHost       string `long:"pgsql-host" description:"PostgreSQL server host" default:"localhost"`
	PgSQLPort       int    `long:"pgsql-port" description:"PostgreSQL server port" default:"5432"`
	PgSQLUser       string `long:"pgsql-user" description:"PostgreSQL user" default:"sbtest"`
	PgSQLPassword   string `long:"pgsql-password" env:"PGPASSWORD" description:"PostgreSQL password" default:""`
	PgSQLDB         string `long:"pgsql-db" description:"PostgreSQL database name" default:"sbtest"`
	PgSQLSSL        string `long:"pgsql-ssl" choice:"on" choice:"off" description:"use SSL connections" default:"off"` //nolint:staticcheck
	PgSQLIgnoreErrs string `long:"pgsql-ignore-errors" description:"list of errors to ignore, or \"all\"" default:"40P01,23505,40001"`
}

type SpannerOpts

type SpannerOpts struct {
	SpannerProjectId  string `long:"spanner-project" description:"Spanner Google Cloud project name"`
	SpannerInstanceId string `long:"spanner-instance" description:"Spanner instance id"`
	SpannerDB         string `long:"spanner-db" description:"Spanner database name" default:"sbtest"`
}

Jump to

Keyboard shortcuts

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