-
Notifications
You must be signed in to change notification settings - Fork 521
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
Add support for caching based on compaction level and block age #805
Conversation
…size histogram Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
…m shard counters Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
… level Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
There's one last thing left to implement: remove any caching while writing objects at the ingester. At the compactor we can have a similar shouldCache function as implemented for querier. |
Don't we need to merge #818 first before this?
Why wouldn't we cache objects written by the ingester? |
That's right. 818 is cleaned up and ready to review.
My bad, not remove caching, the write methods on ingester/compactor will use |
Signed-off-by: Martin Disibio <mdisibio@gmail.com>
Signed-off-by: Martin Disibio <mdisibio@gmail.com>
Signed-off-by: Martin Disibio <mdisibio@gmail.com>
uncachedReader backend.Reader | ||
uncachedWriter backend.Writer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we could shield off direct access to r
, w
, uncachedReader
and uncachedWriter
. So you are always forced to call getReaderForBlock
and getWriterForBlock
.
Unfortunately we can't shield private fields because everything is in the same package.
I think we should either add a comment to warn you or somehow combine these fields into a new struct that knows what to cache.
When I search for usage of r
and w
I still find some code using them directly (so without getXxxForBlock
). I don't know if this is okay.
r
:
- compactor.go:154 (
compact
) - compactor.go:160 (
compact
) - tempodb.go:208 (
CompleteBlock
)
w
:
- compactor.go:251 (
appendBlock
) - tempodb.go:208 (
CompleteBlock
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cases are unavoidable, such as compactor.go:154 to load the block meta from the backend, so the fields will have to remain accessible. compactor:160 and :251 are ok because they are iterating or flushing data, which does not involve the bloom filter. tempodb.go:208 actually looks like obsolete code only used by a querier test. The ingester used to call this when iterating the wal, but now it calls CompleteBlockWithBackend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is compactor.go:154
unavoidable? Using r
directly means we read using the cache, what's the difference with using the reader we get from getReaderForBlock
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I was thinking that there will be cases where the meta is not available, i.e. a call to get the meta, but in this case the compactor does already have it.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall changes look good and are easy to follow. It's fine for me to merge now and address the comments later.
Signed-off-by: Martin Disibio <mdisibio@gmail.com>
Signed-off-by: Martin Disibio <mdisibio@gmail.com>
What this PR does:
Adds support for caching based on compaction level and max block age. Ideally, we want to cache bloom filters of blocks that will be around longer - so blocks which reach higher levels of compaction soon.
Which issue(s) this PR fixes:
Fixes #na!
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]