Commit Graph

124 Commits (b2bc1cd315a213a0822dc63643a57b1c5b263743)

Author SHA1 Message Date
Stuart Carnie a4305ddb17 fix(simple8b): Fix incorrect encoding for a run of 119 or 239 1s
If 120th or 240th value is not a 1, k still passes the check in the
switch, causing the last value to be lost. If this value occurs at
the boundary of a block, the max time will be incorrect, resulting in
compaction failing to make forward progress.
2018-11-14 09:13:13 -07:00
Stuart Carnie e9531b7830 feat(encoding): Improve integer and simple8b encoding performance
simple8b EncodeAll improvements should

```
name                     old time/op  new time/op  delta
EncodeAll/1_bit-8        28.5µs ± 1%  28.6µs ± 1%     ~     (p=0.133 n=9+10)
EncodeAll/2_bits-8       28.9µs ± 2%  28.7µs ± 0%     ~     (p=0.068 n=10+8)
EncodeAll/3_bits-8       29.3µs ± 1%  28.8µs ± 0%   -1.70%  (p=0.000 n=10+10)
EncodeAll/4_bits-8       29.6µs ± 1%  29.1µs ± 1%   -1.85%  (p=0.000 n=10+10)
EncodeAll/5_bits-8       30.6µs ± 1%  29.8µs ± 2%   -2.70%  (p=0.000 n=10+10)
EncodeAll/6_bits-8       31.3µs ± 1%  30.0µs ± 1%   -4.08%  (p=0.000 n=9+9)
EncodeAll/7_bits-8       32.6µs ± 1%  30.8µs ± 0%   -5.49%  (p=0.000 n=9+9)
EncodeAll/8_bits-8       33.6µs ± 2%  31.0µs ± 1%   -7.77%  (p=0.000 n=10+9)
EncodeAll/10_bits-8      34.9µs ± 0%  31.9µs ± 2%   -8.55%  (p=0.000 n=9+10)
EncodeAll/12_bits-8      36.8µs ± 1%  32.6µs ± 1%  -11.35%  (p=0.000 n=9+10)
EncodeAll/15_bits-8      39.8µs ± 1%  34.1µs ± 2%  -14.40%  (p=0.000 n=10+10)
EncodeAll/20_bits-8      45.2µs ± 3%  36.2µs ± 1%  -19.97%  (p=0.000 n=10+9)
EncodeAll/30_bits-8      55.0µs ± 0%  40.9µs ± 1%  -25.62%  (p=0.000 n=9+9)
EncodeAll/60_bits-8      86.2µs ± 1%  55.2µs ± 1%  -35.92%  (p=0.000 n=10+10)
EncodeAll/combination-8   582µs ± 2%   502µs ± 1%  -13.80%  (p=0.000 n=9+9)
```

EncodeIntegers:

```
name                             old time/op    new time/op    delta
EncodeIntegers/1000_seq/batch-8    2.04µs ± 0%    1.50µs ± 1%  -26.22%  (p=0.008 n=5+5)
EncodeIntegers/1000_ran/batch-8    8.80µs ± 2%    6.10µs ± 0%  -30.73%  (p=0.008 n=5+5)
EncodeIntegers/1000_dup/batch-8    2.03µs ± 1%    1.50µs ± 1%  -26.04%  (p=0.008 n=5+5)
```

EncodeTimestamps (ran is improved due to simple8b improvements)

```
name                               old time/op    new time/op    delta
EncodeTimestamps/1000_seq/batch-8    2.64µs ± 1%    2.65µs ± 2%     ~     (p=0.310 n=5+5)
EncodeTimestamps/1000_ran/batch-8    64.0µs ± 1%    33.8µs ± 1%  -47.23%  (p=0.008 n=5+5)
EncodeTimestamps/1000_dup/batch-8    9.32µs ± 0%    9.28µs ± 1%     ~     (p=0.087 n=5+5)
```
2018-10-16 12:08:12 +01:00
Stuart Carnie 8008d394d4 chore(simple8b): Add more unit tests and benchmarks 2018-10-16 12:08:12 +01:00
liukun ee9892dea5 fix the comments error 2018-08-20 17:19:35 +08:00
Jeff Wendling 35645a67f5 pkg/snowflake: be more robust against sequence rollover
it's slightly slower, but the safety is worth it i think.

