prometheus/storage/metric
Julius Volz 80b3d3bf34 Speed up disk flushes by removing unnecessary sort.
The first sort in groupByFingerprint already ensures that all resulting sample
lists contain only one fingerprint. We also already assume that all
samples passed into AppendSamples (and thus groupByFingerprint) are
chronologically sorted within each fingerprint.

The extra chronological sort is thus superfluous. Furthermore, this
second sort didn't only sort chronologically, but also compared all
metric fingerprints again (although we already know that we're only
sorting within samples for the same fingerprint). This caused a huge
memory and runtime overhead.

In a heavily loaded real Prometheus, this brought down disk flush times
from ~9 minutes to ~1 minute.

OLD:
BenchmarkLevelDBAppendRepeatingValues   5  331391808 ns/op  44542953 B/op   597788 allocs/op
BenchmarkLevelDBAppendsRepeatingValues  5  329893512 ns/op  46968288 B/op  3104373 allocs/op

NEW:
BenchmarkLevelDBAppendRepeatingValues   5  299298635 ns/op  43329497 B/op   567616 allocs/op
BenchmarkLevelDBAppendsRepeatingValues 20   92204601 ns/op   1779454 B/op    70975 allocs/op

Change-Id: Ie2d8db3569b0102a18010f9e106e391fda7f7883
2014-11-25 17:01:59 +01:00
..
tiered Speed up disk flushes by removing unnecessary sort. 2014-11-25 17:01:59 +01:00
interface.go Speed up disk flushes by removing unnecessary sort. 2014-11-25 17:01:59 +01:00
labelpair.go Major code cleanup in storage. 2014-02-27 15:22:37 +01:00
labelpair_test.go Weed out our homegrown test.Tester. 2014-05-21 19:27:24 +02:00
matcher.go Separate storage implementation from interfaces. 2014-04-16 13:30:19 +02:00
sample.go Separate storage implementation from interfaces. 2014-04-16 13:30:19 +02:00