Esempio n. 1
0
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)
}
Esempio n. 2
0
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())

}