mirror of https://github.com/etcd-io/dbtester.git
dbtester: move configs to 'dbtesterpb'
This commit is contained in:
parent
c4ddeb3ce7
commit
f64981492a
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2017 CoreOS, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package dbtester
|
||||
|
||||
// Cetcd is cetcd-specific flags
|
||||
// (https://github.com/coreos/cetcd).
|
||||
type Cetcd struct {
|
||||
// no options needed yet
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2017 CoreOS, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package dbtester
|
||||
|
||||
// Consul is Consul-specific flags
|
||||
// (https://github.com/hashicorp/consul).
|
||||
type Consul struct {
|
||||
// no options needed yet
|
||||
}
|
||||
|
|
@ -21,148 +21,36 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/coreos/dbtester/dbtesterpb"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// MakeTag converts database description to database tag.
|
||||
func MakeTag(desc string) string {
|
||||
s := strings.ToLower(desc)
|
||||
s = strings.Replace(s, "go ", "go", -1)
|
||||
s = strings.Replace(s, "java ", "java", -1)
|
||||
s = strings.Replace(s, "(", "", -1)
|
||||
s = strings.Replace(s, ")", "", -1)
|
||||
return strings.Replace(s, " ", "-", -1)
|
||||
}
|
||||
|
||||
// Config configures dbtester control clients.
|
||||
type Config struct {
|
||||
TestTitle string `yaml:"test_title"`
|
||||
TestDescription string `yaml:"test_description"`
|
||||
|
||||
Control `yaml:"control"`
|
||||
AllDatabaseIDList []string `yaml:"all_database_id_list"`
|
||||
DatabaseIDToTestGroup map[string]TestGroup `yaml:"datatbase_id_to_test_group"`
|
||||
DatabaseIDToTestData map[string]TestData `yaml:"datatbase_id_to_test_data"`
|
||||
dbtesterpb.ConfigClientMachineInitial `yaml:"config_client_machine_common"`
|
||||
|
||||
Analyze `yaml:"analyze"`
|
||||
AllDatabaseIDList []string `yaml:"all_database_id_list"`
|
||||
DatabaseIDToConfigClientMachineAgentControl map[string]dbtesterpb.ConfigClientMachineAgentControl `yaml:"datatbase_id_to_config_client_machine_agent_control"`
|
||||
DatabaseIDToConfigAnalyzeMachineInitial map[string]dbtesterpb.ConfigAnalyzeMachineInitial `yaml:"datatbase_id_to_config_analyze_machine_common"`
|
||||
|
||||
PlotPathPrefix string `yaml:"plot_path_prefix"`
|
||||
PlotList []Plot `yaml:"plot_list"`
|
||||
README `yaml:"readme"`
|
||||
}
|
||||
dbtesterpb.ConfigAnalyzeMachineAllAggregatedOutput `yaml:"analyze_all_aggregated_output"`
|
||||
|
||||
// Control represents common control options on client machine.
|
||||
type Control struct {
|
||||
PathPrefix string `yaml:"path_prefix"`
|
||||
LogPath string `yaml:"log_path"`
|
||||
ClientSystemMetricsPath string `yaml:"client_system_metrics_path"`
|
||||
ClientSystemMetricsInterpolatedPath string `yaml:"client_system_metrics_interpolated_path"`
|
||||
ClientLatencyThroughputTimeseriesPath string `yaml:"client_latency_throughput_timeseries_path"`
|
||||
ClientLatencyDistributionAllPath string `yaml:"client_latency_distribution_all_path"`
|
||||
ClientLatencyDistributionPercentilePath string `yaml:"client_latency_distribution_percentile_path"`
|
||||
ClientLatencyDistributionSummaryPath string `yaml:"client_latency_distribution_summary_path"`
|
||||
ClientLatencyByKeyNumberPath string `yaml:"client_latency_by_key_number_path"`
|
||||
ServerDiskSpaceUsageSummaryPath string `yaml:"server_disk_space_usage_summary_path"`
|
||||
|
||||
GoogleCloudProjectName string `yaml:"google_cloud_project_name"`
|
||||
GoogleCloudStorageKeyPath string `yaml:"google_cloud_storage_key_path"`
|
||||
GoogleCloudStorageKey string
|
||||
GoogleCloudStorageBucketName string `yaml:"google_cloud_storage_bucket_name"`
|
||||
GoogleCloudStorageSubDirectory string `yaml:"google_cloud_storage_sub_directory"`
|
||||
}
|
||||
|
||||
// TestGroup specifies database test group.
|
||||
type TestGroup struct {
|
||||
DatabaseID string
|
||||
DatabaseDescription string `yaml:"database_description"`
|
||||
DatabaseTag string
|
||||
|
||||
PeerIPs []string `yaml:"peer_ips"`
|
||||
PeerIPsString string
|
||||
|
||||
DatabasePortToConnect int `yaml:"database_port_to_connect"`
|
||||
DatabaseEndpoints []string
|
||||
|
||||
AgentPortToConnect int `yaml:"agent_port_to_connect"`
|
||||
AgentEndpoints []string
|
||||
|
||||
// database-specific flags to start
|
||||
Etcdv2 `yaml:"etcdv2"`
|
||||
Etcdv3 `yaml:"etcdv3"`
|
||||
Zookeeper `yaml:"zookeeper"`
|
||||
Consul `yaml:"consul"`
|
||||
Zetcd `yaml:"zetcd"`
|
||||
Cetcd `yaml:"cetcd"`
|
||||
|
||||
// benchmark options
|
||||
BenchmarkOptions `yaml:"benchmark_options"`
|
||||
BenchmarkSteps `yaml:"benchmark_steps"`
|
||||
}
|
||||
|
||||
// BenchmarkOptions specifies the benchmark options.
|
||||
type BenchmarkOptions struct {
|
||||
Type string `yaml:"type"`
|
||||
|
||||
RequestNumber int64 `yaml:"request_number"`
|
||||
ConnectionNumber int64 `yaml:"connection_number"`
|
||||
ClientNumber int64 `yaml:"client_number"`
|
||||
ConnectionClientNumbers []int64 `yaml:"connection_client_numbers"`
|
||||
RateLimitRequestsPerSecond int64 `yaml:"rate_limit_requests_per_second"`
|
||||
|
||||
// for writes, reads
|
||||
SameKey bool `yaml:"same_key"`
|
||||
KeySizeBytes int64 `yaml:"key_size_bytes"`
|
||||
ValueSizeBytes int64 `yaml:"value_size_bytes"`
|
||||
|
||||
// for reads
|
||||
StaleRead bool `yaml:"stale_read"`
|
||||
}
|
||||
|
||||
// BenchmarkSteps specifies the benchmark workflow.
|
||||
type BenchmarkSteps struct {
|
||||
Step1StartDatabase bool `yaml:"step1_start_database"`
|
||||
Step2StressDatabase bool `yaml:"step2_stress_database"`
|
||||
Step3StopDatabase bool `yaml:"step3_stop_database"`
|
||||
Step4UploadLogs bool `yaml:"step4_upload_logs"`
|
||||
}
|
||||
|
||||
// TestData defines raw data to import.
|
||||
type TestData struct {
|
||||
DatabaseID string
|
||||
DatabaseTag string
|
||||
DatabaseDescription string
|
||||
|
||||
PathPrefix string `yaml:"path_prefix"`
|
||||
ClientSystemMetricsInterpolatedPath string `yaml:"client_system_metrics_interpolated_path"`
|
||||
ClientLatencyThroughputTimeseriesPath string `yaml:"client_latency_throughput_timeseries_path"`
|
||||
ClientLatencyDistributionAllPath string `yaml:"client_latency_distribution_all_path"`
|
||||
ClientLatencyDistributionPercentilePath string `yaml:"client_latency_distribution_percentile_path"`
|
||||
ClientLatencyDistributionSummaryPath string `yaml:"client_latency_distribution_summary_path"`
|
||||
ClientLatencyByKeyNumberPath string `yaml:"client_latency_by_key_number_path"`
|
||||
ServerDiskSpaceUsageSummaryPath string `yaml:"server_disk_space_usage_summary_path"`
|
||||
ServerMemoryByKeyNumberPath string `yaml:"server_memory_by_key_number_path"`
|
||||
ServerReadBytesDeltaByKeyNumberPath string `yaml:"server_read_bytes_delta_by_key_number_path"`
|
||||
ServerWriteBytesDeltaByKeyNumberPath string `yaml:"server_write_bytes_delta_by_key_number_path"`
|
||||
ServerSystemMetricsInterpolatedPathList []string `yaml:"server_system_metrics_interpolated_path_list"`
|
||||
AllAggregatedOutputPath string `yaml:"all_aggregated_output_path"`
|
||||
}
|
||||
|
||||
// Analyze defines analyze config.
|
||||
type Analyze struct {
|
||||
AllAggregatedOutputPathCSV string `yaml:"all_aggregated_output_path_csv"`
|
||||
AllAggregatedOutputPathTXT string `yaml:"all_aggregated_output_path_txt"`
|
||||
}
|
||||
|
||||
// Plot defines plot configuration.
|
||||
type Plot struct {
|
||||
Column string `yaml:"column"`
|
||||
XAxis string `yaml:"x_axis"`
|
||||
YAxis string `yaml:"y_axis"`
|
||||
OutputPathCSV string `yaml:"output_path_csv"`
|
||||
OutputPathList []string `yaml:"output_path_list"`
|
||||
}
|
||||
|
||||
// README defines how to write README.
|
||||
type README struct {
|
||||
OutputPath string `yaml:"output_path"`
|
||||
Images []Image `yaml:"images"`
|
||||
}
|
||||
|
||||
// Image defines image data.
|
||||
type Image struct {
|
||||
Title string `yaml:"title"`
|
||||
Path string `yaml:"path"`
|
||||
Type string `yaml:"type"`
|
||||
AnalyzePlotPathPrefix string `yaml:"analyze_plot_path_prefix"`
|
||||
AnalyzePlotList []dbtesterpb.ConfigAnalyzeMachinePlot `yaml:"analyze_plot_list"`
|
||||
dbtesterpb.ConfigAnalyzeMachineREADME `yaml:"analyze_readme"`
|
||||
}
|
||||
|
||||
// ReadConfig reads control configuration file.
|
||||
|
|
@ -176,19 +64,25 @@ func ReadConfig(fpath string, analyze bool) (*Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if cfg.Control.PathPrefix != "" {
|
||||
cfg.Control.LogPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.LogPath)
|
||||
cfg.Control.ClientSystemMetricsPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientSystemMetricsPath)
|
||||
cfg.Control.ClientSystemMetricsInterpolatedPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientSystemMetricsInterpolatedPath)
|
||||
cfg.Control.ClientLatencyThroughputTimeseriesPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientLatencyThroughputTimeseriesPath)
|
||||
cfg.Control.ClientLatencyDistributionAllPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientLatencyDistributionAllPath)
|
||||
cfg.Control.ClientLatencyDistributionPercentilePath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientLatencyDistributionPercentilePath)
|
||||
cfg.Control.ClientLatencyDistributionSummaryPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientLatencyDistributionSummaryPath)
|
||||
cfg.Control.ClientLatencyByKeyNumberPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ClientLatencyByKeyNumberPath)
|
||||
cfg.Control.ServerDiskSpaceUsageSummaryPath = filepath.Join(cfg.Control.PathPrefix, cfg.Control.ServerDiskSpaceUsageSummaryPath)
|
||||
for _, id := range cfg.AllDatabaseIDList {
|
||||
if !dbtesterpb.IsValidDatabaseID(id) {
|
||||
return nil, fmt.Errorf("%q is unknown", id)
|
||||
}
|
||||
}
|
||||
|
||||
for databaseID, group := range cfg.DatabaseIDToTestGroup {
|
||||
if cfg.ConfigClientMachineInitial.PathPrefix != "" {
|
||||
cfg.ConfigClientMachineInitial.LogPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.LogPath)
|
||||
cfg.ConfigClientMachineInitial.ClientSystemMetricsPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientSystemMetricsPath)
|
||||
cfg.ConfigClientMachineInitial.ClientSystemMetricsInterpolatedPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientSystemMetricsInterpolatedPath)
|
||||
cfg.ConfigClientMachineInitial.ClientLatencyThroughputTimeseriesPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientLatencyThroughputTimeseriesPath)
|
||||
cfg.ConfigClientMachineInitial.ClientLatencyDistributionAllPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientLatencyDistributionAllPath)
|
||||
cfg.ConfigClientMachineInitial.ClientLatencyDistributionPercentilePath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientLatencyDistributionPercentilePath)
|
||||
cfg.ConfigClientMachineInitial.ClientLatencyDistributionSummaryPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientLatencyDistributionSummaryPath)
|
||||
cfg.ConfigClientMachineInitial.ClientLatencyByKeyNumberPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ClientLatencyByKeyNumberPath)
|
||||
cfg.ConfigClientMachineInitial.ServerDiskSpaceUsageSummaryPath = filepath.Join(cfg.ConfigClientMachineInitial.PathPrefix, cfg.ConfigClientMachineInitial.ServerDiskSpaceUsageSummaryPath)
|
||||
}
|
||||
|
||||
for databaseID, group := range cfg.DatabaseIDToConfigClientMachineAgentControl {
|
||||
group.DatabaseID = databaseID
|
||||
group.DatabaseTag = MakeTag(group.DatabaseDescription)
|
||||
group.PeerIPsString = strings.Join(group.PeerIPs, "___")
|
||||
|
|
@ -198,111 +92,126 @@ func ReadConfig(fpath string, analyze bool) (*Config, error) {
|
|||
group.DatabaseEndpoints[j] = fmt.Sprintf("%s:%d", group.PeerIPs[j], group.DatabasePortToConnect)
|
||||
group.AgentEndpoints[j] = fmt.Sprintf("%s:%d", group.PeerIPs[j], group.AgentPortToConnect)
|
||||
}
|
||||
cfg.DatabaseIDToTestGroup[databaseID] = group
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[databaseID] = group
|
||||
}
|
||||
|
||||
for databaseID, testdata := range cfg.DatabaseIDToTestData {
|
||||
testdata.PathPrefix = strings.TrimSpace(testdata.PathPrefix)
|
||||
testdata.DatabaseID = databaseID
|
||||
testdata.DatabaseTag = cfg.DatabaseIDToTestGroup[databaseID].DatabaseTag
|
||||
testdata.DatabaseDescription = cfg.DatabaseIDToTestGroup[databaseID].DatabaseDescription
|
||||
for databaseID, amc := range cfg.DatabaseIDToConfigAnalyzeMachineInitial {
|
||||
amc.PathPrefix = strings.TrimSpace(amc.PathPrefix)
|
||||
amc.DatabaseID = databaseID
|
||||
amc.DatabaseTag = cfg.DatabaseIDToConfigClientMachineAgentControl[databaseID].DatabaseTag
|
||||
amc.DatabaseDescription = cfg.DatabaseIDToConfigClientMachineAgentControl[databaseID].DatabaseDescription
|
||||
|
||||
if testdata.PathPrefix != "" {
|
||||
testdata.ClientSystemMetricsInterpolatedPath = testdata.PathPrefix + "-" + testdata.ClientSystemMetricsInterpolatedPath
|
||||
testdata.ClientLatencyThroughputTimeseriesPath = testdata.PathPrefix + "-" + testdata.ClientLatencyThroughputTimeseriesPath
|
||||
testdata.ClientLatencyDistributionAllPath = testdata.PathPrefix + "-" + testdata.ClientLatencyDistributionAllPath
|
||||
testdata.ClientLatencyDistributionPercentilePath = testdata.PathPrefix + "-" + testdata.ClientLatencyDistributionPercentilePath
|
||||
testdata.ClientLatencyDistributionSummaryPath = testdata.PathPrefix + "-" + testdata.ClientLatencyDistributionSummaryPath
|
||||
testdata.ClientLatencyByKeyNumberPath = testdata.PathPrefix + "-" + testdata.ClientLatencyByKeyNumberPath
|
||||
testdata.ServerDiskSpaceUsageSummaryPath = testdata.PathPrefix + "-" + testdata.ServerDiskSpaceUsageSummaryPath
|
||||
testdata.ServerMemoryByKeyNumberPath = testdata.PathPrefix + "-" + testdata.ServerMemoryByKeyNumberPath
|
||||
testdata.ServerReadBytesDeltaByKeyNumberPath = testdata.PathPrefix + "-" + testdata.ServerReadBytesDeltaByKeyNumberPath
|
||||
testdata.ServerWriteBytesDeltaByKeyNumberPath = testdata.PathPrefix + "-" + testdata.ServerWriteBytesDeltaByKeyNumberPath
|
||||
for i := range testdata.ServerSystemMetricsInterpolatedPathList {
|
||||
testdata.ServerSystemMetricsInterpolatedPathList[i] = testdata.PathPrefix + "-" + testdata.ServerSystemMetricsInterpolatedPathList[i]
|
||||
if amc.PathPrefix != "" {
|
||||
amc.ClientSystemMetricsInterpolatedPath = amc.PathPrefix + "-" + amc.ClientSystemMetricsInterpolatedPath
|
||||
amc.ClientLatencyThroughputTimeseriesPath = amc.PathPrefix + "-" + amc.ClientLatencyThroughputTimeseriesPath
|
||||
amc.ClientLatencyDistributionAllPath = amc.PathPrefix + "-" + amc.ClientLatencyDistributionAllPath
|
||||
amc.ClientLatencyDistributionPercentilePath = amc.PathPrefix + "-" + amc.ClientLatencyDistributionPercentilePath
|
||||
amc.ClientLatencyDistributionSummaryPath = amc.PathPrefix + "-" + amc.ClientLatencyDistributionSummaryPath
|
||||
amc.ClientLatencyByKeyNumberPath = amc.PathPrefix + "-" + amc.ClientLatencyByKeyNumberPath
|
||||
amc.ServerDiskSpaceUsageSummaryPath = amc.PathPrefix + "-" + amc.ServerDiskSpaceUsageSummaryPath
|
||||
amc.ServerMemoryByKeyNumberPath = amc.PathPrefix + "-" + amc.ServerMemoryByKeyNumberPath
|
||||
amc.ServerReadBytesDeltaByKeyNumberPath = amc.PathPrefix + "-" + amc.ServerReadBytesDeltaByKeyNumberPath
|
||||
amc.ServerWriteBytesDeltaByKeyNumberPath = amc.PathPrefix + "-" + amc.ServerWriteBytesDeltaByKeyNumberPath
|
||||
for i := range amc.ServerSystemMetricsInterpolatedPathList {
|
||||
amc.ServerSystemMetricsInterpolatedPathList[i] = amc.PathPrefix + "-" + amc.ServerSystemMetricsInterpolatedPathList[i]
|
||||
}
|
||||
testdata.AllAggregatedOutputPath = testdata.PathPrefix + "-" + testdata.AllAggregatedOutputPath
|
||||
amc.AllAggregatedOutputPath = amc.PathPrefix + "-" + amc.AllAggregatedOutputPath
|
||||
}
|
||||
|
||||
cfg.DatabaseIDToTestData[databaseID] = testdata
|
||||
cfg.DatabaseIDToConfigAnalyzeMachineInitial[databaseID] = amc
|
||||
}
|
||||
|
||||
for databaseID, group := range cfg.DatabaseIDToTestGroup {
|
||||
if databaseID != "etcdv3" && group.BenchmarkOptions.ConnectionNumber != group.BenchmarkOptions.ClientNumber {
|
||||
return nil, fmt.Errorf("%q got connected %d != clients %d", databaseID, group.BenchmarkOptions.ConnectionNumber, group.BenchmarkOptions.ClientNumber)
|
||||
for databaseID, ctrl := range cfg.DatabaseIDToConfigClientMachineAgentControl {
|
||||
if databaseID != dbtesterpb.DatabaseID_etcd__v3_1.String() && ctrl.ConfigClientMachineBenchmarkOptions.ConnectionNumber != ctrl.ConfigClientMachineBenchmarkOptions.ClientNumber {
|
||||
return nil, fmt.Errorf("%q got connected %d != clients %d", databaseID, ctrl.ConfigClientMachineBenchmarkOptions.ConnectionNumber, ctrl.ConfigClientMachineBenchmarkOptions.ClientNumber)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
defaultEtcdSnapCount int64 = 100000
|
||||
defaultEtcdSnapshotCount int64 = 100000
|
||||
defaultZookeeperSnapCount int64 = 100000
|
||||
defaultZookeeperTickTime int64 = 2000
|
||||
defaultZookeeperInitLimit int64 = 5
|
||||
defaultZookeeperSyncLimit int64 = 5
|
||||
defaultZookeeperMaxClientConnections int64 = 5000
|
||||
)
|
||||
if v, ok := cfg.DatabaseIDToTestGroup["etcdv3"]; ok {
|
||||
if v.Etcdv3.SnapCount == 0 {
|
||||
v.Etcdv3.SnapCount = defaultEtcdSnapCount
|
||||
if v, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__v3_1.String()]; ok {
|
||||
if v.Flag_Etcd_V3_1.SnapshotCount == 0 {
|
||||
v.Flag_Etcd_V3_1.SnapshotCount = defaultEtcdSnapshotCount
|
||||
}
|
||||
cfg.DatabaseIDToTestGroup["etcdv3"] = v
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__v3_1.String()] = v
|
||||
}
|
||||
if v, ok := cfg.DatabaseIDToTestGroup["etcdtip"]; ok {
|
||||
if v.Etcdv3.SnapCount == 0 {
|
||||
v.Etcdv3.SnapCount = defaultEtcdSnapCount
|
||||
if v, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__v3_2.String()]; ok {
|
||||
if v.Flag_Etcd_V3_2.SnapshotCount == 0 {
|
||||
v.Flag_Etcd_V3_2.SnapshotCount = defaultEtcdSnapshotCount
|
||||
}
|
||||
cfg.DatabaseIDToTestGroup["etcdtip"] = v
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__v3_2.String()] = v
|
||||
}
|
||||
if v, ok := cfg.DatabaseIDToTestGroup["zookeeper"]; ok {
|
||||
if v.Zookeeper.TickTime == 0 {
|
||||
v.Zookeeper.TickTime = defaultZookeeperTickTime
|
||||
if v, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__tip.String()]; ok {
|
||||
if v.Flag_Etcd_Tip.SnapshotCount == 0 {
|
||||
v.Flag_Etcd_Tip.SnapshotCount = defaultEtcdSnapshotCount
|
||||
}
|
||||
if v.Zookeeper.InitLimit == 0 {
|
||||
v.Zookeeper.InitLimit = defaultZookeeperInitLimit
|
||||
}
|
||||
if v.Zookeeper.SyncLimit == 0 {
|
||||
v.Zookeeper.SyncLimit = defaultZookeeperSyncLimit
|
||||
}
|
||||
if v.Zookeeper.SnapCount == 0 {
|
||||
v.Zookeeper.SnapCount = defaultZookeeperSnapCount
|
||||
}
|
||||
if v.Zookeeper.MaxClientConnections == 0 {
|
||||
v.Zookeeper.MaxClientConnections = defaultZookeeperMaxClientConnections
|
||||
}
|
||||
cfg.DatabaseIDToTestGroup["zookeeper"] = v
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_etcd__tip.String()] = v
|
||||
}
|
||||
|
||||
if cfg.Control.GoogleCloudStorageKeyPath != "" && !analyze {
|
||||
bts, err = ioutil.ReadFile(cfg.Control.GoogleCloudStorageKeyPath)
|
||||
if v, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_zookeeper__r3_4_9.String()]; ok {
|
||||
if v.Flag_Zookeeper_R3_4_9.TickTime == 0 {
|
||||
v.Flag_Zookeeper_R3_4_9.TickTime = defaultZookeeperTickTime
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_4_9.InitLimit == 0 {
|
||||
v.Flag_Zookeeper_R3_4_9.InitLimit = defaultZookeeperInitLimit
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_4_9.SyncLimit == 0 {
|
||||
v.Flag_Zookeeper_R3_4_9.SyncLimit = defaultZookeeperSyncLimit
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_4_9.SnapCount == 0 {
|
||||
v.Flag_Zookeeper_R3_4_9.SnapCount = defaultZookeeperSnapCount
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_4_9.MaxClientConnections == 0 {
|
||||
v.Flag_Zookeeper_R3_4_9.MaxClientConnections = defaultZookeeperMaxClientConnections
|
||||
}
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_zookeeper__r3_4_9.String()] = v
|
||||
}
|
||||
if v, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_zookeeper__r3_5_2_alpha.String()]; ok {
|
||||
if v.Flag_Zookeeper_R3_5_2Alpha.TickTime == 0 {
|
||||
v.Flag_Zookeeper_R3_5_2Alpha.TickTime = defaultZookeeperTickTime
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_5_2Alpha.InitLimit == 0 {
|
||||
v.Flag_Zookeeper_R3_5_2Alpha.InitLimit = defaultZookeeperInitLimit
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_5_2Alpha.SyncLimit == 0 {
|
||||
v.Flag_Zookeeper_R3_5_2Alpha.SyncLimit = defaultZookeeperSyncLimit
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_5_2Alpha.SnapCount == 0 {
|
||||
v.Flag_Zookeeper_R3_5_2Alpha.SnapCount = defaultZookeeperSnapCount
|
||||
}
|
||||
if v.Flag_Zookeeper_R3_5_2Alpha.MaxClientConnections == 0 {
|
||||
v.Flag_Zookeeper_R3_5_2Alpha.MaxClientConnections = defaultZookeeperMaxClientConnections
|
||||
}
|
||||
cfg.DatabaseIDToConfigClientMachineAgentControl[dbtesterpb.DatabaseID_zookeeper__r3_5_2_alpha.String()] = v
|
||||
}
|
||||
|
||||
if cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath != "" && !analyze {
|
||||
bts, err = ioutil.ReadFile(cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cfg.Control.GoogleCloudStorageKey = string(bts)
|
||||
cfg.ConfigClientMachineInitial.GoogleCloudStorageKey = string(bts)
|
||||
}
|
||||
|
||||
for i := range cfg.PlotList {
|
||||
cfg.PlotList[i].OutputPathCSV = filepath.Join(cfg.PlotPathPrefix, cfg.PlotList[i].Column+".csv")
|
||||
cfg.PlotList[i].OutputPathList = make([]string, 2)
|
||||
cfg.PlotList[i].OutputPathList[0] = filepath.Join(cfg.PlotPathPrefix, cfg.PlotList[i].Column+".svg")
|
||||
cfg.PlotList[i].OutputPathList[1] = filepath.Join(cfg.PlotPathPrefix, cfg.PlotList[i].Column+".png")
|
||||
for i := range cfg.AnalyzePlotList {
|
||||
cfg.AnalyzePlotList[i].OutputPathCSV = filepath.Join(cfg.AnalyzePlotPathPrefix, cfg.AnalyzePlotList[i].Column+".csv")
|
||||
cfg.AnalyzePlotList[i].OutputPathList = make([]string, 2)
|
||||
cfg.AnalyzePlotList[i].OutputPathList[0] = filepath.Join(cfg.AnalyzePlotPathPrefix, cfg.AnalyzePlotList[i].Column+".svg")
|
||||
cfg.AnalyzePlotList[i].OutputPathList[1] = filepath.Join(cfg.AnalyzePlotPathPrefix, cfg.AnalyzePlotList[i].Column+".png")
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
// MakeTag converts database scription to database tag.
|
||||
func MakeTag(desc string) string {
|
||||
s := strings.ToLower(desc)
|
||||
s = strings.Replace(s, "go ", "go", -1)
|
||||
s = strings.Replace(s, "java ", "java", -1)
|
||||
s = strings.Replace(s, "(", "", -1)
|
||||
s = strings.Replace(s, ")", "", -1)
|
||||
return strings.Replace(s, " ", "-", -1)
|
||||
}
|
||||
|
||||
// ToRequest converts configuration to 'dbtesterpb.Request'.
|
||||
func (cfg *Config) ToRequest(databaseID string, op dbtesterpb.Request_Operation, idx int) (req *dbtesterpb.Request, err error) {
|
||||
gcfg, ok := cfg.DatabaseIDToTestGroup[databaseID]
|
||||
func (cfg *Config) ToRequest(databaseID string, op dbtesterpb.Operation, idx int) (req *dbtesterpb.Request, err error) {
|
||||
gcfg, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[databaseID]
|
||||
if !ok {
|
||||
err = fmt.Errorf("%q is not defined", databaseID)
|
||||
return
|
||||
|
|
@ -310,47 +219,71 @@ func (cfg *Config) ToRequest(databaseID string, op dbtesterpb.Request_Operation,
|
|||
|
||||
req = &dbtesterpb.Request{
|
||||
Operation: op,
|
||||
TriggerLogUpload: gcfg.BenchmarkSteps.Step4UploadLogs,
|
||||
DatabaseID: dbtesterpb.Request_Database(dbtesterpb.Request_Database_value[databaseID]),
|
||||
TriggerLogUpload: gcfg.ConfigClientMachineBenchmarkSteps.Step4UploadLogs,
|
||||
DatabaseID: dbtesterpb.DatabaseID(dbtesterpb.DatabaseID_value[databaseID]),
|
||||
DatabaseTag: gcfg.DatabaseTag,
|
||||
PeerIPsString: gcfg.PeerIPsString,
|
||||
IpIndex: uint32(idx),
|
||||
CurrentClientNumber: gcfg.BenchmarkOptions.ClientNumber,
|
||||
Control: &dbtesterpb.Request_Control{
|
||||
GoogleCloudProjectName: cfg.Control.GoogleCloudProjectName,
|
||||
GoogleCloudStorageKey: cfg.Control.GoogleCloudStorageKey,
|
||||
GoogleCloudStorageBucketName: cfg.Control.GoogleCloudStorageBucketName,
|
||||
GoogleCloudStorageSubDirectory: cfg.Control.GoogleCloudStorageSubDirectory,
|
||||
IPIndex: uint32(idx),
|
||||
CurrentClientNumber: gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber,
|
||||
ConfigClientMachineInitial: &dbtesterpb.ConfigClientMachineInitial{
|
||||
GoogleCloudProjectName: cfg.ConfigClientMachineInitial.GoogleCloudProjectName,
|
||||
GoogleCloudStorageKey: cfg.ConfigClientMachineInitial.GoogleCloudStorageKey,
|
||||
GoogleCloudStorageBucketName: cfg.ConfigClientMachineInitial.GoogleCloudStorageBucketName,
|
||||
GoogleCloudStorageSubDirectory: cfg.ConfigClientMachineInitial.GoogleCloudStorageSubDirectory,
|
||||
},
|
||||
}
|
||||
|
||||
switch req.DatabaseID {
|
||||
case dbtesterpb.Request_etcdv2:
|
||||
|
||||
case dbtesterpb.Request_etcdv3:
|
||||
req.Etcdv3Config = &dbtesterpb.Request_Etcdv3{
|
||||
SnapCount: gcfg.Etcdv3.SnapCount,
|
||||
QuotaSizeBytes: gcfg.Etcdv3.QuotaSizeBytes,
|
||||
case dbtesterpb.DatabaseID_etcd__v2_3:
|
||||
req.Flag_Etcd_V2_3 = &dbtesterpb.Flag_Etcd_V2_3{
|
||||
SnapshotCount: gcfg.Flag_Etcd_V2_3.SnapshotCount,
|
||||
}
|
||||
case dbtesterpb.DatabaseID_etcd__v3_1:
|
||||
req.Flag_Etcd_V3_1 = &dbtesterpb.Flag_Etcd_V3_1{
|
||||
SnapshotCount: gcfg.Flag_Etcd_V3_1.SnapshotCount,
|
||||
QuotaSizeBytes: gcfg.Flag_Etcd_V3_1.QuotaSizeBytes,
|
||||
}
|
||||
case dbtesterpb.DatabaseID_etcd__v3_2:
|
||||
req.Flag_Etcd_V3_2 = &dbtesterpb.Flag_Etcd_V3_2{
|
||||
SnapshotCount: gcfg.Flag_Etcd_V3_2.SnapshotCount,
|
||||
QuotaSizeBytes: gcfg.Flag_Etcd_V3_2.QuotaSizeBytes,
|
||||
}
|
||||
case dbtesterpb.DatabaseID_etcd__tip:
|
||||
req.Flag_Etcd_Tip = &dbtesterpb.Flag_Etcd_Tip{
|
||||
SnapshotCount: gcfg.Flag_Etcd_Tip.SnapshotCount,
|
||||
QuotaSizeBytes: gcfg.Flag_Etcd_Tip.QuotaSizeBytes,
|
||||
}
|
||||
|
||||
case dbtesterpb.Request_zookeeper:
|
||||
req.ZookeeperConfig = &dbtesterpb.Request_Zookeeper{
|
||||
// TODO: jvm flags
|
||||
case dbtesterpb.DatabaseID_zookeeper__r3_4_9:
|
||||
req.Flag_Zookeeper_R3_4_9 = &dbtesterpb.Flag_Zookeeper_R3_4_9{
|
||||
MyID: uint32(idx + 1),
|
||||
TickTime: gcfg.Zookeeper.TickTime,
|
||||
TickTime: gcfg.Flag_Zookeeper_R3_4_9.TickTime,
|
||||
ClientPort: int64(gcfg.DatabasePortToConnect),
|
||||
InitLimit: gcfg.Zookeeper.InitLimit,
|
||||
SyncLimit: gcfg.Zookeeper.SyncLimit,
|
||||
SnapCount: gcfg.Zookeeper.SnapCount,
|
||||
MaxClientConnections: gcfg.Zookeeper.MaxClientConnections,
|
||||
InitLimit: gcfg.Flag_Zookeeper_R3_4_9.InitLimit,
|
||||
SyncLimit: gcfg.Flag_Zookeeper_R3_4_9.SyncLimit,
|
||||
SnapCount: gcfg.Flag_Zookeeper_R3_4_9.SnapCount,
|
||||
MaxClientConnections: gcfg.Flag_Zookeeper_R3_4_9.MaxClientConnections,
|
||||
}
|
||||
case dbtesterpb.DatabaseID_zookeeper__r3_5_2_alpha:
|
||||
req.Flag_Zookeeper_R3_5_2Alpha = &dbtesterpb.Flag_Zookeeper_R3_5_2Alpha{
|
||||
MyID: uint32(idx + 1),
|
||||
TickTime: gcfg.Flag_Zookeeper_R3_5_2Alpha.TickTime,
|
||||
ClientPort: int64(gcfg.DatabasePortToConnect),
|
||||
InitLimit: gcfg.Flag_Zookeeper_R3_5_2Alpha.InitLimit,
|
||||
SyncLimit: gcfg.Flag_Zookeeper_R3_5_2Alpha.SyncLimit,
|
||||
SnapCount: gcfg.Flag_Zookeeper_R3_5_2Alpha.SnapCount,
|
||||
MaxClientConnections: gcfg.Flag_Zookeeper_R3_5_2Alpha.MaxClientConnections,
|
||||
}
|
||||
|
||||
case dbtesterpb.Request_consul:
|
||||
case dbtesterpb.Request_zetcd:
|
||||
case dbtesterpb.Request_cetcd:
|
||||
case dbtesterpb.DatabaseID_consul__v0_7_5:
|
||||
case dbtesterpb.DatabaseID_consul__v0_8_0:
|
||||
|
||||
case dbtesterpb.DatabaseID_zetcd__beta:
|
||||
case dbtesterpb.DatabaseID_cetcd__beta:
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("unknown %v", req.DatabaseID)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2017 CoreOS, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package dbtester
|
||||
|
||||
// Zetcd is zetcd-specific flags
|
||||
// (https://github.com/coreos/zetcd).
|
||||
type Zetcd struct {
|
||||
// no options needed yet
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright 2017 CoreOS, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package dbtester
|
||||
|
||||
// Zookeeper is Zookeeper-specific flags
|
||||
// (http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html).
|
||||
type Zookeeper struct {
|
||||
TickTime int64 `yaml:"tick_time"`
|
||||
InitLimit int64 `yaml:"init_limit"`
|
||||
SyncLimit int64 `yaml:"sync_limit"`
|
||||
SnapCount int64 `yaml:"snap_count"`
|
||||
MaxClientConnections int64 `yaml:"max_client_connections"`
|
||||
}
|
||||
Loading…
Reference in New Issue