diff --git a/cmd/stress/cgr-balancerstress/cgr-balancerstress.go b/cmd/stress/cgr-balancerstress/cgr-balancerstress.go index 2bdac5e6b..8305b6982 100644 --- a/cmd/stress/cgr-balancerstress/cgr-balancerstress.go +++ b/cmd/stress/cgr-balancerstress/cgr-balancerstress.go @@ -43,6 +43,7 @@ func main() { if err != nil { log.Fatalf("could not connect to balancer: %v", err) } + start := time.Now() if *parallel { var divCall *rpc.Call for i := 0; i < *runs; i++ { @@ -54,6 +55,8 @@ func main() { client.Call("Responder.GetCost", cd, &result) } } + duration := time.Since(start) log.Println(result) client.Close() + log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds()) } diff --git a/cmd/stress/cgr-raterstress/cgr-raterstress.go b/cmd/stress/cgr-raterstress/cgr-raterstress.go index 7a9f71b1b..c797f2417 100644 --- a/cmd/stress/cgr-raterstress/cgr-raterstress.go +++ b/cmd/stress/cgr-raterstress/cgr-raterstress.go @@ -36,12 +36,15 @@ func main() { t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC) cd := timespans.CallDescriptor{Direction: "OUT", TOR: "0", Tenant: "vdf", Subject: "rif", Destination: "0256", TimeStart: t1, TimeEnd: t2} result := timespans.CallCost{} - client, _ := jsonrpc.Dial("tcp", "localhost:5090") + client, _ := jsonrpc.Dial("tcp", "localhost:1234") i := 0 + start := time.Now() for j := 0; j < *runs; j++ { - client.Call("Storage.GetCost", cd, &result) + client.Call("Responder.GetCost", cd, &result) } + duration := time.Since(start) log.Println(result) log.Println(i) + log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds()) client.Close() } diff --git a/cmd/stress/cgr-spansstress/cgr-spansstress.go b/cmd/stress/cgr-spansstress/cgr-spansstress.go index bc233e8fe..c586d634b 100644 --- a/cmd/stress/cgr-spansstress/cgr-spansstress.go +++ b/cmd/stress/cgr-spansstress/cgr-spansstress.go @@ -58,15 +58,16 @@ func main() { log.Printf("Runnning %d cycles...", *runs) var result *timespans.CallCost j := 0 - + start := time.Now() for i := 0; i < *runs; i++ { result, err = cd.GetCost() j = i } - + duration := time.Since(start) log.Print(result, j, err) memstats := new(runtime.MemStats) runtime.ReadMemStats(memstats) log.Printf("memstats before GC: Kbytes = %d footprint = %d", memstats.HeapAlloc/1024, memstats.Sys/1024) + log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds()) } diff --git a/timespans/storage_redis.go b/timespans/storage_redis.go index 82d856431..8e098887b 100644 --- a/timespans/storage_redis.go +++ b/timespans/storage_redis.go @@ -33,7 +33,10 @@ type RedisStorage struct { } func NewRedisStorage(address string, db int) (*RedisStorage, error) { - ndb := godis.New("tcp:"+address, db, "") + if address != "" { + address = "tcp:" + address + } + ndb := godis.New(address, db, "") ms := &MyMarshaler{} return &RedisStorage{db: ndb, dbNb: db, ms: ms}, nil }