Documentation ¶
Index ¶
- Constants
- Variables
- func CheckExec(serverConfig *ServerConfig) error
- func CheckProtocol(protocol string) error
- func CheckUpdatePortMap(serverConfig *ServerConfig, portMap map[int]ServerType) (map[int]ServerType, error)
- func ExecCommand(ctx context.Context, name string, arg ...string) *exec.Cmd
- func FromHeaderResultColumnValue(h string, r *Result) (string, error)
- func FromHeaderResultFieldValue(field string, val string, r *Result) error
- func FromResultCsvHeaders() []string
- func FromValWithParens(val string) (string, string, error)
- func Run(config *Config) error
- func SetupDB(ctx context.Context, serverConfig *ServerConfig, databaseName string) (err error)
- func UpdateDoltConfig(ctx context.Context, config *ServerConfig) error
- func UpdateResult(result *Result, line string) error
- func ValidateRequiredFields(server, version, format string) error
- func WriteResults(serverConfig *ServerConfig, results Results) error
- func WriteResultsCsv(filename string, results Results) (err error)
- func WriteResultsJson(filename string, results Results) (err error)
- type Config
- type ConfigTest
- type Result
- type Results
- func BenchmarkDolt(ctx context.Context, config *Config, serverConfig *ServerConfig) (Results, error)
- func BenchmarkMysql(ctx context.Context, config *Config, serverConfig *ServerConfig) (Results, error)
- func ReadResultsCsv(filename string) (Results, error)
- func ReadResultsJson(filename string) (Results, error)
- type ServerConfig
- type ServerType
- type Test
Constants ¶
const ( Dolt ServerType = "dolt" MySql ServerType = "mysql" CsvFormat = "csv" JsonFormat = "json" CsvExt = ".csv" JsonExt = ".json" )
const (
SqlStatsPrefix = "SQL statistics:"
)
Variables ¶
var ( ErrTestNameNotDefined = errors.New("test name not defined") ErrNoServersDefined = errors.New("servers not defined") ErrUnsupportedConnectionProtocol = errors.New("unsupported connection protocol") )
var ( ResultFileTemplate = "%s_%s_%s_sysbench_performance%s" ErrUnableToParseOutput = errors.New("unable to parse output") ErrUnsupportedHeaderField = errors.New("unsupported header field") )
var Debug bool
Functions ¶
func CheckExec ¶
func CheckExec(serverConfig *ServerConfig) error
CheckExec verifies the binary exists
func CheckProtocol ¶
CheckProtocol ensures the given protocol is supported
func CheckUpdatePortMap ¶
func CheckUpdatePortMap(serverConfig *ServerConfig, portMap map[int]ServerType) (map[int]ServerType, error)
CheckUpdatePortMap returns an error if multiple servers have specified the same port
func FromHeaderResultColumnValue ¶
FromHeaderResultColumnValue returns the value from the Result for the given header field
func FromHeaderResultFieldValue ¶
FromHeaderResultFieldValue sets the value to the corresponding Result field for the given header field
func FromResultCsvHeaders ¶
func FromResultCsvHeaders() []string
FromResultCsvHeaders returns supported csv headers for a Result
func FromValWithParens ¶
FromValWithParens takes a string containing parens and returns the value outside the parens first, and the value inside the parens second
func SetupDB ¶
func SetupDB(ctx context.Context, serverConfig *ServerConfig, databaseName string) (err error)
func UpdateDoltConfig ¶
func UpdateDoltConfig(ctx context.Context, config *ServerConfig) error
UpdateDoltConfig updates the dolt config if necessary
func UpdateResult ¶
UpdateResult extracts the key and value from the given line and updates the given Result
func ValidateRequiredFields ¶
func WriteResults ¶
func WriteResults(serverConfig *ServerConfig, results Results) error
func WriteResultsCsv ¶
WriteResultsCsv writes Results to a csv
func WriteResultsJson ¶
WriteResultsJson writes Results to a json file
Types ¶
type Config ¶
type Config struct { // Runs is the number of times to run all tests Runs int // RuntimeOS is the platform the benchmarks ran on RuntimeOS string // RuntimeGoArch is the runtime architecture RuntimeGoArch string // Servers are the servers to benchmark Servers []*ServerConfig // Tests are the tests to run. If no tests are provided, // the default tests will be used Tests []*ConfigTest // TestOptions a list of sysbench test options to apply to all tests TestOptions []string // ScriptDir is a path to a directory of lua scripts ScriptDir string // DirtyClone downloads a database with existing chunks and commits InitBigRepo bool }
Config is the configuration for a benchmarking run
func FromFileConfig ¶
FromFileConfig returns a validated Config based on the config file at the configPath
type ConfigTest ¶
type ConfigTest struct { // Name is the test name Name string // N is the number of times a test should run N int // Options are additional sysbench test options a user can supply to run with this test Options []string // FromScript is a boolean indicating that this test is from a lua script FromScript bool }
ConfigTest provides users a way to define a test for multiple tablesizes
func NewConfigTest ¶
func NewConfigTest(name string, opts []string, fromScript bool) *ConfigTest
NewConfigTest returns a ConfigTest containing the supplied args
func (*ConfigTest) GetTests ¶
func (ct *ConfigTest) GetTests(serverConfig *ServerConfig, testIdFunc func() string) ([]*Test, error)
GetTests returns a slice of Tests
type Result ¶
type Result struct { // Id is the uuid of this result row Id string `json:"id"` // SuiteId is the test suite id this test result is associated with SuiteId string `json:"suite_id"` // TestId is the unique id for this test TestId string `json:"test_id"` // RuntimeOS is the runtime platform RuntimeOS string `json:"runtime_os"` // RuntimeGoArch is the runtime architecture RuntimeGoArch string `json:"runtime_goarch"` // ServerName is the name of the server used for the benchmark ServerName string `json:"server_name"` // ServerVersion is the server's version ServerVersion string `json:"server_version"` // ServerParams are the params used to run the server ServerParams string `json:"server_params"` // TestName is the name of the test TestName string `json:"test_name"` // TestParams are the params used to run the test TestParams string `json:"test_params"` // CreatedAt is the time the result was created UTC CreatedAt string `json:"created_at"` // SqlReadQueries is the number of read queries performed SqlReadQueries int64 `json:"sql_read_queries"` // SqlWriteQueries is the number of write queries performed SqlWriteQueries int64 `json:"sql_write_queries"` // SqlOtherQueries is the number of other queries performed SqlOtherQueries int64 `json:"sql_other_queries"` // SqlTotalQueries is the number of total queries performed SqlTotalQueries int64 `json:"sql_total_queries"` // SqlTotalQueriesPerSecond is the number of queries per second SqlTotalQueriesPerSecond float64 `json:"sql_total_queries_per_second"` // TransactionsTotal is the number of transactions performed TransactionsTotal int64 `json:"sql_transactions_total"` // TransactionsPerSecond is the number of transactions per second TransactionsPerSecond float64 `json:"sql_transactions_per_second"` // IgnoredErrorsTotal is the number of errors ignored IgnoredErrorsTotal int64 `json:"sql_ignored_errors_total"` // IgnoredErrorsPerSecond is the number of errors ignored per second IgnoredErrorsPerSecond float64 `json:"sql_ignored_errors_per_second"` // ReconnectsTotal is the number of reconnects performed ReconnectsTotal int64 `json:"sql_reconnects_total"` // ReconnectsPerSecond is the number of reconnects per second ReconnectsPerSecond float64 `json:"sql_reconnects_per_second"` // TotalTimeSeconds is the total time elapsed for this test TotalTimeSeconds float64 `json:"total_time_seconds"` // TotalNumberOfEvents is the total number of events TotalNumberOfEvents int64 `json:"total_number_of_events"` // LatencyMinMS is the minimum latency in milliseconds LatencyMinMS float64 `json:"latency_minimum_ms"` // LatencyAvgMS is the average latency in milliseconds LatencyAvgMS float64 `json:"latency_average_ms"` // LatencyMaxMS is the maximum latency in milliseconds LatencyMaxMS float64 `json:"latency_maximum_ms"` // LatencyPercentile is the latency of the 95th percentile LatencyPercentile float64 `json:"latency_percentile"` // LatencySumMS is the latency sum in milliseconds LatencySumMS float64 `json:"latency_sum_ms"` }
Result stores the output from a sysbench test run
func FromConfigsNewResult ¶
func FromConfigsNewResult(config *Config, serverConfig *ServerConfig, t *Test, suiteId string, idFunc func() string) (*Result, error)
FromConfigsNewResult returns a new result with some fields set based on the provided configs
func FromOutputResult ¶
func FromOutputResult(output []byte, config *Config, serverConfig *ServerConfig, test *Test, suiteId string, idFunc func() string) (*Result, error)
FromOutputResult accepts raw sysbench run output and returns the Result
type Results ¶
type Results []*Result
Results is a slice of Result
func BenchmarkDolt ¶
func BenchmarkDolt(ctx context.Context, config *Config, serverConfig *ServerConfig) (Results, error)
BenchmarkDolt benchmarks dolt based on the provided configurations
func BenchmarkMysql ¶
func BenchmarkMysql(ctx context.Context, config *Config, serverConfig *ServerConfig) (Results, error)
BenchmarkMysql benchmarks mysql based on the provided configurations
func ReadResultsCsv ¶
ReadResultsCsv reads a csv into Results
func ReadResultsJson ¶
ReadResultsJson reads a json file into Results
type ServerConfig ¶
type ServerConfig struct { // Id is a unique id for this servers benchmarking Id string // Host is the server host Host string // Port is the server port Port int // Server is the type of server Server ServerType // Version is the server version Version string // ResultsFormat is the format the results should be written in ResultsFormat string // ServerExec is the path to a server executable ServerExec string // ServerArgs are the args used to start a server ServerArgs []string // ConnectionProtocol defines the protocol for connecting to the server ConnectionProtocol string // Socket is the path to the server socket Socket string }
ServerConfig is the configuration for a server to test against
func (*ServerConfig) GetId ¶
func (sc *ServerConfig) GetId() string
func (*ServerConfig) GetServerArgs ¶
func (sc *ServerConfig) GetServerArgs() []string
GetServerArgs returns the args used to start a server
type ServerType ¶
type ServerType string
type Test ¶
type Test struct { // Name is the test name Name string // Params are the parameters passed to sysbench Params []string // FromScript indicates if this test is from a lua script FromScript bool // contains filtered or unexported fields }
Test is a single sysbench test
func GetTests ¶
func GetTests(config *Config, serverConfig *ServerConfig, testIdFunc func() string) ([]*Test, error)
GetTests returns a slice of Tests created from the defined ServerConfig.Tests