-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mkbench: add write-throughput benchmark data parser
To parse raw write-throughput benchmark data produced from the nightly runs, add the `write` subcommand to the `mkbench` command. Raw data is read from log files generated by the worker VMs participating in a benchmark workload run (a workload is a particular benchmark configuration, e.g. values of size 1024B). Raw data is of the form: ```console BenchmarkRawwrite/values=1024 30000 ops/sec true pass 1m0s elapsed 2413192409 bytes 4 levels BenchmarkRawwrite/values=1024 30094 ops/sec true pass 2m1s elapsed 4384425494 bytes 4 levels BenchmarkRawwrite/values=1024 30269 ops/sec true pass 3m1s elapsed 6248072011 bytes 4 levels ... ``` Data from each "raw run" for a given day is combined to produce a "run", which can then be summarized by taking the average over all raw runs for the day, similar to how the `ycsb` subcommand functions. A top-level summary file is output that contains a mapping from benchmark workload name to the daily, summarized average ops/sec sustainable throughput figure. Each daily figure reported in the top-level summary file also points to a summary file for the daily run that contains the raw data from all worker VMs running the benchmark. This allows the data visualization to present a top-level figure, but also provide a "drill-down" into the daily runs to observe how the ops/sec figure trended over the course of the benchmark.
- Loading branch information
Showing
14 changed files
with
864 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package main | ||
|
||
import "sort" | ||
|
||
const increment = 50 // ops/sec | ||
|
||
// findOptimalSplit computes and returns a value that separates the given pass | ||
// and fail measurements optimally, such that the number of mis-classified | ||
// passes (pass values that fall above the split) and fails (fail values that | ||
// fall below the split) is minimized. | ||
// | ||
// The following gives a visual representation of the problem: | ||
// | ||
// Optimal partition (=550) -----> | | ||
// Passes: o o o o o o oo | | ||
// Fails: x x |x x x x x x | ||
// |---------|---------|---------|---------|---------|----|----|---------|---------|---------|---> x | ||
// 0 100 200 300 400 500 | 600 700 800 900 | ||
// | | ||
// | ||
// The algorithm works by computing the error (i.e. mis-classifications) at | ||
// various points along the x-axis, starting from the origin and increasing by | ||
// the given increment. | ||
func findOptimalSplit(pass, fail []int) int { | ||
// Not enough data to compute a sensible score. | ||
if len(pass) == 0 || len(fail) == 0 { | ||
return -1 | ||
} | ||
|
||
// Maintain counters for the number of incorrectly classified passes and | ||
// fails. All passes are initially incorrect, as we start at 0. Conversely, | ||
// no fails are incorrectly classified, as all scores are >= 0. | ||
pCount, fCount := len(pass), 0 | ||
p, f := make([]int, len(pass)), make([]int, len(fail)) | ||
copy(p, pass) | ||
copy(f, fail) | ||
|
||
// Sort the inputs. | ||
sort.Slice(p, func(i, j int) bool { | ||
return p[i] < p[j] | ||
}) | ||
sort.Slice(f, func(i, j int) bool { | ||
return f[i] < f[j] | ||
}) | ||
|
||
// Find the global min and max. | ||
min, max := p[0], f[len(fail)-1] | ||
|
||
// Iterate over the range in increments. | ||
var result [][]int | ||
for x := min; x <= max; x = x + increment { | ||
// Reduce the count of incorrect passes as x increases (i.e. fewer pass | ||
// values are incorrect as x increases). | ||
for len(p) > 0 && p[0] <= x { | ||
pCount-- | ||
p = p[1:] | ||
} | ||
|
||
// Increase the count of incorrect fails as x increases (i.e. more fail | ||
// values are incorrect as x increases). | ||
for len(f) > 0 && f[0] < x { | ||
fCount++ | ||
f = f[1:] | ||
} | ||
|
||
// Add a (x, score) tuple to result slice. | ||
result = append(result, []int{x, pCount + fCount}) | ||
} | ||
|
||
// Sort the (x, score) result slice by score ascending. Tie-break by x | ||
// ascending. | ||
sort.Slice(result, func(i, j int) bool { | ||
if result[i][1] == result[j][1] { | ||
return result[i][0] < result[j][0] | ||
} | ||
return result[i][1] < result[j][1] | ||
}) | ||
|
||
// If there is more than one interval, split the difference between the min | ||
// and the max. | ||
splitMin, splitMax := result[0][0], result[0][0] | ||
for i := 1; i < len(result); i++ { | ||
if result[i][1] != result[0][1] { | ||
break | ||
} | ||
splitMax = result[i][0] | ||
} | ||
|
||
return (splitMin + splitMax) / 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+7.27 KB
internal/mkbench/testdata/data/20211027/pebble/write/size=1024/run_1/1.log.gz
Binary file not shown.
Binary file added
BIN
+7.33 KB
internal/mkbench/testdata/data/20211027/pebble/write/size=1024/run_1/2.log.gz
Binary file not shown.
Binary file added
BIN
+7.25 KB
internal/mkbench/testdata/data/20211028/pebble/write/size=1024/run_1/1.log.gz
Binary file not shown.
Binary file added
BIN
+7.22 KB
internal/mkbench/testdata/data/20211028/pebble/write/size=1024/run_1/2.log.gz
Binary file not shown.
Oops, something went wrong.