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

Mas i1820 offlinedeserialisation cbo #403

Merged
merged 10 commits into from
Mar 8, 2023

Conversation

martinsumner
Copy link
Owner

Use of pro-active hibernate, hibernate_after and offline processing to reduce fluctuation in memory footprints of leveled_sst processes

If Block Index Cache is not full, and we're not yielding
Hypothesis is that the growth in the heap necessary due to continual term_to_binary calls to deserialise blocks is wasting memory - so do this memory-intensive task in a short-lived process.
Testing indicates that the BIC itself is not a primary memory issue - the primary issue is due to a lack of garbage collection and a growing heap.

This change enhances the patch to offline serialisation so that:
- get_sqn & get_kv are standardised to build the BIC, and hibernate when it is built.
- the offline PId is linked to crash this process on failure (as would happen now).
Now deserialise in both parts of the code.
@martinsumner
Copy link
Owner Author

RiakMemory_HighKeyCountTest

Comparison of memory used in Riak test designed to drive very high key counts relatively quickly. The Control is Riak 3.0.13 (with default beam memory settings e.g. eheap memory sbct of 512KB).

@martinsumner
Copy link
Owner Author

Riak315xlarge_memcomparison

Throughput comparison on 8-node im4gn.xlarge 24 hour test. Throughput difference was a 2% drop with this patch. However, there was a 10% memory drop with both running eheap memory sbct of 128KB.

@martinsumner
Copy link
Owner Author

Important that there is a positive change with and without default SBCT setting. Changing the default SBCT setting improves memory usage, but in some cases this improvement can be hard to detect because of the use of MADVISE_FREE not MADVISE_DONTNEED.

Ideally it would be helpful to have a fully observable drop in memory. Whereas with sbct=128KB when the single block carriers are shrunk with MADVISE_FREE this is not easily observable.

@martinsumner
Copy link
Owner Author

Copy link
Contributor

@ThomasArts ThomasArts left a comment

Choose a reason for hiding this comment

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

Timeout discussion necessary.

src/leveled_sst.erl Show resolved Hide resolved
src/leveled_sst.erl Show resolved Hide resolved
src/leveled_sst.erl Show resolved Hide resolved
src/leveled_sst.erl Show resolved Hide resolved
@martinsumner martinsumner merged commit 5e6a5e5 into develop-3.0 Mar 8, 2023
@martinsumner martinsumner deleted the mas-i1820-offlinedeserialisation-cbo branch March 8, 2023 08:58
martinsumner added a commit that referenced this pull request Mar 10, 2023
* Log report GC Info by manifest level

* Hibernate on range query

If Block Index Cache is not full, and we're not yielding

* Spawn to deserialise blocks offline

Hypothesis is that the growth in the heap necessary due to continual term_to_binary calls to deserialise blocks is wasting memory - so do this memory-intensive task in a short-lived process.

* Start with hibernate_after option

* Always build BIC

Testing indicates that the BIC itself is not a primary memory issue - the primary issue is due to a lack of garbage collection and a growing heap.

This change enhances the patch to offline serialisation so that:
- get_sqn & get_kv are standardised to build the BIC, and hibernate when it is built.
- the offline PId is linked to crash this process on failure (as would happen now).

* Standardise spawning for check_block/3

Now deserialise in both parts of the code.

* Only spawn for check_block if cache not full

* Update following review
@martinsumner martinsumner mentioned this pull request Mar 13, 2023
martinsumner added a commit that referenced this pull request Mar 13, 2023
* refactor leveled_sst from gen_fsm to gen_statem

* format_status/2 takes State and State Data
but this function is deprecated... put in for backward compatibility

* refactor leveled_cdb from gen_fsm to gen_statem

* disable irrelevant warning ignorer

* Remove unnecessary code paths

Only support messages, especially info messages, where they are possible.

* Mas i1820 offlinedeserialisation cbo (#403)

* Log report GC Info by manifest level

* Hibernate on range query

If Block Index Cache is not full, and we're not yielding

* Spawn to deserialise blocks offline

Hypothesis is that the growth in the heap necessary due to continual term_to_binary calls to deserialise blocks is wasting memory - so do this memory-intensive task in a short-lived process.

* Start with hibernate_after option

* Always build BIC

Testing indicates that the BIC itself is not a primary memory issue - the primary issue is due to a lack of garbage collection and a growing heap.

This change enhances the patch to offline serialisation so that:
- get_sqn & get_kv are standardised to build the BIC, and hibernate when it is built.
- the offline PId is linked to crash this process on failure (as would happen now).

* Standardise spawning for check_block/3

Now deserialise in both parts of the code.

* Only spawn for check_block if cache not full

* Update following review

* Standardise formatting

Make test more reliable.  Show no new compaction after third compaction.

* Update comments

---------

Co-authored-by: Thomas Arts <thomas.arts@quviq.com>
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.

None yet

2 participants