Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed fingerprints in TSDB #5591

Closed
wants to merge 2 commits into from
Closed

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Mar 9, 2022

Opening/closing this PR for visibility.
@cyriltovena and I had guessed that embedding the label hash (fingerprint) into TSDB would be a net gain for read speeds, but after implementing it, that does not seem the case:

benchmarks:

name                                         old time/op    new time/op    delta
Query_PostingsForMatchers/match_ns-4           4.19µs ± 0%    4.08µs ± 0%   ~     (p=1.000 n=1+1)
Query_PostingsForMatchers/match_ns_regexp-4    4.16µs ± 0%    4.07µs ± 0%   ~     (p=1.000 n=1+1)
Query_GetChunkRefs/match_ns-4                  22.5ms ± 0%    22.1ms ± 0%   ~     (p=1.000 n=1+1)
Query_GetChunkRefs/match_ns_regexp-4           22.2ms ± 0%    22.2ms ± 0%   ~     (p=1.000 n=1+1)

name                                         old alloc/op   new alloc/op   delta
Query_PostingsForMatchers/match_ns-4            80.0B ± 0%     80.0B ± 0%   ~     (all equal)
Query_PostingsForMatchers/match_ns_regexp-4     80.0B ± 0%     80.0B ± 0%   ~     (all equal)
Query_GetChunkRefs/match_ns-4                  33.9MB ± 0%    33.9MB ± 0%   ~     (p=1.000 n=1+1)
Query_GetChunkRefs/match_ns_regexp-4           33.9MB ± 0%    33.9MB ± 0%   ~     (p=1.000 n=1+1)

name                                         old allocs/op  new allocs/op  delta
Query_PostingsForMatchers/match_ns-4             4.00 ± 0%      4.00 ± 0%   ~     (all equal)
Query_PostingsForMatchers/match_ns_regexp-4      4.00 ± 0%      4.00 ± 0%   ~     (all equal)
Query_GetChunkRefs/match_ns-4                   7.77k ± 0%     7.77k ± 0%   ~     (all equal)
Query_GetChunkRefs/match_ns_regexp-4            7.77k ± 0%     7.77k ± 0%   ~     (all equal)

sizing:

-rw-r--r-- 1 owen users 57M Mar  9 09:23 /tmp/loki-tsdb-a
-rw-r--r-- 1 owen users 58M Mar  9 09:24 /tmp/loki-tsdb-b

I'd guess this is because most of our time is spent on other operations which eclipse the potential benefit of this, such as growing slices in GetChunkRefs:

image

ref #5428

@owen-d owen-d requested a review from a team as a code owner March 9, 2022 15:04
@owen-d owen-d closed this Mar 9, 2022
This was referenced Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant