prometheus/storage/local
beorn7 d284ffab03 storage: Replace fpIter by sortedFPs
The fpIter was kind of cumbersome to use and required a lock for each
iteration (which wasn't even needed for the iteration at startup after
loading the checkpoint).

The new implementation here has an obvious penalty in memory, but it's
only 8 byte per series, so 80MiB for a beefy server with 10M memory
time series (which would probably need ~100GiB RAM, so the memory
penalty is only 0.1% of the total memory need).

The big advantage is that now series maintenance happens in order,
which leads to the time between two maintenances of the same series
being less random. Ideally, after each maintenance, the next
maintenance would tackle the series with the largest number of
non-persisted chunks. That would be quite an effort to find out or
track, but with the approach here, the next maintenance will tackle
the series whose previous maintenance is longest ago, which is a good
approximation.

While this commit won't change the _average_ number of chunks
persisted per maintenance, it will reduce the mean time a given chunk
has to wait for its persistence and thus reduce the steady-state
number of chunks waiting for persistence.

Also, the map iteration in Go is non-deterministic but not truly
random. In practice, the iteration appears to be somewhat "bucketed".
You can often observe a bunch of series with similar duration since
their last maintenance, i.e. you see batches of series with similar
number of chunks persisted per maintenance. If that batch is
relatively young, a whole lot of series are maintained with very few
chunks to persist. (See screenshot in PR for a better explanation.)
2017-04-03 15:34:46 +02:00
..
chunk storage: Evict chunks and calculate persistence pressure based on target heap size 2017-03-27 14:33:50 +02:00
codable Replace metric.LabelPair with model.LabelPair 2015-08-22 13:32:13 +02:00
fixtures/b0 Add benchmark for loading chunks and chunk descs. 2015-03-19 19:28:21 +01:00
index Handle errors caused by data corruption more gracefully 2016-03-02 23:02:34 +01:00
storagetool Make version informations consistent between prometheus components 2016-05-05 22:33:18 +02:00
crashrecovery.go Fix possible memory leak by defer inside loop 2016-11-14 14:08:08 +09:00
heads.go storage: Test for errors returned by MaybePopulateLastTime 2017-02-01 23:43:58 +01:00
instrumentation.go storage: separate chunk package, publish more names 2016-09-26 13:25:11 +02:00
interface.go storage: enhance Querier interface usage 2016-10-16 10:39:29 +02:00
locker.go Avoid having contended mutexes on same cacheline 2016-09-18 23:32:55 +01:00
locker_test.go Add missing license headers 2016-04-13 16:08:22 +02:00
mapper.go Checkpoint fingerprint mappings only upon shutdown 2016-04-15 01:03:28 +02:00
mapper_test.go Checkpoint fingerprint mappings only upon shutdown 2016-04-15 01:03:28 +02:00
noop_storage.go storage: Make tests go-vet and golint clean 2016-12-13 17:07:27 +01:00
persistence.go storage: Fix chunkIndexToStartSeek calculation 2017-02-10 11:42:59 +01:00
persistence_test.go storage: Evict chunks and calculate persistence pressure based on target heap size 2017-03-27 14:33:50 +02:00
series.go storage: Replace fpIter by sortedFPs 2017-04-03 15:34:46 +02:00
series_test.go Unpublish accidentally published series methods 2016-10-03 00:04:56 +02:00
storage.go storage: Replace fpIter by sortedFPs 2017-04-03 15:34:46 +02:00
storage_test.go storage: Evict chunks and calculate persistence pressure based on target heap size 2017-03-27 14:33:50 +02:00
test_helpers.go storage: Evict chunks and calculate persistence pressure based on target heap size 2017-03-27 14:33:50 +02:00