Skip to content

Commit 082a873

Browse files
committed
[add] Added resultset stats to output
1 parent fb6a10e commit 082a873

File tree

2 files changed

+80
-25
lines changed

2 files changed

+80
-25
lines changed

README.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
This repo contains code to quick benchmark RedisGraph, using the official redisgraph-go client.
5+
This repo contains code to quick benchmark RedisGraph, using the official [redisgraph-go](https://github.com/RedisGraph/redisgraph-go) client.
66

77
## Installation
88

@@ -39,20 +39,30 @@ $ ./redisgraph-benchmark-go --help
3939
Max rps. If 0 no limit is applied and the DB is stressed up to maximum.
4040
```
4141

42-
## Sample output - 10M commands
42+
## Sample output - 1M commands
4343

4444
```
4545
$ redisgraph-benchmark-go -graph-key graph "CREATE (u:User)"
46+
Debug level: 0.
4647
Total clients: 50. Commands per client: 20000 Total commands: 1000000
4748
Test time Total Commands Total Errors Command Rate Client p50 with RTT(ms) Graph Internal p50 with RTT(ms)
48-
43s [100.0%] 1000000 0 [0.0%] 14810.59 2.087 0.000
49-
#################################################
50-
Total Duration 43.000 Seconds
51-
Total Errors 0
52-
Throughput summary: 23256 requests per second
49+
53s [100.0%] 1000000 0 [0.0%] 8002.89 2.097 0.000
50+
################# RUNTIME STATS #################
51+
Total Duration 53.001 Seconds
52+
Total Commands issued 1000000
53+
Total Errors 0 ( 0.000 %)
54+
Throughput summary: 18868 requests per second
5355
Overall Client Latency summary (msec):
5456
p50 p95 p99
55-
2.087 2.977 3.611
57+
2.097 5.347 9.063
58+
################## GRAPH STATS ##################
59+
Total Empty resultsets 1000000 ( 100.000 %)
60+
Total Nodes created 1000000
61+
Total Nodes deleted 0
62+
Total Labels added 0
63+
Total Properties set 0
64+
Total Relationships created 0
65+
Total Relationships deleted 0
5666
Overall RedisGraph Internal Execution time Latency summary (msec):
5767
p50 p95 p99
5868
0.000 0.000 0.000
@@ -62,20 +72,30 @@ $ redisgraph-benchmark-go -graph-key graph "CREATE (u:User)"
6272
## Sample output - running in loop mode ( Ctrl+c to stop )
6373

6474
```
65-
$ redisgraph-benchmark-go -l -graph-key graph "CREATE (u:User)"
75+
$ redisgraph-benchmark-go -l -graph-key graph "CREATE (:Rider {name:'A'})-[:rides]->(:Team {name:'Z'})"
76+
Debug level: 0.
6677
Running in loop until you hit Ctrl+C
6778
Test time Total Commands Total Errors Command Rate Client p50 with RTT(ms) Graph Internal p50 with RTT(ms)
68-
^C 9s [----%] 263185 0 [0.0%] 24167.81 1.846 0.000
79+
^C 11s [----%] 136649 0 [0.0%] 7854.48 3.667 0.000
6980
received Ctrl-c - shutting down
7081
71-
#################################################
72-
Total Duration 9.000 Seconds
73-
Total Errors 0
74-
Throughput summary: 29243 requests per second
82+
################# RUNTIME STATS #################
83+
Total Duration 11.516 Seconds
84+
Total Commands issued 140704
85+
Total Errors 0 ( 0.000 %)
86+
Throughput summary: 12217 requests per second
7587
Overall Client Latency summary (msec):
7688
p50 p95 p99
77-
1.846 2.383 3.117
89+
3.751 6.887 8.623
90+
################## GRAPH STATS ##################
91+
Total Empty resultsets 140705 ( 100.000 %)
92+
Total Nodes created 281410
93+
Total Nodes deleted 0
94+
Total Labels added 0
95+
Total Properties set 281410
96+
Total Relationships created 140705
97+
Total Relationships deleted 0
7898
Overall RedisGraph Internal Execution time Latency summary (msec):
7999
p50 p95 p99
80100
0.000 0.000 0.000
81-
```
101+
```

redisgraph-bechmark-go.go

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ import (
1818
)
1919

2020
var totalCommands uint64
21+
var totalEmptyResultsets uint64
2122
var totalErrors uint64
23+
24+
var totalNodesCreated uint64
25+
var totalNodesDeleted uint64
26+
var totalLabelsAdded uint64
27+
var totalPropertiesSet uint64
28+
var totalRelationshipsCreated uint64
29+
var totalRelationshipsDeleted uint64
30+
2231
var latencies *hdrhistogram.Histogram
2332
var graphRunTimeLatencies *hdrhistogram.Histogram
2433

@@ -41,6 +50,8 @@ func sendCmdLogic(rg redisgraph.Graph, query string, continueOnError bool, debug
4150
startT := time.Now()
4251
queryResult, err = rg.Query(query)
4352
endT := time.Now()
53+
atomic.AddUint64(&totalCommands, uint64(1))
54+
duration := endT.Sub(startT)
4455
if err != nil {
4556
if continueOnError {
4657
atomic.AddUint64(&totalErrors, uint64(1))
@@ -50,17 +61,31 @@ func sendCmdLogic(rg redisgraph.Graph, query string, continueOnError bool, debug
5061
} else {
5162
log.Fatalf("Received an error with the following query(s): %v, error: %v", query, err)
5263
}
64+
} else {
65+
err = graphRunTimeLatencies.RecordValue(int64(queryResult.RunTime() * 1000))
66+
if err != nil {
67+
log.Fatalf("Received an error while recording RedisGraph RunTime latencies: %v", err)
68+
}
69+
if debug_level > 1 {
70+
fmt.Printf("Issued query: %s\n", query)
71+
fmt.Printf("Pretty printing result:\n")
72+
queryResult.PrettyPrint()
73+
fmt.Printf("\n")
74+
}
75+
if queryResult.Empty() {
76+
atomic.AddUint64(&totalEmptyResultsets, uint64(1))
77+
}
78+
atomic.AddUint64(&totalNodesCreated, uint64(queryResult.NodesCreated()))
79+
atomic.AddUint64(&totalNodesDeleted, uint64(queryResult.NodesDeleted()))
80+
atomic.AddUint64(&totalLabelsAdded, uint64(queryResult.LabelsAdded()))
81+
atomic.AddUint64(&totalPropertiesSet, uint64(queryResult.PropertiesSet()))
82+
atomic.AddUint64(&totalRelationshipsCreated, uint64(queryResult.RelationshipsCreated()))
83+
atomic.AddUint64(&totalRelationshipsDeleted, uint64(queryResult.RelationshipsDeleted()))
5384
}
54-
duration := endT.Sub(startT)
5585
err = latencies.RecordValue(duration.Microseconds())
5686
if err != nil {
5787
log.Fatalf("Received an error while recording latencies: %v", err)
5888
}
59-
err = graphRunTimeLatencies.RecordValue(int64(queryResult.RunTime() * 1000))
60-
if err != nil {
61-
log.Fatalf("Received an error while recording RedisGraph RunTime latencies: %v", err)
62-
}
63-
atomic.AddUint64(&totalCommands, uint64(1))
6489
}
6590

6691
func main() {
@@ -78,6 +103,7 @@ func main() {
78103
if len(args) < 1 {
79104
log.Fatalf("You need to specify a query after the flag command arguments.")
80105
}
106+
fmt.Printf("Debug level: %d.\n", *debug)
81107

82108
var requestRate = Inf
83109
var requestBurst = 1
@@ -112,7 +138,7 @@ func main() {
112138
wg.Add(1)
113139
cmd := make([]string, len(args))
114140
copy(cmd, args)
115-
go ingestionRoutine(getStandaloneConn(*graphKey, "tcp", connectionStr), true, query, samplesPerClient, *loop, int(*debug), &wg, useRateLimiter, rateLimiter)
141+
go ingestionRoutine(getStandaloneConn(*graphKey, "tcp", connectionStr), true, query, samplesPerClient, *loop, *debug, &wg, useRateLimiter, rateLimiter)
116142
}
117143

118144
// listen for C-c
@@ -131,13 +157,22 @@ func main() {
131157
graph_p99IngestionMs := float64(graphRunTimeLatencies.ValueAtQuantile(99.0)) / 1000.0
132158

133159
fmt.Printf("\n")
134-
fmt.Printf("#################################################\n")
160+
fmt.Printf("################# RUNTIME STATS #################\n")
135161
fmt.Printf("Total Duration %.3f Seconds\n", duration.Seconds())
136-
fmt.Printf("Total Errors %d\n", totalErrors)
162+
fmt.Printf("Total Commands issued %d\n", totalCommands)
163+
fmt.Printf("Total Errors %d ( %3.3f %%)\n", totalErrors, float64(totalErrors/totalCommands*100.0))
137164
fmt.Printf("Throughput summary: %.0f requests per second\n", messageRate)
138165
fmt.Printf("Overall Client Latency summary (msec):\n")
139166
fmt.Printf(" %9s %9s %9s\n", "p50", "p95", "p99")
140167
fmt.Printf(" %9.3f %9.3f %9.3f\n", p50IngestionMs, p95IngestionMs, p99IngestionMs)
168+
fmt.Printf("################## GRAPH STATS ##################\n")
169+
fmt.Printf("Total Empty resultsets %d ( %3.3f %%)\n", totalEmptyResultsets, float64(totalEmptyResultsets/totalCommands*100.0))
170+
fmt.Printf("Total Nodes created %d\n", totalNodesCreated)
171+
fmt.Printf("Total Nodes deleted %d\n", totalNodesDeleted)
172+
fmt.Printf("Total Labels added %d\n", totalLabelsAdded)
173+
fmt.Printf("Total Properties set %d\n", totalPropertiesSet)
174+
fmt.Printf("Total Relationships created %d\n", totalRelationshipsCreated)
175+
fmt.Printf("Total Relationships deleted %d\n", totalRelationshipsDeleted)
141176
fmt.Printf("Overall RedisGraph Internal Execution time Latency summary (msec):\n")
142177
fmt.Printf(" %9s %9s %9s\n", "p50", "p95", "p99")
143178
fmt.Printf(" %9.3f %9.3f %9.3f\n", graph_p50IngestionMs, graph_p95IngestionMs, graph_p99IngestionMs)

0 commit comments

Comments
 (0)