cmd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2023 Filipe Oliveira hello@codeperf.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2023 Filipe Oliveira hello@codeperf.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2023 Filipe Oliveira hello@codeperf.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ReadPrimary   int64 = 0
	ReadSecondary       = 1
)

readPreference int mapping

View Source
const (
	CommandTypeRead  int64 = 0
	CommandTypeWrite       = 1
)

readPreference int mapping

Variables

View Source
var CommandTypeLatenciesRead *hdrhistogram.Histogram
View Source
var CommandTypeLatenciesWrite *hdrhistogram.Histogram

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func RegisterDBCreator

func RegisterDBCreator(name string, creator DBCreator)

RegisterDBCreator registers a creator for the database

Types

type DB

type DB interface {

	// Read reads a record from the database and returns a map of each field/value pair.
	// table: The name of the table.
	// key: The record key of the record to read.
	// readPreference:  route read operations to the primaries (0) or to the secondaries/replicas (1)
	// fields: The list of fields to read, nil|empty for reading all.
	Read(ctx context.Context, table string, key string, readPreference int64, fields []string) (map[string][]byte, error)

	// Insert inserts a record in the database. Any field/value pairs will be written into the
	// database.
	// table: The name of the table.
	// key: The record key of the record to insert.
	// numReplicas: number of replicas that acknowledged the insert.
	// numReplicasTimeout: timeout in milliseconds to ack.
	// values: A map of field/value pairs to insert in the record.
	Insert(ctx context.Context, table string, key string, numReplicas int64, numReplicasTimeout int64, values map[string][]byte) error
}

DB is the layer to access the database to be benchmarked.

type DBCreator

type DBCreator interface {
	Create(p *properties.Properties) (DB, error)
}

DBCreator creates a database layer.

func GetDBCreator

func GetDBCreator(name string) DBCreator

GetDBCreator gets the DBCreator for the database

type Datapoint

type Datapoint struct {
	Error   bool
	Latency uint64
	Type    int64
}

type TestResult

type TestResult struct {
	Metadata   string `json:"Metadata"`
	Clients    uint64 `json:"Clients"`
	MaxRps     uint64 `json:"MaxRps"`
	RandomSeed int64  `json:"RandomSeed"`

	StartTime      int64 `json:"StartTime"`
	EndTime        int64 `json:"EndTime"`
	DurationMillis int64 `json:"DurationMillis"`

	// Populated after benchmark
	// Benchmark Totals
	Totals map[string]float64 `json:"Totals"`

	// Overall Rates
	OverallCommandRate []float64 `json:"OverallCommandRate"`

	EncodedWriteHistogram []byte `json:"EncodedWriteHistogram"`
	EncodedReadHistogram  []byte `json:"EncodedReadHistogram"`

	// Overall Client Quantiles
	OverallClientLatencies map[string]map[string]float64 `json:"OverallClientLatencies"`
	// contains filtered or unexported fields
}

func NewTestResult

func NewTestResult(metadata string, clients uint64, maxRps uint64) *TestResult

func (*TestResult) FillDurationInfo

func (r *TestResult) FillDurationInfo(startTime time.Time, endTime time.Time, duration time.Duration)

func (*TestResult) SetUsedRandomSeed

func (r *TestResult) SetUsedRandomSeed(seed int64) *TestResult

type TestSpec

type TestSpec struct {
	Rps                      uint64
	Clients                  uint64
	Duration                 time.Duration
	StartAtUnix              int64
	ReadPreference           int64
	NumReplicas              int64
	NumReplicasTimeoutMillis int64
	Addr                     string
	Password                 string
	Username                 string
	ReadProportion           float64
	InsertProportion         float64
	RecordCount              uint64
	DataSize                 uint64
}

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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