```
name            old time/op  new time/op  delta
Next-8          30.0ns ± 2%  31.0ns ± 3%   +3.56%  (p=0.002 n=7+8)
NextParallel-8  79.4ns ± 1%  92.5ns ± 1%  +16.58%  (p=0.000 n=8+8)
```
2018-08-16 11:18:06 -06:00
Jeff Wendling d4a08ce5c1 pkg/snowflake: reduce contention in Next calls
use atomics rather than mutexes to synchronize state between calls.

```
name            old time/op  new time/op  delta
Next-8           244ns ± 0%    30ns ± 2%  -87.70%  (p=0.000 n=8+7)
NextParallel-8   215µs ±60%     0µs ± 1%  -99.96%  (p=0.000 n=8+8)
```

The results for NextParallel are around ~80ns/op, but that doesn't
show up in the benchstat output.
2018-08-15 15:12:21 -06:00
Jacob Marble 7bd9b2a627 tsdb: Copy return value of IndexSet.MeasurementNamesByExpr 2018-08-08 23:48:06 -07:00
Jeff Wendling f4c3c04f8f respond to review comments 2018-08-02 16:58:43 -06:00
Jeff Wendling f21d1773af move tls config into pkg
this makes it so you don't have to depend on cmd/influxd/run in
order to share the code with the parsing and stuff.
2018-08-02 14:29:07 -06:00
Jeff Wendling d979518135 inmem: use radix sort for series ids 2018-07-17 12:31:12 -06:00
Stuart Carnie 0841c51d93 pr(tsdb): Feedback items from PR review 2018-07-13 11:42:02 -07:00
Stuart Carnie 75e0bca597 chore(simple8b): Add simple 8b encoder / decoder
* includes additional APIs for batch decoding of byte slices to improve
  performance
* fix for `unpack120` that was decoding 240 values rather than 120
2018-07-13 11:42:02 -07:00
Ben Johnson 0fcab02074
Fix windows mmap on zero length file. 2018-06-29 10:24:16 -06:00
Jeff Wendling e6aec771b0 fix(tsdb): attempt to work on docker on windows
multiple users have attempted to run influxdb in a docker container
with a windows host and a volume mounted from windows. that causes
problems because it apparently uses samba/cifs which does not
support fsync on directories. this patchset will, if it receives an EINVAL
on directory fsync, as is what appears to happen on samba/cifs, then it
will ignore it. this should help.

fixes #9833.
fixes #9630.
2018-06-01 14:57:18 -06:00
Jeff Wendling cb9c3ee509 radix: optimize for our use case
- reduce allocations by making leaf a value type with a bool
- make longestPrefix inlineable and have no bounds checks
- delete any code for functions we don't plan to use
- operate on []byte and only copy when necessary
- inline calls to sort.Search to avoid allocations and indirections
- insert directly in the correct location for addEdge
- reduce allocations during copying with a buffer helper

results:

name              old time/op    new time/op     delta
Tree_Insert-8       1.10ms ± 4%     0.73ms ± 4%  -33.54%  (p=0.000 n=10+10)
Tree_InsertNew-8    3.18ms ± 2%     1.91ms ± 6%  -39.90%  (p=0.000 n=10+10)

name              old speed      new speed       delta
Tree_Insert-8     9.12MB/s ± 4%  13.72MB/s ± 4%  +50.46%  (p=0.000 n=10+10)
Tree_InsertNew-8  3.15MB/s ± 2%   5.24MB/s ± 6%  +66.42%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op    delta
Tree_InsertNew-8    1.62MB ± 0%     1.60MB ± 0%   -1.28%  (p=0.000 n=10+9)

name              old allocs/op  new allocs/op   delta
Tree_InsertNew-8     35.0k ± 0%      15.0k ± 0%  -57.04%  (p=0.000 n=10+10)

