Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional-tester: decouple stresser from tester #6506

Merged
merged 1 commit into from
Sep 23, 2016

Conversation

mitake
Copy link
Contributor

@mitake mitake commented Sep 22, 2016

This commit decouples stresser from the tester of
functional-tester. For doing it, this commit adds a new option
--stresser to etcd-tester. The option accepts two types of stresser:
"default" and "nop". If the option is "default", etcd-tester stresses
its etcd cluster with the existing stresser. If the option is "nop",
etcd-tester does nothing for stressing.

Partially fixes #6446

/cc @heyitsanthony

@gyuho
Copy link
Contributor

gyuho commented Sep 22, 2016

@mitake Test failed?

Copy link
Contributor

@heyitsanthony heyitsanthony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be more aggressive about hiding the stresser details from cluster

Endpoint: m.grpcAddr(),
keyLargeSize: c.stressKeyLargeSize,
keySize: c.stressKeySize,
keySuffixRange: c.stressKeySuffixRange,
N: stressN,
rateLimiter: limiter,
rateLimiter: rate.NewLimiter(rate.Limit(c.stressQPS), c.stressQPS),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes the rate limiting behavior; if there are n stressers, the cumulative rate will be n*stressQPS instead of stressQPS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is incorrect as you pointed. I'll revert the part in the next update. Thanks.

@@ -70,6 +71,7 @@ func main() {
stressKeyLargeSize: int(*stressKeyLargeSize),
stressKeySize: int(*stressKeySize),
stressKeySuffixRange: int(*stressKeySuffixRange),
stresserType: *stresserType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing a string around means cluster still needs to know a lot about stresser internals, how about tearing out most of the stresser stuff from cluster:

//stresser.go

type stressConfig struct {
    qps int
    keyLargeSize int
    keySize int
    keySuffixRange int
    v2 bool
}

type stressBuilder func(m *member) Stresser

func newStressBuilder(s string, sc *stessConfig) stressBuilder {
    switch s {
    case "none": return func(*member) Stresser { return &nopStresser{} } 
    case "default":
        l := rate.NewLimiter(rate.Limit(sc.QPS), sc.QPS)
        return func(m *member) Stresser { ... }
    }
}
//main.go
c := &cluster{
    ...
    stressBuilder: newStressBuilder(&sc, *stresserType)
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builder style seems to be good. I'll use it.


func (s *nopStresser) Stress() error { return nil }
func (s *nopStresser) Cancel() {}
func (s *nopStresser) Report() (int, int) { return 0, 0 }
Copy link
Contributor

@heyitsanthony heyitsanthony Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return time.Since(start).Seconds() * qps, 0? Otherwise failureUntilSnapshot will error out since it expects the success rate to be increasing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice the check in failureUntilSnapshot, thanks for pointing!

@mitake
Copy link
Contributor Author

mitake commented Sep 23, 2016

@gyuho sorry, this PR has a format error. I'll fix it in the next update.

This commit decouples stresser from the tester of
functional-tester. For doing it, this commit adds a new option
--stresser to etcd-tester. The option accepts two types of stresser:
"default" and "nop". If the option is "default", etcd-tester stresses
its etcd cluster with the existing stresser. If the option is "nop",
etcd-tester does nothing for stressing.

Partially fixes etcd-io#6446
@mitake
Copy link
Contributor Author

mitake commented Sep 23, 2016

@gyuho @heyitsanthony updated for fixing the style problem and cleaner decoupling, PTAL

@heyitsanthony
Copy link
Contributor

lgtm. Thanks!

Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thanks.

@gyuho gyuho merged commit 4ef44d1 into etcd-io:master Sep 23, 2016
@mitake mitake deleted the decouple-stresser branch September 24, 2016 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

RFC: functional-tester: decoupling stresser, fault injector and consistency checker
3 participants