コード例 #1
0
ファイル: zkclient2.go プロジェクト: pranjal5215/vitess
// qps 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 qps(ctx context.Context, 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(ctx, 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
		}
	}
}
コード例 #2
0
ファイル: zkclient2.go プロジェクト: chinna1986/vitess
// 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
		}
	}
}