mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-05 12:26:14 +02:00
TSDB benchmarks: Commit periodically to speed up init
When creating dummy data for benchmarks, call `Commit()` periodically to avoid growing the appender to enormous size. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
2dfb4fdafb
commit
b2fa1c9524
@ -55,6 +55,8 @@ func BenchmarkQuerier(b *testing.B) {
|
||||
addSeries(labels.FromStrings("i", strconv.Itoa(i)+postingsBenchSuffix, "n", "1_"+strconv.Itoa(n)+postingsBenchSuffix, "j", "bar"))
|
||||
addSeries(labels.FromStrings("i", strconv.Itoa(i)+postingsBenchSuffix, "n", "2_"+strconv.Itoa(n)+postingsBenchSuffix, "j", "foo"))
|
||||
}
|
||||
require.NoError(b, app.Commit())
|
||||
app = h.Appender(context.Background())
|
||||
}
|
||||
require.NoError(b, app.Commit())
|
||||
|
||||
@ -270,6 +272,10 @@ func createHeadForBenchmarkSelect(b *testing.B, numSeries int, addSeries func(ap
|
||||
app := h.Appender(context.Background())
|
||||
for i := 0; i < numSeries; i++ {
|
||||
addSeries(app, i)
|
||||
if i%1000 == 999 { // Commit every so often, so the appender doesn't get too big.
|
||||
require.NoError(b, app.Commit())
|
||||
app = h.Appender(context.Background())
|
||||
}
|
||||
}
|
||||
require.NoError(b, app.Commit())
|
||||
return h, db
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user