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

Made sure posting preload does not load too much irrelevant bytes. #109

Merged
merged 3 commits into from
Dec 8, 2017

Conversation

bwplotka
Copy link
Member

@bwplotka bwplotka commented Dec 8, 2017

Caching will be in next PR.

@bwplotka bwplotka requested a review from fabxc December 8, 2017 00:06
"github.com/pkg/errors"
)

// Bucket implements the store.Bucket and shipper.Bucket interfaces against local memory.
type Bucket struct {
objects map[string][]byte
dirs map[string]struct{}
Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, bit unrelated changes, but this actually makes inmem.Bucket behaviour the same as GCS one.

@fabxc
Copy link
Collaborator

fabxc commented Dec 8, 2017

Worth noting that postings are currently also unordered in the index, i.e. postings for the same label name might be scattered around. That amplifies the issue for sure.

In the next Prometheus 2 version this is fixed. It's also already fixed for blocks that will run through our compactor.

@@ -746,6 +751,7 @@ func (b *bucketBlock) readIndexRange(ctx context.Context, off, length int64) ([]
}
defer r.Close()

// NOTE(bplotka): Huge amount of memory is allocated here. We need to cache it.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Initially we could address heavy allocs via simple memory pooling instead of actually caching data.

pkg/store/bucket.go Show resolved Hide resolved
// Maximum amount of irrelevant bytes between postings we are willing to fetch.
const maxPostingsGap = 1024

ctx, cancel := context.WithCancel(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we creating a new context here? It's cancel method is never called either.

Copy link
Member Author

Choose a reason for hiding this comment

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

yup - it is used by run.Group below.

})

// Maximum amount of irrelevant bytes between postings we are willing to fetch.
const maxPostingsGap = 1024
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be way higher. For some manual testing there's basically no difference between fetching 1 byte and 100KB. The per-request overhead outshines significantly here so probably at nearly 500KB of fetching overhead is at least what we want to allow.

@fabxc
Copy link
Collaborator

fabxc commented Dec 8, 2017

👍

@bwplotka bwplotka changed the base branch from rules-fix to master December 8, 2017 12:02
Added comments and restructured preload postings function to allow unit testing.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
…il whole request.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Made sure single error in query -> storeAPI communication does not fail whole request.
@bwplotka bwplotka merged commit d254ab1 into master Dec 8, 2017
@bwplotka bwplotka deleted the preload-postings-opt branch December 11, 2018 13:26
fpetkovski pushed a commit to fpetkovski/thanos that referenced this pull request Mar 30, 2023
* Native histogram downsampling

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Fixed changelog

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Updated Readme

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Add chnagelog

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Fixed changelog

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Started work on histogram downsampling

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Removed compactor test

Started work on histogram downsampling

Naming

Naming

Raw downsampling without generics

Rebase fix

Refactor tests fragments into functions

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Refactor raw downsampling to support int histograms

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Comparing histograms for raw downsampling

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Add histogram support for bucket populateChunk

Refactored RawDownsample code

Benchmarking recovering series from histogram chunks

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Refactoring helper function into its own package

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Trying to implement integration test with querier and downsampled histogram chunks

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Making the test case a valid one

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Improvement for native histograms in bucket and series

Extending downsampling test

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Fixing iteration over native histograms aggr chunks

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Added hist sum to aggrsFromFunc and populateChunk fix

Adjusting query;

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Adding range as test parameter

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Fixing downsampling tests, general cleanup

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>

Fixed downsampling and improved test

Fixed native histogram aggregate downsampling

Fixed native histogram aggregate downsampling

Improved native histogram downsampling

Fixed downsample

Improved native histogram downsampling

Fixed reset hints for downsampling and added counter reset tests

Added nore native histogram downsampling tests

Improved native histograms downsampling tests.

Fixed tests

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Added float histogram encoding for storepb

Fixed linter

Fixed lint

Fixed lint

Revert CHANGELOG.md

Added debug log for downsampling

Take schema into account when adding histograms

Simplified downsampling (thanos-io#117)

* Simplified downsampling

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Simplified downsampling

Simplified downsampling

* Fixed downsampling

* Removed debug log

* Fixed schema for downsampling native histograms

* Fixed aggregate downsampling

* Added fix for downsampling stale histograms

* Lint fix for histogram downsampling tests

* Added more stale marker checks for downsampling

* Schema check for downsampled batch

Added gauge histogram support for downsampling

Adjust histogram sum downsampling for reset and hist AverageChunkIterator support

More histogram tests and cleanup

Added native histogram support to chunk iterator

Fixed overlappingMerger emtpy fn

Fixed overlappingMerger emtpy fn

Fix for appending during compaction

Disabled mimir unit tests

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Fixed imports

Reverted querier changes

Deleted native histogram query test

Deleted native histogram query test

Deleted native histogram query test

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Fixes from review

Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>

Removed logger from downsampleaggr

* Fixed populateChunk
danielmellado pushed a commit to danielmellado/thanos that referenced this pull request Oct 16, 2023
OCPBUGS-12663: go.mod: update golang.org/x/net to v0.7.0
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.

2 participants