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

Density test : explicit concurrency parameterization #6459

Merged
merged 1 commit into from
Apr 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
102 changes: 79 additions & 23 deletions test/e2e/density.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,31 +210,87 @@ var _ = Describe("Density", func() {
// Tests with "Skipped" substring in their name will be skipped when running
// e2e test suite without --ginkgo.focus & --ginkgo.skip flags.

for _, count := range []int{30, 50, 100} {
name := fmt.Sprintf("should allow starting %d pods per node", count)
// TODO(wojtek-t): Don't skip 30 pods per node test once #6059 if fixed.
if count > 0 {
name = "[Skipped] " + name
}
It(name, func() {
RCName = "my-hostname-density" + strconv.Itoa(count) + "-" + string(util.NewUUID())
RunRC(c, RCName, ns, "gcr.io/google_containers/pause:go", count*minionCount)
})
type Density struct {
skip bool
totalPods int
podsPerMinion int
rcsPerThread int
}

It("[Skipped] should have master components that can handle many short-lived pods", func() {
threads := 5
var wg sync.WaitGroup
wg.Add(threads)
for i := 0; i < threads; i++ {
go func() {
defer wg.Done()
for i := 0; i < 10; i++ {
name := "my-hostname-thrash-" + string(util.NewUUID())
RunRC(c, name, ns, "gcr.io/google_containers/pause:go", 10*minionCount)
//This test should always run, even if larger densities are skipped.
d3 := Density{totalPods: 3, podsPerMinion: 0, rcsPerThread: 1, skip: false}

//These tests are varied and customizable.
//TODO (wojtek-t):don't skip d30 after #6059
d30 := Density{totalPods: 30, podsPerMinion: 0, rcsPerThread: 1, skip: true}
d50 := Density{totalPods: 50, podsPerMinion: 0, rcsPerThread: 1, skip: true}
d100 := Density{totalPods: 100, podsPerMinion: 0, rcsPerThread: 1, skip: true}
d500t5 := Density{totalPods: 500, podsPerMinion: 10, rcsPerThread: 5, skip: true}
d500t25 := Density{totalPods: 500, podsPerMinion: 10, rcsPerThread: 25, skip: true}

dtests := []Density{d3, d30, d50, d100, d500t5, d500t25}

//Run each test in the array which isn't skipped.
for i := range dtests {

//cannot do a range iterator over structs.
dtest := dtests[i]

glog.Info("Density test parameters: %v", dtest)

//if ppm==0, its a raw density test.
//otherwise, we continue launching n nodes per pod in threads till we meet the totalPods #.
if dtest.podsPerMinion == 0 {
//basic density tests
name := fmt.Sprintf("should allow starting %d pods per node", dtest.totalPods)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this change is what we would like to do. The purpose of this test is to test how the performance looks in clusters with different sizes. So if we're testing a cluster with 2 nodes and a cluster with 100 nodes, the number of pods that we would like to start should be different (what I mean is that starting 30 pods on 100 nodes cluster doesn't expose Kubelets on heavy load at all).

I will prepare a PR for it.

BTW, I've just discovered that It() with function that takes parameters from "outside" world doesn't work (i.e. there are races - this works similarly to "go func()"). Will try to fix that too.

Copy link
Member

Choose a reason for hiding this comment

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

Regarding the race, this is the example of a log that shows it does not what we want:

Density
should allow starting 3 pods per node
/go/src/github.com/GoogleCloudPlatform/kubernetes/_output/dockerized/go/src/github.com/GoogleCloudPlatform/kubernetes/test/e2e/density.go:250
[BeforeEach] Density
/go/src/github.com/GoogleCloudPlatform/kubernetes/_output/dockerized/go/src/github.com/GoogleCloudPlatform/kubernetes/test/e2e/density.go:197

testContext.KubeConfig: /usr/local/google/home/wojtekt/.kube/.kubeconfig
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
STEP: Making sure all 20 replicas exist
I0407 10:56:31.395932 1059 density.go:110] Controller my-short-lived-podfbc034b9-dd03-11e4-9e2b-a0481cabf39b: Found 0 pods out of 20


if dtest.skip {
name = "[Skipped] " + name
}
It(name, func() {
RCName = "my-hostname-density" + strconv.Itoa(dtest.totalPods) + "-" + string(util.NewUUID())
RunRC(c, RCName, ns, "gcr.io/google_containers/pause:go", dtest.totalPods)
})
glog.Info("moving on, test already finished....")
} else {
// # of threads calibrate to totalPods
threads := (dtest.totalPods / (dtest.podsPerMinion * dtest.rcsPerThread))

name := fmt.Sprintf(
"[Skipped] should be able to launch %v pods, %v per minion, in %v rcs/thread.",
dtest.totalPods, dtest.podsPerMinion, dtest.rcsPerThread)

if dtest.skip {
name = "[Skipped] " + name
}

podsLaunched := 0
It(name, func() {

var wg sync.WaitGroup

//count down latch.., once all threads are launched, we wait for
//it to decrement down to zero.
wg.Add(threads)

//create queue of pending requests on the api server.
for i := 0; i < threads; i++ {
go func() {
// call to wg.Done will serve as a count down latch.
defer wg.Done()
for i := 0; i < dtest.rcsPerThread; i++ {
name := "my-short-lived-pod" + string(util.NewUUID())
n := dtest.podsPerMinion * minionCount
RunRC(c, name, ns, "gcr.io/google_containers/pause:go", n)
podsLaunched += n
glog.Info("Launched %v pods so far...", podsLaunched)
}
}()
}
}()
//Wait for all the pods from all the RC's to return.
wg.Wait()
glog.Info("%v pods out of %v launched", podsLaunched, dtest.totalPods)
})
}
wg.Wait()
})
}
})