Beispiel #1
0
// qps2 is a function used by tests to run a vtgate load check.
// It will get the same srvKeyspaces as fast as possible and display the QPS.
func qps2(cell string, keyspaces []string) {
	var count sync2.AtomicInt32
	for _, keyspace := range keyspaces {
		for i := 0; i < 10; i++ {
			go func() {
				rpcClient := connect()
				for true {
					getSrvKeyspace(rpcClient, cell, keyspace, false)
					count.Add(1)
				}
			}()
		}
	}

	ticker := time.NewTicker(time.Second)
	i := 0
	for _ = range ticker.C {
		c := count.Get()
		count.Set(0)
		println(fmt.Sprintf("QPS = %v", c))
		i++
		if i == 10 {
			break
		}
	}
}
Beispiel #2
0
// qps is a function used by tests to run a zkocc load check.
// It will get zk paths as fast as possible and display the QPS.
func qps(paths []string) {
	var count sync2.AtomicInt32
	for _, path := range paths {
		for i := 0; i < 10; i++ {
			go func() {
				rpcClient := connect()
				for true {
					get(rpcClient, path, false)
					count.Add(1)
				}
			}()
		}
	}

	ticker := time.NewTicker(time.Second)
	i := 0
	for _ = range ticker.C {
		c := count.Get()
		count.Set(0)
		println(fmt.Sprintf("QPS = %v", c))
		i++
		if i == 10 {
			break
		}
	}
}