MB/sec in this case is 1 byte per key inserted, so it's really millions
of keys inserted per second.
2018-05-11 11:56:11 -06:00
Jason Wilder de58584ce7
Merge pull request #9748 from influxdata/jw-series-type
Prevent series type conflict
2018-05-10 07:05:45 -06:00
Jacob Marble 2dc2b97fb9
tsdb/index: Add Bytes() methods (#9794) 2018-05-04 08:47:05 -07:00
Jason Wilder ede6b2f041 Small performance optimizations
* Remove defer in Get hot path
* Use linear search for small arrays
2018-04-30 17:26:23 -06:00
Jason Wilder 2c8efb2609 Add string/int radix tree
This is a fork of https://github.com/armon/go-radix that changes
a few things from the original:

* Does not allow updates to nodes
* Typed for int values only
* Is concurrent using a big lock on Tree
2018-04-30 17:26:23 -06:00
Jacob Marble 63f0eee472 HLL++: estimate memory footprint bytes 2018-04-24 09:28:25 -07:00
Adam 72bceca888
Fix stream package to allow for renaming the file before writing it to the stream (#9684)
* Fix stream package to allow for renaming the file before writing it to the stream

* updated test to make sure that the final tsm file has more than one block
2018-04-05 16:24:29 -04:00
Mark Rushakoff 426a9a0b8b Use math/bits exclusively instead of go-bits
We won't be rolling back to pre-Go1.9, so prefer the standard library
over a dependency that provides backwards compatibility.
2018-03-15 12:03:24 -07:00
Stuart Carnie d135aecf02 Generate trace logs for a number of significant influx operations
* tsdb Store.Open traces all events related to opening files
    * op.name : tsdb.open
* retention policy shard deletions
    * op.name : retention.delete_check
* all TSM compaction strategies
    * op.name : tsm1.compact_group
* series file compactions
    * op.name : series_partition.compaction
* continuous query execution (if logging enabled)
    * op.name : continuous_querier.execute
* TSI log file compaction
    * op_name: index.tsi.compact_log_file
* TSI level compaction
    * op.name: index.tsi.compact_to_level
2018-02-21 15:08:49 -07:00
Edd Robinson e5c8fd9dc5 Ensure nil sketches never returned 2018-02-09 15:29:42 +00:00
Edd Robinson 0d164f3164
WIP - tsi integration sketches 2018-02-07 14:52:13 -07:00
Edd Robinson 544329380f
Add empty series sketches back to tsi1 index
This commit adds initial empty sketches back to the tsi1 index, as well
as ensuring that ephemeral sketches in the index `LogFile` are updated
accordingly.

The commit also adds a test that verifies that the merged sketches at
the store level produce the correct results under writes, deletions and
re-opening of the store.

This commit does not provide working sketches for post-compaction on the
tsi1 index.
2018-02-07 14:52:13 -07:00
Jason Wilder 0649150243 Reduce read IOPS in series file due to MADV_RANDOM
This reduces read IOPS to some extent.
2018-01-31 12:38:16 -07:00
Jason Wilder aed2784376 Reduce allocations when inserting into RHH
There were many small byte slices allocated and thrown away causing
a lot of garbage at higher cardinalities.
2018-01-31 12:38:11 -07:00
Edd Robinson a2fd8dd4ed Cleanup pkg package 2018-01-21 12:08:25 -08:00
Menno Finlay-Smits acaf5f097a pkg/escape: Add benchmarks for all bytes escape/unescape funcs 2018-01-16 11:12:47 +13:00
Menno Finlay-Smits b0e871876a pkg/escape: Preallocate output in Unescape
Preallocating the capacity of the output is faster and uses less
memory than letting append() do its own (over)allocation.
2018-01-16 09:37:37 +13:00
Ben Johnson d610a79487
Merge pull request #9295 from influxdata/partition-series-file
Partition series file
2018-01-11 08:45:18 -07:00
Adam 938db68198
Update restore functionality to run in online mode, consume Enterprise backup files. (#9207)
* Live Restore + Enterprise data format compatability

* Extended ImportData to import all DB's if no db name given

* Added a new enterprise data test, and backup command now prints the backup file paths at conclusion

* Added whole-system backup test

* Update to use protobuf in all enterprise data cases

* Update to test to do cross-testing with enterprise version

* incremental enterprise backup format support
2018-01-10 13:59:18 -05:00
Ben Johnson ac4dc91c64
Partition series file. 2018-01-10 08:33:25 -07:00
Ben Johnson c0a46d2d3d
Fix series file compaction stall.
The series file compaction previously did not snapshot the max
offset before compacting and would keep compacting until it reached
the end of segment file. This caused more entries than expected into
the RHH map and this map gets exponentially slower as it gets close
to full.
2018-01-08 09:53:01 -07:00
Stuart Carnie 44780742f7 fix format issue 2017-12-27 17:27:03 -07:00
Stuart Carnie c986cac76e improve performance when writes exceed max tag values or series
```
 benchmark                                                                  old ns/op     new ns/op     delta
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesExceeded-8        6175374       2714158       -56.05%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesNotExceeded-8     344502        326312        -5.28%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_NoMaxValues-8              346734        329961        -4.84%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxSeriesExceeded-8        2414945       1996223       -17.34%

 benchmark                                                                  old allocs     new allocs     delta
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesExceeded-8        45377          128            -99.72%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesNotExceeded-8     33             20             -39.39%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_NoMaxValues-8              33             20             -39.39%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxSeriesExceeded-8        15219          71             -99.53%

 benchmark                                                                  old bytes     new bytes     delta
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesExceeded-8        1354539       480114        -64.56%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxValuesNotExceeded-8     2101          1261          -39.98%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_NoMaxValues-8              2100          1261          -39.95%
 BenchmarkShardIndex_CreateSeriesListIfNotExists_MaxSeriesExceeded-8        707247        477737        -32.45%
 ```
2017-12-27 17:27:03 -07:00
Stuart Carnie d7a8368d2d Add bytesutil.Contains; improve performance of SearchBytes
```
benchmark                           old ns/op     new ns/op     delta
BenchmarkContains_True-8            67.0          41.8          -37.61%
BenchmarkContains_False-8           73.2          47.6          -34.97%
BenchmarkSearchBytes_Exists-8       51.5          34.3          -33.40%
BenchmarkSearchBytes_NotExits-8     57.7          39.8          -31.02%
```
2017-12-27 17:27:03 -07:00
Ben Johnson 8b2dbf4d83
Merge branch 'er-tsi-index-part' of https://github.com/influxdata/influxdb into er-tsi-index-part 2017-12-19 10:33:02 -07:00
Ben Johnson 107291c6b0
series file refactor 2017-12-19 10:31:33 -07:00
Edd Robinson 83032dfe54 windows test 2017-12-18 19:02:15 +00:00
Edd Robinson 2fd82645d8 Don't run test in race mode 2017-12-15 22:19:25 +00:00
Edd Robinson c476a0b4a1 Merge branch 'master' into er-tsi-index-part 2017-12-15 18:31:24 +00:00
Jason Wilder 749c9d2483 Rate limit disk IO when writing TSM files
This limits the disk IO for writing TSM files during compactions
and snapshots.  This helps reduce the spiky IO patterns on SSDs and
when compactions run very quickly.
2017-12-14 22:02:32 -07:00
Edd Robinson f6835632e7 Merge master into branch 2017-12-08 17:11:07 +00:00
Ben Johnson c36817fffc
Fix retain/release hang issues. 2017-12-06 09:09:41 -07:00
Jason Wilder c14b0e81b7 Save field types to speed up startup
This persists the field types in a shard to avoid having to scan
all the TSM files at startup.
2017-11-22 11:17:34 -07:00
Edd Robinson a5af19fc06 Address PR feedback 2017-11-17 12:43:48 +00:00
Ben Johnson ba4c9e0317
Merge remote-tracking branch 'upstream/master' into er-tsi-index-part 2017-11-14 16:14:13 -07:00
Jason Wilder 04f4c3e993 Optimize bytesutil.Pack 2017-11-13 09:02:10 -07:00