Adjust defaults and reporting for serve_hostnames

pull/6/head
Satnam Singh 2015-04-02 16:01:58 -07:00
parent b21db4b214
commit 1c2a903e78
1 changed files with 5 additions and 6 deletions

View File

@ -40,7 +40,7 @@ import (
) )
var ( var (
queriesAverage = flag.Int("queries", 20, "Number of hostname queries to make in each iteration per pod on average") queriesAverage = flag.Int("queries", 100, "Number of hostname queries to make in each iteration per pod on average")
podsPerNode = flag.Int("pods_per_node", 1, "Number of serve_hostname pods per node") podsPerNode = flag.Int("pods_per_node", 1, "Number of serve_hostname pods per node")
upTo = flag.Int("up_to", 1, "Number of iterations or -1 for no limit") upTo = flag.Int("up_to", 1, "Number of iterations or -1 for no limit")
maxPar = flag.Int("max_par", 500, "Maximum number of queries in flight") maxPar = flag.Int("max_par", 500, "Maximum number of queries in flight")
@ -264,7 +264,7 @@ func main() {
inFlight := make(chan struct{}, *maxPar) inFlight := make(chan struct{}, *maxPar)
start := time.Now() start := time.Now()
for q := 0; q < queries; q++ { for q := 0; q < queries; q++ {
go func() { go func(i int, query int) {
inFlight <- struct{}{} inFlight <- struct{}{}
t := time.Now() t := time.Now()
hostname, err := c.Get(). hostname, err := c.Get().
@ -274,8 +274,6 @@ func main() {
Name("serve-hostnames"). Name("serve-hostnames").
DoRaw() DoRaw()
glog.V(4).Infof("Proxy call in namespace %s took %v", ns, time.Since(t)) glog.V(4).Infof("Proxy call in namespace %s took %v", ns, time.Since(t))
i := iteration
query := q
if err != nil { if err != nil {
glog.Warningf("Call failed during iteration %d query %d : %v", i, query, err) glog.Warningf("Call failed during iteration %d query %d : %v", i, query, err)
// If the query failed return a string which starts with a character // If the query failed return a string which starts with a character
@ -285,7 +283,7 @@ func main() {
responseChan <- string(hostname) responseChan <- string(hostname)
} }
<-inFlight <-inFlight
}() }(iteration, q)
} }
responses := make(map[string]int, *podsPerNode*len(nodes.Items)) responses := make(map[string]int, *podsPerNode*len(nodes.Items))
missing := 0 missing := 0
@ -312,6 +310,7 @@ func main() {
} }
} }
} }
glog.Infof("Iteration %d took %v for %d queries (%.2f QPS)", iteration, time.Since(start), queries, float64(queries)/time.Since(start).Seconds()) glog.Infof("Iteration %d took %v for %d queries (%.2f QPS) with %d missing",
iteration, time.Since(start), queries-missing, float64(queries-missing)/time.Since(start).Seconds(), missing)
} }
} }