Skip to content

Load test

Sai kiran Krishna murthy edited this page Apr 9, 2018 · 1 revision
func writeToFile(index int) {
	filename := fmt.Sprintf("/tmp/dat%d", index)
	f, err := os.Create(filename)
	check(err)
	defer f.Close()
	w := bufio.NewWriter(f)
	for i := 0; i < 10000000000; i++ {
		w.WriteString("this is a random string\n")
		if (i%100 == 0) {
			fmt.Println("Wrote %d lines",i)
			w.Flush()
		}
	}
	w.Flush()
}
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .
docker build -t "test" .
docker run -d -v $PWD/temp:/tmp test:latest
Clone this wiki locally