mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Merge pull request #12755 from bboreham/rangequery-benchmark-mmap
promql: force mmap of head chunks in BenchmarkRangeQuery
This commit is contained in:
commit
c5671c6d97
|
@ -66,6 +66,8 @@ func setupRangeQueryTestData(stor *teststorage.TestStorage, _ *Engine, interval,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stor.DB.ForceHeadMMap() // Ensure we have at most one head chunk for every series.
|
||||||
|
stor.DB.Compact()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,6 +224,7 @@ func rangeQueryCases() []benchCase {
|
||||||
|
|
||||||
func BenchmarkRangeQuery(b *testing.B) {
|
func BenchmarkRangeQuery(b *testing.B) {
|
||||||
stor := teststorage.New(b)
|
stor := teststorage.New(b)
|
||||||
|
stor.DB.DisableCompactions() // Don't want auto-compaction disrupting timings.
|
||||||
defer stor.Close()
|
defer stor.Close()
|
||||||
opts := EngineOpts{
|
opts := EngineOpts{
|
||||||
Logger: nil,
|
Logger: nil,
|
||||||
|
|
|
@ -1797,6 +1797,11 @@ func (db *DB) EnableCompactions() {
|
||||||
level.Info(db.logger).Log("msg", "Compactions enabled")
|
level.Info(db.logger).Log("msg", "Compactions enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForceHeadMMap is intended for use only in tests and benchmarks.
|
||||||
|
func (db *DB) ForceHeadMMap() {
|
||||||
|
db.head.mmapHeadChunks()
|
||||||
|
}
|
||||||
|
|
||||||
// Snapshot writes the current data to the directory. If withHead is set to true it
|
// Snapshot writes the current data to the directory. If withHead is set to true it
|
||||||
// will create a new block containing all data that's currently in the memory buffer/WAL.
|
// will create a new block containing all data that's currently in the memory buffer/WAL.
|
||||||
func (db *DB) Snapshot(dir string, withHead bool) error {
|
func (db *DB) Snapshot(dir string, withHead bool) error {
|
||||||
|
|
Loading…
Reference in a new issue