prometheus/tsdb
Cyril Tovena 92736182ce
Adding benchmark.
```
benchstat before.txt after.txt
name                                                      old time/op    new time/op    delta
PostingsForMatchers/Head/n="1"-16                            480ns ± 4%     469ns ± 4%      ~     (p=0.095 n=5+5)
PostingsForMatchers/Head/n="1",j="foo"-16                    720ns ± 1%     705ns ± 2%      ~     (p=0.056 n=5+5)
PostingsForMatchers/Head/j="foo",n="1"-16                    712ns ± 3%     726ns ± 7%      ~     (p=0.841 n=5+5)
PostingsForMatchers/Head/n="1",j!="foo"-16                   833ns ± 3%     827ns ± 1%      ~     (p=0.548 n=5+5)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16        6.66ms ± 4%    0.00ms ± 1%   -99.97%  (p=0.008 n=5+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                     897ns ± 2%     675ns ± 2%   -24.80%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16        20.1ms ± 2%     0.0ms ± 2%   -99.99%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                         74.4ms ± 3%    81.3ms ± 3%    +9.29%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"1.*"-16                        20.3ms ±27%    17.2ms ± 2%   -15.15%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                        6.22ms ±10%    5.60ms ± 1%    -9.95%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                          146ms ± 4%     126ms ± 1%   -13.63%  (p=0.016 n=4+5)
PostingsForMatchers/Head/i=~""-16                           77.0ms ±23%    68.2ms ± 5%   -11.47%  (p=0.032 n=5+5)
PostingsForMatchers/Head/i!=""-16                           57.0ms ± 4%    56.9ms ± 6%      ~     (p=1.000 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16           77.1ms ± 2%    79.2ms ± 4%      ~     (p=0.095 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16    77.2ms ± 3%    81.2ms ± 3%    +5.17%  (p=0.016 n=5+5)
PostingsForMatchers/Head/n="1",i!=""-16                     64.7ms ±34%    58.4ms ± 7%      ~     (p=0.421 n=5+5)

name                                                      old alloc/op   new alloc/op   delta
PostingsForMatchers/Head/n="1"-16                            80.0B ± 0%     80.0B ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j="foo"-16                     208B ± 0%      208B ± 0%      ~     (all equal)
PostingsForMatchers/Head/j="foo",n="1"-16                     208B ± 0%      208B ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j!="foo"-16                    240B ± 0%      240B ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16        1.61MB ± 0%    0.00MB ± 0%      ~     (p=0.079 n=4+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                      360B ± 0%      232B ± 0%   -35.56%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16        1.61MB ± 0%    0.00MB ± 0%   -99.97%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                         1.61MB ± 0%    1.61MB ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1.*"-16                        3.15MB ± 0%    3.15MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                        1.61MB ± 0%    1.61MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                         17.3MB ± 0%    17.3MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~""-16                           17.3MB ± 0%    17.3MB ± 0%      ~     (p=0.238 n=5+5)
PostingsForMatchers/Head/i!=""-16                           17.3MB ± 0%    17.3MB ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16           1.61MB ± 0%    1.61MB ± 0%    -0.00%  (p=0.032 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16    1.61MB ± 0%    1.61MB ± 0%      ~     (p=0.651 n=5+4)
PostingsForMatchers/Head/n="1",i!=""-16                     17.3MB ± 0%    17.3MB ± 0%      ~     (all equal)

name                                                      old allocs/op  new allocs/op  delta
PostingsForMatchers/Head/n="1"-16                             4.00 ± 0%      4.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j="foo"-16                     9.00 ± 0%      9.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/j="foo",n="1"-16                     9.00 ± 0%      9.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j!="foo"-16                    10.0 ± 0%      10.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16          19.0 ± 0%      23.0 ± 0%   +21.05%  (p=0.008 n=5+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                      13.0 ± 0%       7.0 ± 0%   -46.15%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16          4.00 ± 0%     13.00 ± 0%  +225.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                           7.00 ± 0%      7.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1.*"-16                         11.1k ± 0%     11.1k ± 0%    -0.01%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                          4.00 ± 0%      3.00 ± 0%   -25.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                           100k ± 0%      100k ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~""-16                             100k ± 0%      100k ± 0%      ~     (all equal)
PostingsForMatchers/Head/i!=""-16                             100k ± 0%      100k ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16             12.0 ± 0%      12.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16      18.0 ± 0%      18.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i!=""-16                       100k ± 0%      100k ± 0%      ~     (all equal)
```

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 14:16:14 +02:00
..
chunkenc remove redundant parentheses (#9134) 2021-07-29 18:26:57 +05:30
chunks Add new Go build tags. 2021-08-27 10:24:14 +02:00
docs/format Exemplars in snapshot (#9255) 2021-08-30 19:34:38 +05:30
encoding Snapshot in-memory chunks on shutdown for faster restarts (#7229) 2021-08-06 17:51:01 +01:00
errors MultiError: Refactored MultiError for more concise and safe usage. (#8066) 2020-10-28 15:24:58 +00:00
fileutil Add new Go build tags. 2021-08-27 10:24:14 +02:00
goversion Add new Go build tags. 2021-08-27 10:24:14 +02:00
hashcache Added series hash cache support to TSDB (#5) 2021-08-17 13:31:08 +00:00
index Update upstream Prometheus 2021-09-14 10:28:19 +02:00
record Exemplars in snapshot (#9255) 2021-08-30 19:34:38 +05:30
test labels: Reduce allocated memory and latency of Hash method; Added tests. (#8025) 2020-10-15 11:31:28 +01:00
testdata tsdb: Delete blocks atomically; Remove tmp blocks on start; Added test. (#7772) 2020-08-11 06:56:08 +01:00
tombstones Call delete on head if interval overlaps (#9151) 2021-09-16 12:20:03 +05:30
tsdbutil storage: Split chunks if more than 120 samples (#8582) 2021-05-18 18:37:16 +02:00
wal Snapshot in-memory chunks on shutdown for faster restarts (#7229) 2021-08-06 17:51:01 +01:00
.gitignore Moving tsdb into its own subdirectory 2019-08-13 13:58:49 +05:30
block.go Do not break exported functions signatures (#6) 2021-08-20 18:37:47 +02:00
block_test.go Do not break exported functions signatures (#6) 2021-08-20 18:37:47 +02:00
blockwriter.go Switched to go-kit/log 2021-06-11 12:28:36 -04:00
blockwriter_test.go Do not break exported functions signatures (#6) 2021-08-20 18:37:47 +02:00
CHANGELOG.md Rename default branch to main 2021-02-22 20:28:02 +01:00
compact.go More review feedback. 2021-09-28 10:29:54 +02:00
compact_test.go Fix directory cleanup in case of compaction failure. 2021-09-27 17:05:14 +02:00
db.go Merge remote-tracking branch 'upstream/main' into codesome/syncprom 2021-09-17 15:58:45 +05:30
db_test.go Also ignore func1 2021-08-28 22:42:22 -04:00
exemplar.go Fix div by 0 panic is resize function. (#9286) 2021-09-02 11:08:05 -07:00
exemplar_test.go Fix div by 0 panic is resize function. (#9286) 2021-09-02 11:08:05 -07:00
head.go Merge remote-tracking branch 'upstream/main' into codesome/syncprom 2021-09-17 15:58:45 +05:30
head_append.go Decrement active_appenders metric when no samples added (#9230) 2021-09-08 14:49:58 +05:30
head_bench_test.go React UI: Add Starting Screen (#8662) 2021-06-05 15:29:32 +01:00
head_read.go Update upstream Prometheus 2021-09-14 10:28:19 +02:00
head_test.go Merge remote-tracking branch 'upstream/main' into codesome/syncprom 2021-09-17 15:58:45 +05:30
head_wal.go Update upstream Prometheus 2021-09-14 10:28:19 +02:00
isolation.go Add present_over_time (#9097) 2021-07-29 12:38:11 +02:00
isolation_test.go tsdb: Block Head GC till pending readers are done reading (#9081) 2021-07-20 14:17:20 +05:30
mocks_test.go Move away from testutil, refactor imports (#8087) 2020-10-22 11:00:08 +02:00
querier.go lint 2021-10-05 14:00:18 +02:00
querier_bench_test.go Adding benchmark. 2021-10-06 14:16:14 +02:00
querier_test.go Improve findSetMatches to support concatenation. 2021-10-05 13:43:41 +02:00
README.md Replace godoc.org links 2021-06-17 07:18:51 -04:00
repair.go Switched to go-kit/log 2021-06-11 12:28:36 -04:00
repair_test.go Do not break exported functions signatures (#6) 2021-08-20 18:37:47 +02:00
tsdbblockutil.go Switched to go-kit/log 2021-06-11 12:28:36 -04:00
wal.go Switched to go-kit/log 2021-06-11 12:28:36 -04:00
wal_test.go Add new Go build tags. 2021-08-27 10:24:14 +02:00

TSDB

GoPkg

This directory 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.

A series of blog posts explaining different components of TSDB: