-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
56 lines (43 loc) · 1.05 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"flag"
"log"
"cql_stress/ralpe"
"cql_stress/randzylla"
)
func main() {
var (
runs int
parallelism int
rate int
save bool
server string
serial bool
)
flag.IntVar(&rate, "rate-limit", 1, "Number of requests per second")
flag.IntVar(¶llelism, "parallelism", 1, "Number of parallel workers")
flag.IntVar(&runs, "runs", 1, "Number of consecutive runs")
flag.BoolVar(&save, "save", false, "Preserve test data")
flag.StringVar(&server, "server", "localhost:9042", "ScyllaDB IP:port")
flag.BoolVar(&serial, "serial", false, "Use serial values instead of random generated")
flag.Parse()
rz, err := randzylla.NewRandzylla(server)
if err != nil {
log.Fatal(err)
}
var insertFunction func() error
if serial {
insertFunction = rz.GetSerialInsertFunction()
} else {
insertFunction = rz.GetRandomInsertFunction()
}
r := ralpe.NewRalpe(insertFunction, rate, parallelism, rate*runs)
r.Start()
r.Wait()
if !save {
err = rz.TearDown()
if err != nil {
log.Fatal(err)
}
}
}