mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Add benchmark for loading chunks and chunk descs.
This commit is contained in:
parent
942686427d
commit
fbc44d8f95
BIN
storage/local/fixtures/b0/04b821ca50ba26.db
Normal file
BIN
storage/local/fixtures/b0/04b821ca50ba26.db
Normal file
Binary file not shown.
BIN
storage/local/fixtures/b0/37c21e884e4fc5.db
Normal file
BIN
storage/local/fixtures/b0/37c21e884e4fc5.db
Normal file
Binary file not shown.
BIN
storage/local/fixtures/b0/37de1e884e5469.db
Normal file
BIN
storage/local/fixtures/b0/37de1e884e5469.db
Normal file
Binary file not shown.
|
@ -884,3 +884,74 @@ func verifyIndexedState(i int, t *testing.T, b incrementalBatch, indexedFpsToMet
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var fpStrings = []string{
|
||||
"b004b821ca50ba26",
|
||||
"b037c21e884e4fc5",
|
||||
"b037de1e884e5469",
|
||||
}
|
||||
|
||||
func BenchmarkLoadChunksSequentially(b *testing.B) {
|
||||
p := persistence{
|
||||
basePath: "fixtures",
|
||||
}
|
||||
sequentialIndexes := make([]int, 47)
|
||||
for i := range sequentialIndexes {
|
||||
sequentialIndexes[i] = i
|
||||
}
|
||||
|
||||
var fp clientmodel.Fingerprint
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, s := range fpStrings {
|
||||
fp.LoadFromString(s)
|
||||
cds, err := p.loadChunks(fp, sequentialIndexes, 0)
|
||||
if err != nil {
|
||||
b.Error(err)
|
||||
}
|
||||
if len(cds) == 0 {
|
||||
b.Error("could not read any chunks")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLoadChunksRandomly(b *testing.B) {
|
||||
p := persistence{
|
||||
basePath: "fixtures",
|
||||
}
|
||||
randomIndexes := []int{1, 5, 6, 8, 11, 14, 18, 23, 29, 33, 42, 46}
|
||||
|
||||
var fp clientmodel.Fingerprint
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, s := range fpStrings {
|
||||
fp.LoadFromString(s)
|
||||
cds, err := p.loadChunks(fp, randomIndexes, 0)
|
||||
if err != nil {
|
||||
b.Error(err)
|
||||
}
|
||||
if len(cds) == 0 {
|
||||
b.Error("could not read any chunks")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLoadChunkDescs(b *testing.B) {
|
||||
p := persistence{
|
||||
basePath: "fixtures",
|
||||
}
|
||||
|
||||
var fp clientmodel.Fingerprint
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, s := range fpStrings {
|
||||
fp.LoadFromString(s)
|
||||
cds, err := p.loadChunkDescs(fp, clientmodel.Latest)
|
||||
if err != nil {
|
||||
b.Error(err)
|
||||
}
|
||||
if len(cds) == 0 {
|
||||
b.Error("could not read any chunk descs")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue