示例#1
0
文件: main.go 项目: netbrain/dlog-exp
func main() {
	flag.PrintDefaults()
	flag.Parse()

	s := strings.Split(servers, ",")
	writeClient = client.NewWriteClient(s)
	readClient = client.NewReadClient(s)

	http.HandleFunc("/record", log)
	http.HandleFunc("/replay", replay)

	http.ListenAndServe(":80", nil)
}
示例#2
0
文件: main.go 项目: netbrain/goatpad
func writeBench() {
	payload := make([]byte, 1024)
	rand.Read(payload)

	c := client.NewWriteClient(servers)
	defer c.Close()

	fmt.Println("\n Starting write benchmark")
	start := time.Now()
	for x := numWrites; x > 0; x-- {
		c.Write(payload)
	}
	elapsed := time.Since(start)

	fmt.Printf("Writing %d entries took %s\n\n", numWrites, elapsed)
	fmt.Printf("%f entries pr second\n", float64(numWrites)/elapsed.Seconds())

}