Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Persist series without allocating the full set #116

Merged
merged 1 commit into from
Aug 10, 2017
Merged

Persist series without allocating the full set #116

merged 1 commit into from
Aug 10, 2017

Conversation

fabxc
Copy link
Contributor

@fabxc fabxc commented Aug 6, 2017

Change index persistence for series to not be accumulated in memory
before being written as one large batch. Labels and ChunkMeta
objects are reused.
This cuts down memory spikes during compaction of multiple blocks
significantly.

As part of the the Index{Reader,Writer} now have an explicit notion of
symbols and series must be inserted in order.

@gouthamve

This does not solve all of it yet but has very positive effects. The next effective optimizations are likely around the postings lists.

Max heap usage (using max_over_time):

screen shot 2017-08-06 at 12 09 34

Change index persistence for series to not be accumulated in memory
before being written as one large batch. `Labels` and `ChunkMeta`
objects are reused.
This cuts down memory spikes during compaction of multiple blocks
significantly.

As part of the the Index{Reader,Writer} now have an explicit notion of
symbols and series must be inserted in order.
Copy link
Collaborator

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

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

LGTM, sorry for taking so long.

While the interface became slightly complex, it is needed.


// Reference on the original slice to use for postings mapping.
series := h.series[:]
h.mtx.RUnlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Defer pattern is better as both are co-located? The instantiation of the blockQuerier should be instantaneous AFAICS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Index(), Chunks(), and Tombstones() do or may in the future lock the mutex too. So defer would call deadlocking here.

@fabxc
Copy link
Contributor Author

fabxc commented Aug 10, 2017

Yup, got a bit more complex. But the SortedPostings method gets rid of our nasty hacks so far, which is nice.

@fabxc fabxc merged commit 9123028 into master Aug 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants