Skip to content

Batch index lookups on BigTable#971

Merged
tomwilkie merged 4 commits intocortexproject:masterfrom
grafana:batch-index-lookups
Sep 3, 2018
Merged

Batch index lookups on BigTable#971
tomwilkie merged 4 commits intocortexproject:masterfrom
grafana:batch-index-lookups

Conversation

@tomwilkie
Copy link
Contributor

@tomwilkie tomwilkie commented Aug 29, 2018

With the series index, resolving series ID to chunk IDs can issues 100s of thousands of queries to the index. The cache does a good job of handling most of these, but we should batch the rest.

As part of this I changes the BigTable backend to only read full rows - this shouldn't impact performance, as the index cache was forcing us to only read full rows anyway. I also changed the ReadBatch interface to be iterator-style, so we can filter it down without copies.

Fixes #969

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@tomwilkie tomwilkie force-pushed the batch-index-lookups branch from 5eea0b5 to 387a6f3 Compare August 29, 2018 21:03
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Copy link
Contributor

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments/questions. Overall LGTM

@@ -0,0 +1,77 @@
package util
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the util package instead of another thing in chunk? I think everywhere that uses this right now uses chunk as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree util packages suck, but I'm trying to break the chunk package up - its a bit of a behemoth, and I find I regularly get into circular imports with it. Hence this got stuck in a new package.


return entries, nil
})
return entries, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the log message might be nice

strings.TrimPrefix(b.items[index].Column, b.columnPrefix),
)
func (b *bigtableReadBatchColumnKey) RangeValue() []byte {
return []byte(strings.TrimPrefix(b.items[b.i].Column, b.columnPrefix))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider inlining the columnPrefix since it is static? Then it would not need to be on bigtableReadBatchColumnKey

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@tomwilkie tomwilkie merged commit 0d275f0 into cortexproject:master Sep 3, 2018
@tomwilkie tomwilkie deleted the batch-index-lookups branch September 3, 2018 10:07
tomwilkie added a commit to grafana/cortex that referenced this pull request Sep 3, 2018
…-lookups"

This reverts commit 0d275f0, reversing
changes made to 1ffffff.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
tomwilkie added a commit to grafana/cortex that referenced this pull request Sep 3, 2018
…ch-index-lookups""

This reverts commit 8b74f90.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
tomwilkie added a commit that referenced this pull request Sep 3, 2018
Revert "Merge pull request #971 from grafana/batch-index-lookups"
tomwilkie added a commit to grafana/cortex that referenced this pull request Sep 11, 2018
…ch-index-lookups""

This reverts commit 8b74f90.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@bboreham
Copy link
Contributor

This was reverted and replaced by #981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants