diff --git a/src/benchmark/benchmark_config.sample.toml b/src/benchmark/benchmark_config.sample.toml index 60018f20cd..e8b6a066e9 100644 --- a/src/benchmark/benchmark_config.sample.toml +++ b/src/benchmark/benchmark_config.sample.toml @@ -14,7 +14,7 @@ user = "user" password = "pass" is_secure = false skip_verify = false -timeout = "5s" +timeout = "10s" # A regular database, user, and password to read and write data on the cluster being benchmarked. [cluster_credentials] @@ -32,6 +32,9 @@ runs_per_load_definition = 10000 [[servers]] connection_string = "localhost:8086" +is_secure = false +skip_verify = false +timeout = "10s" # Load definitions describe the reads and writes that you want to simulate. # The connections take writes from the load definitions as they're sent out. diff --git a/src/benchmark/influxdb_benchmark.go b/src/benchmark/influxdb_benchmark.go index 9aefd00b7a..266f8847f2 100644 --- a/src/benchmark/influxdb_benchmark.go +++ b/src/benchmark/influxdb_benchmark.go @@ -29,14 +29,23 @@ type benchmarkConfig struct { Log *os.File } +type duration struct { + time.Duration +} + +func (d *duration) UnmarshalText(text []byte) (err error) { + d.Duration, err = time.ParseDuration(string(text)) + return err +} + type statsServer struct { - ConnectionString string `toml:"connection_string"` - User string `toml:"user"` - Password string `toml:"password"` - Database string `toml:"database"` - IsSecure bool `toml:"is_secure"` - SkipVerify bool `toml:"skip_verify"` - Timeout time.Duration `toml:"timeout"` + ConnectionString string `toml:"connection_string"` + User string `toml:"user"` + Password string `toml:"password"` + Database string `toml:"database"` + IsSecure bool `toml:"is_secure"` + SkipVerify bool `toml:"skip_verify"` + Timeout duration `toml:"timeout"` } type clusterCredentials struct { @@ -46,7 +55,10 @@ type clusterCredentials struct { } type server struct { - ConnectionString string `toml:"connection_string"` + ConnectionString string `toml:"connection_string"` + IsSecure bool `toml:"is_secure"` + SkipVerify bool `toml:"skip_verify"` + Timeout duration `toml:"timeout"` } type loadSettings struct { @@ -207,9 +219,9 @@ func (self *BenchmarkHarness) reportClient() *influxdb.Client { IsSecure: self.Config.StatsServer.IsSecure, HttpClient: &http.Client{ Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: self.Config.StatsServer.SkipVerify}, - ResponseHeaderTimeout: self.Config.StatsServer.Timeout, + ResponseHeaderTimeout: self.Config.StatsServer.Timeout.Duration, Dial: func(network, address string) (net.Conn, error) { - return net.DialTimeout(network, address, self.Config.StatsServer.Timeout) + return net.DialTimeout(network, address, self.Config.StatsServer.Timeout.Duration) }, }, }, @@ -381,7 +393,17 @@ func (self *BenchmarkHarness) queryAndReport(loadDef *loadDefinition, q *query, Host: s.ConnectionString, Database: self.Config.ClusterCredentials.Database, Username: self.Config.ClusterCredentials.User, - Password: self.Config.ClusterCredentials.Password} + Password: self.Config.ClusterCredentials.Password, + IsSecure: s.IsSecure, + HttpClient: &http.Client{ + Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: s.SkipVerify}, + ResponseHeaderTimeout: s.Timeout.Duration, + Dial: func(network, address string) (net.Conn, error) { + return net.DialTimeout(network, address, s.Timeout.Duration) + }, + }, + }, + } client, err := influxdb.NewClient(clientConfig) if err != nil { // report query fail @@ -428,7 +450,17 @@ func (self *BenchmarkHarness) handleWrites(s *server) { Host: s.ConnectionString, Database: self.Config.ClusterCredentials.Database, Username: self.Config.ClusterCredentials.User, - Password: self.Config.ClusterCredentials.Password} + Password: self.Config.ClusterCredentials.Password, + IsSecure: s.IsSecure, + HttpClient: &http.Client{ + Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: s.SkipVerify}, + ResponseHeaderTimeout: s.Timeout.Duration, + Dial: func(network, address string) (net.Conn, error) { + return net.DialTimeout(network, address, s.Timeout.Duration) + }, + }, + }, + } client, err := influxdb.NewClient(clientConfig) if err != nil { panic(fmt.Sprintf("Error connecting to server \"%s\": %s", s.ConnectionString, err))