Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ coverage: get test
$(GOTEST) -race -coverprofile=coverage.txt -covermode=atomic .

flow-test: build-race
./$(BIN_NAME) -n 100000 -query "CREATE(n)" -query-ratio 1 -query "MATCH (n) RETURN n LIMIT 1" -query-ratio 2
./$(BIN_NAME) -n 100000 -query "CREATE(n)" -query-ratio 0.33 -query "MATCH (n) RETURN n LIMIT 1" -query-ratio 0.67

release:
$(GOGET) github.com/mitchellh/gox
Expand Down
2 changes: 1 addition & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (i *arrayStringParameters) Set(value string) error {
return nil
}

func printFinalSummary(queries []string, queryRates []int, totalMessages uint64, duration time.Duration) {
func printFinalSummary(queries []string, queryRates []float64, totalMessages uint64, duration time.Duration) {
writer := os.Stdout
messageRate := float64(totalMessages) / float64(duration.Seconds())

Expand Down
14 changes: 9 additions & 5 deletions multi-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ func sample(cdf []float32) int {
return bucket
}

func prepareCommandsDistribution(cmds []string, cmdRates []int) (int, []float32) {
var totalRates int = 0
func prepareCommandsDistribution(cmds []string, cmdRates []float64) (int, []float32) {
var totalDifferentCommands = len(cmds)
var totalRateSum = 0.0
var err error
for i, rawCmdString := range benchmarkQueries {
cmds[i] = rawCmdString
if i >= len(benchmarkQueryRates) {
cmdRates[i] = 1

} else {
cmdRates[i], err = strconv.Atoi(benchmarkQueryRates[i])
cmdRates[i], err = strconv.ParseFloat(benchmarkQueryRates[i], 64)
if err != nil {
log.Fatalf("Error while converting query-rate param %s: %v", benchmarkQueryRates[i], err)
}
}
totalRates += cmdRates[i]
totalRateSum += cmdRates[i]
}
// probability density function
if totalRateSum != 1.0 {
log.Fatalf("Total ratio should be 1.0 ( currently is %f )", totalRateSum)
}
// probability density function
if len(benchmarkQueryRates) > 0 && (len(benchmarkQueryRates) != len(benchmarkQueries)) {
Expand All @@ -39,7 +43,7 @@ func prepareCommandsDistribution(cmds []string, cmdRates []int) (int, []float32)
pdf := make([]float32, len(benchmarkQueries))
cdf := make([]float32, len(benchmarkQueries))
for i := 0; i < len(cmdRates); i++ {
pdf[i] = float32(cmdRates[i]) / float32(totalRates)
pdf[i] = float32(cmdRates[i])
cdf[i] = 0
}
// get cdf
Expand Down
6 changes: 3 additions & 3 deletions redisgraph-bechmark-go.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
fmt.Printf("Running in loop until you hit Ctrl+C\n")
}
queries := make([]string, len(benchmarkQueries))
cmdRates := make([]int, len(benchmarkQueries))
cmdRates := make([]float64, len(benchmarkQueries))
totalDifferentCommands, cdf := prepareCommandsDistribution(queries, cmdRates)

createRequiredGlobalStructs(totalDifferentCommands)
Expand Down Expand Up @@ -113,8 +113,8 @@ func main() {
testResult.FillDurationInfo(startTime, endTime, duration)
testResult.BenchmarkFullyRun = totalCommands == *numberRequests
testResult.IssuedCommands = totalCommands
testResult.OverallGraphInternalQuantiles = GetOverallQuantiles(queries, serverSide_PerQuery_GraphInternalTime_OverallLatencies, serverSide_AllQueries_GraphInternalTime_OverallLatencies)
testResult.OverallClientQuantiles = GetOverallQuantiles(queries, clientSide_PerQuery_OverallLatencies, clientSide_AllQueries_OverallLatencies)
testResult.OverallGraphInternalLatencies = GetOverallLatencies(queries, serverSide_PerQuery_GraphInternalTime_OverallLatencies, serverSide_AllQueries_GraphInternalTime_OverallLatencies)
testResult.OverallClientLatencies = GetOverallLatencies(queries, clientSide_PerQuery_OverallLatencies, clientSide_AllQueries_OverallLatencies)
testResult.OverallQueryRates = GetOverallRatesMap(duration, queries, clientSide_PerQuery_OverallLatencies, clientSide_AllQueries_OverallLatencies)
testResult.Totals = GetTotalsMap(queries, clientSide_PerQuery_OverallLatencies, clientSide_AllQueries_OverallLatencies, errorsPerQuery, totalNodesCreatedPerQuery, totalNodesDeletedPerQuery, totalLabelsAddedPerQuery, totalPropertiesSetPerQuery, totalRelationshipsCreatedPerQuery, totalRelationshipsDeletedPerQuery)

Expand Down
16 changes: 9 additions & 7 deletions test_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ type TestResult struct {
OverallQueryRates map[string]interface{} `json:"OverallQueryRates"`

// Overall Client Quantiles
OverallClientQuantiles map[string]interface{} `json:"OverallClientQuantiles"`
OverallClientLatencies map[string]interface{} `json:"OverallClientLatencies"`

// Overall Graph Internal Quantiles
OverallGraphInternalQuantiles map[string]interface{} `json:"OverallGraphInternalQuantiles"`
OverallGraphInternalLatencies map[string]interface{} `json:"OverallGraphInternalLatencies"`

// Per second ( tick ) client stats
ClientRunTimeStats map[int64]interface{} `json:"ClientRunTimeStats"`
Expand Down Expand Up @@ -165,34 +165,36 @@ func calculateRateMetrics(current, prev int64, took time.Duration) (rate float64
return
}

func generateQuantileMap(hist *hdrhistogram.Histogram) (int64, map[string]float64) {
func generateLatenciesMap(hist *hdrhistogram.Histogram) (int64, map[string]float64) {
ops := hist.TotalCount()
q0 := 0.0
q50 := 0.0
q95 := 0.0
q99 := 0.0
q999 := 0.0
q100 := 0.0
average := 0.0
if ops > 0 {
q0 = float64(hist.ValueAtQuantile(0.0)) / 10e2
q50 = float64(hist.ValueAtQuantile(50.0)) / 10e2
q95 = float64(hist.ValueAtQuantile(95.0)) / 10e2
q99 = float64(hist.ValueAtQuantile(99.0)) / 10e2
q999 = float64(hist.ValueAtQuantile(99.90)) / 10e2
q100 = float64(hist.ValueAtQuantile(100.0)) / 10e2
average = (hist.Mean() / float64(1000.0))
}

mp := map[string]float64{"q0": q0, "q50": q50, "q95": q95, "q99": q99, "q999": q999, "q100": q100}
mp := map[string]float64{"q0": q0, "q50": q50, "q95": q95, "q99": q99, "q999": q999, "q100": q100, "avg": average}
return ops, mp
}

func GetOverallQuantiles(cmds []string, perQueryHistograms []*hdrhistogram.Histogram, totalsHistogram *hdrhistogram.Histogram) map[string]interface{} {
func GetOverallLatencies(cmds []string, perQueryHistograms []*hdrhistogram.Histogram, totalsHistogram *hdrhistogram.Histogram) map[string]interface{} {
perQueryQuantileMap := map[string]interface{}{}
for i, query := range cmds {
_, quantileMap := generateQuantileMap(perQueryHistograms[i])
_, quantileMap := generateLatenciesMap(perQueryHistograms[i])
perQueryQuantileMap[query] = quantileMap
}
_, totalMap := generateQuantileMap(totalsHistogram)
_, totalMap := generateLatenciesMap(totalsHistogram)
perQueryQuantileMap["Total"] = totalMap
return perQueryQuantileMap
}
Expand Down