mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2730 from yichengq/tester-key-param
main: parameterize stress key size and key suffix range
This commit is contained in:
commit
eafdd3b718
@ -32,6 +32,8 @@ const peerURLPort = 2380
|
|||||||
type cluster struct {
|
type cluster struct {
|
||||||
agentEndpoints []string
|
agentEndpoints []string
|
||||||
datadir string
|
datadir string
|
||||||
|
stressKeySize int
|
||||||
|
stressKeySuffixRange int
|
||||||
|
|
||||||
Size int
|
Size int
|
||||||
Agents []client.Agent
|
Agents []client.Agent
|
||||||
@ -45,10 +47,12 @@ type ClusterStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newCluster starts and returns a new cluster. The caller should call Terminate when finished, to shut it down.
|
// newCluster starts and returns a new cluster. The caller should call Terminate when finished, to shut it down.
|
||||||
func newCluster(agentEndpoints []string, datadir string) (*cluster, error) {
|
func newCluster(agentEndpoints []string, datadir string, stressKeySize, stressKeySuffixRange int) (*cluster, error) {
|
||||||
c := &cluster{
|
c := &cluster{
|
||||||
agentEndpoints: agentEndpoints,
|
agentEndpoints: agentEndpoints,
|
||||||
datadir: datadir,
|
datadir: datadir,
|
||||||
|
stressKeySize: stressKeySize,
|
||||||
|
stressKeySuffixRange: stressKeySuffixRange,
|
||||||
}
|
}
|
||||||
if err := c.Bootstrap(); err != nil {
|
if err := c.Bootstrap(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -110,9 +114,8 @@ func (c *cluster) Bootstrap() error {
|
|||||||
for i, u := range clientURLs {
|
for i, u := range clientURLs {
|
||||||
s := &stresser{
|
s := &stresser{
|
||||||
Endpoint: u,
|
Endpoint: u,
|
||||||
// 500000 100B key (50MB)
|
KeySize: c.stressKeySize,
|
||||||
KeySize: 100,
|
KeySuffixRange: c.stressKeySuffixRange,
|
||||||
KeySuffixRange: 500000,
|
|
||||||
N: 200,
|
N: 200,
|
||||||
}
|
}
|
||||||
go s.Stress()
|
go s.Stress()
|
||||||
|
@ -24,11 +24,13 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
endpointStr := flag.String("agent-endpoints", ":9027", "")
|
endpointStr := flag.String("agent-endpoints", ":9027", "")
|
||||||
datadir := flag.String("data-dir", "agent.etcd", "")
|
datadir := flag.String("data-dir", "agent.etcd", "")
|
||||||
|
stressKeySize := flag.Int("stress-key-size", 100, "stress-key-size is the size of each key written into etcd")
|
||||||
|
stressKeySuffixRange := flag.Int("stress-key-count", 250000, "stress-key-count is the count of key range written into etcd")
|
||||||
limit := flag.Int("limit", 3, "")
|
limit := flag.Int("limit", 3, "")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
endpoints := strings.Split(*endpointStr, ",")
|
endpoints := strings.Split(*endpointStr, ",")
|
||||||
c, err := newCluster(endpoints, *datadir)
|
c, err := newCluster(endpoints, *datadir, *stressKeySize, *stressKeySuffixRange)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user