The Prometheus monitoring system and time series database.
Find a file
Brian Brazil 89a90fe96c
Simplify mergedPostings.Seek (#595)
The current implementation leads to very slow behaviour when there's
many lists, this no worse than n log k, where k is the number of posting
lists.

Adjust benchmark to catch this.

Remove flattening of without lists, not needed anymore.

Benchmark versus 0.4.0 (used in Prometheus 2.7):
```
benchmark                                                            old ns/op      new ns/op      delta
BenchmarkHeadPostingForMatchers/n="1"-8                              189907976      188863880      -0.55%
BenchmarkHeadPostingForMatchers/n="1",j="foo"-8                      113950106      110791414      -2.77%
BenchmarkHeadPostingForMatchers/j="foo",n="1"-8                      104965646      102388760      -2.45%
BenchmarkHeadPostingForMatchers/n="1",j!="foo"-8                     138743592      104424250      -24.74%
BenchmarkHeadPostingForMatchers/i=~".*"-8                            5279594954     5206096267     -1.39%
BenchmarkHeadPostingForMatchers/i=~".+"-8                            8004610589     6184527719     -22.74%
BenchmarkHeadPostingForMatchers/i=~""-8                              2476042646     1003920432     -59.45%
BenchmarkHeadPostingForMatchers/i!=""-8                              7178244655     6059725323     -15.58%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",j="foo"-8              199342649      166642946      -16.40%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",i!="2",j="foo"-8       215774683      167515095      -22.37%
BenchmarkHeadPostingForMatchers/n="1",i!=""-8                        2214714769     392943663      -82.26%
BenchmarkHeadPostingForMatchers/n="1",i!="",j="foo"-8                2148727410     322289262      -85.00%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",j="foo"-8              2170658009     338458171      -84.41%
BenchmarkHeadPostingForMatchers/n="1",i=~"1.+",j="foo"-8             235720135      70597905       -70.05%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!="2",j="foo"-8       2190570590     343034307      -84.34%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!~"2.*",j="foo"-8     2373784439     387297908      -83.68%

benchmark                                                            old allocs     new allocs     delta
BenchmarkHeadPostingForMatchers/n="1"-8                              33             33             +0.00%
BenchmarkHeadPostingForMatchers/n="1",j="foo"-8                      33             33             +0.00%
BenchmarkHeadPostingForMatchers/j="foo",n="1"-8                      33             33             +0.00%
BenchmarkHeadPostingForMatchers/n="1",j!="foo"-8                     41             39             -4.88%
BenchmarkHeadPostingForMatchers/i=~".*"-8                            56             56             +0.00%
BenchmarkHeadPostingForMatchers/i=~".+"-8                            251577         100115         -60.21%
BenchmarkHeadPostingForMatchers/i=~""-8                              251123         100077         -60.15%
BenchmarkHeadPostingForMatchers/i!=""-8                              251525         100112         -60.20%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",j="foo"-8              42             39             -7.14%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",i!="2",j="foo"-8       52             42             -19.23%
BenchmarkHeadPostingForMatchers/n="1",i!=""-8                        251069         100101         -60.13%
BenchmarkHeadPostingForMatchers/n="1",i!="",j="foo"-8                251473         100101         -60.19%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",j="foo"-8              250914         100102         -60.11%
BenchmarkHeadPostingForMatchers/n="1",i=~"1.+",j="foo"-8             30038          11181          -62.78%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!="2",j="foo"-8       250813         100105         -60.09%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!~"2.*",j="foo"-8     281503         111260         -60.48%

benchmark                                                            old bytes     new bytes     delta
BenchmarkHeadPostingForMatchers/n="1"-8                              10887600      10887600      +0.00%
BenchmarkHeadPostingForMatchers/n="1",j="foo"-8                      5456416       5456416       +0.00%
BenchmarkHeadPostingForMatchers/j="foo",n="1"-8                      5456416       5456416       +0.00%
BenchmarkHeadPostingForMatchers/n="1",j!="foo"-8                     5456640       5456544       -0.00%
BenchmarkHeadPostingForMatchers/i=~".*"-8                            258254504     258254472     -0.00%
BenchmarkHeadPostingForMatchers/i=~".+"-8                            520126192     281554792     -45.87%
BenchmarkHeadPostingForMatchers/i=~""-8                              263446640     24908456      -90.55%
BenchmarkHeadPostingForMatchers/i!=""-8                              520121144     281553664     -45.87%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",j="foo"-8              7062448       7062272       -0.00%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",i!="2",j="foo"-8       7063473       7062384       -0.02%
BenchmarkHeadPostingForMatchers/n="1",i!=""-8                        274325656     35793776      -86.95%
BenchmarkHeadPostingForMatchers/n="1",i!="",j="foo"-8                268926824     30362624      -88.71%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",j="foo"-8              268882992     30363000      -88.71%
BenchmarkHeadPostingForMatchers/n="1",i=~"1.+",j="foo"-8             33193401      4269304       -87.14%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!="2",j="foo"-8       268875024     30363096      -88.71%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!~"2.*",j="foo"-8     300589656     33099784      -88.99%
```

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-05-13 10:51:07 +01:00
chunkenc Add FromData function (again)! (#600) 2019-05-06 19:17:26 +05:30
chunks remove Fsync workaround for macos. (#574) 2019-04-03 11:16:54 +03:00
cmd/tsdb fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00
docs/format docs: add label offset table and postings offset table (#593) 2019-05-02 23:23:58 +03:00
encoding Fix exported function comments (#566) 2019-03-25 10:17:28 +02:00
errors Test createBlock and check all os.RemoveAll in the tests for errors. (#549) 2019-03-19 15:31:57 +02:00
fileutil remove Fsync workaround for macos. (#574) 2019-04-03 11:16:54 +03:00
goversion remove Fsync workaround for macos. (#574) 2019-04-03 11:16:54 +03:00
index Simplify mergedPostings.Seek (#595) 2019-05-13 10:51:07 +01:00
labels Correctly handle empty labels. (#594) 2019-05-07 11:00:16 +01:00
test index: simplify checksum validation 2017-11-09 15:58:36 +00:00
testdata Add repair test 2018-02-09 13:43:42 +01:00
testutil Test to corrupt segments mid-WAL, repair and check we can read the correct number of records. (#528) 2019-02-18 19:05:07 +00:00
tsdbutil Add license headers to missing files (#447) 2018-11-06 20:19:42 +02:00
wal make Close methods for the querier safe to call more than once. (#581) 2019-04-30 10:17:07 +03:00
.gitignore Add default benchmark output dir to .gitignore 2018-01-14 11:07:52 +00:00
.golangci.yml Synchronize Makefile.common from prometheus/prometheus (#591) 2019-04-25 12:29:09 +03:00
.travis.yml remove Fsync workaround for macos. (#574) 2019-04-03 11:16:54 +03:00
block.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
block_test.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
CHANGELOG.md Add FromData function (again)! (#600) 2019-05-06 19:17:26 +05:30
checkpoint.go Test createBlock and check all os.RemoveAll in the tests for errors. (#549) 2019-03-19 15:31:57 +02:00
checkpoint_test.go Test createBlock and check all os.RemoveAll in the tests for errors. (#549) 2019-03-19 15:31:57 +02:00
compact.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
compact_test.go fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00
db.go remove Fsync workaround for macos. (#574) 2019-04-03 11:16:54 +03:00
db_test.go Correctly handle empty labels. (#594) 2019-05-07 11:00:16 +01:00
go.mod fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00
go.sum Use Go modules (#454) 2018-11-28 11:39:56 +01:00
head.go Correctly handle empty labels. (#594) 2019-05-07 11:00:16 +01:00
head_bench_test.go Simplify mergedPostings.Seek (#595) 2019-05-13 10:51:07 +01:00
head_test.go fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00
LICENSE Add license file 2017-04-10 21:02:42 +02:00
MAINTAINERS.md add maintainers file (#404) 2018-10-15 14:32:00 +03:00
Makefile Update Makefile.common (#548) 2019-03-13 10:40:17 +02:00
Makefile.common makefile: update Makefile.common with newer version (#597) 2019-05-05 19:17:35 +03:00
mocks_test.go Vertical query merging and compaction (#370) 2019-02-14 14:29:41 +01:00
querier.go Simplify mergedPostings.Seek (#595) 2019-05-13 10:51:07 +01:00
querier_test.go make Close methods for the querier safe to call more than once. (#581) 2019-04-30 10:17:07 +03:00
README.md README: move the build badge to the badge list (#555) 2019-03-18 14:44:58 +02:00
record.go Merge encoding_helpers.go to tsdbutil (#526) 2019-02-22 19:11:11 +02:00
record_test.go Add test for be64() in encoding/encoding.go (#521) (#533) 2019-02-23 11:51:47 +02:00
repair.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
repair_test.go fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00
tombstones.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
tombstones_test.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
wal.go cleanup tmp files (#570) 2019-04-26 11:27:36 +03:00
wal_test.go fix some unchecked errors and remove unused vars. (#592) 2019-04-25 13:07:04 +03:00

TSDB

Build Status GoDoc Go Report Card

This repository contains the Prometheus storage layer that is used in its 2.x releases.

A writeup of its design can be found here.

Based on the Gorilla TSDB white papers.

Video: Storing 16 Bytes at Scale from PromCon 2017.

See also the format documentation.