Beispiel #1
0
func main() {
	go http.ListenAndServe(":6666", nil)
	var wg sync.WaitGroup
	start := time.Now()
	for x := 0; x < clientCnt; x++ {
		c := client.NewClient(&client.Conf{ServerAddr: *serverAddress})
		wg.Add(1)
		go func() {
			defer wg.Done()
			cnt := total / clientCnt
			prs := make([]*client.PipelineRequest, cnt)
			for i := 0; i < cnt; i++ {
				pr := c.GoGetTimestamp()
				prs[i] = pr
			}

			for i := 0; i < cnt; i++ {
				prs[i].GetTS()
			}
		}()
	}
	wg.Wait()

	log.Debugf("Total %d, use %v/s", total, time.Since(start).Seconds())
}
Beispiel #2
0
// NewRemoteOracle creates an oracle that use a remote data source.
// Refer https://github.com/ngaut/tso for more details.
func NewRemoteOracle(zks, path string) oracle.Oracle {
	return &remoteOracle{
		c: client.NewClient(&client.Conf{
			ZKAddr:   zks,
			RootPath: path,
		}),
	}
}
Beispiel #3
0
// NewRemoteOracle creates an oracle that use a remote data source, addr should
// be formatted as 'host:port'.
// Refer https://github.com/ngaut/tso for more details.
func NewRemoteOracle(addr string) oracle.Oracle {
	return &remoteOracle{
		c: client.NewClient(&client.Conf{ServerAddr: addr}),
	}
}