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) }
func readBench() { c := client.NewReadClient(servers) defer c.Close() fmt.Println("\n Starting read benchmark") start := time.Now() replayChan := c.Replay() numReads := 0 for range replayChan { numReads++ } elapsed := time.Since(start) fmt.Printf("Reading %d entries took %s\n\n", numReads, elapsed) fmt.Printf("%f entries pr second\n", float64(numReads)/elapsed.Seconds()) }