mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4635 from gyuho/endpoints
benchmark: use endpoints for benchmark flag
This commit is contained in:
commit
18a5b88a32
@ -33,7 +33,7 @@ etcd client libray.
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
endpoints string
|
endpoints []string
|
||||||
totalConns uint
|
totalConns uint
|
||||||
totalClients uint
|
totalClients uint
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RootCmd.PersistentFlags().StringVar(&endpoints, "endpoint", "127.0.0.1:2378", "comma-separated gRPC endpoints")
|
RootCmd.PersistentFlags().StringSliceVar(&endpoints, "endpoints", []string{"127.0.0.1:2378"}, "gRPC endpoints")
|
||||||
RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections")
|
RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections")
|
||||||
RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients")
|
RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients")
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
)
|
)
|
||||||
@ -30,8 +29,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func mustCreateConn() *clientv3.Client {
|
func mustCreateConn() *clientv3.Client {
|
||||||
eps := strings.Split(endpoints, ",")
|
endpoint := endpoints[dialTotal%len(endpoints)]
|
||||||
endpoint := eps[dialTotal%len(eps)]
|
|
||||||
dialTotal++
|
dialTotal++
|
||||||
cfgtls := &tls
|
cfgtls := &tls
|
||||||
if cfgtls.Empty() {
|
if cfgtls.Empty() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user