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

call Gc.compact periodically #7551

Merged
merged 3 commits into from Jan 21, 2021
Merged

call Gc.compact periodically #7551

merged 3 commits into from Jan 21, 2021

Conversation

deepthiskumar
Copy link
Member

Calling Gc.compact periodically to free the memory held
Below is the result of calling Gc.compact from utop (it reduced heap words from ~13GB to ~5GB)

# Gc.stat ();;
- : Gc.stat =
{Gc.minor_words = 2294978993287.; promoted_words = 15080030917.;
 major_words = 20958098793.; minor_collections = 8761351;
 major_collections = 216; heap_words = 1715582464; heap_chunks = 59;
 live_words = 526574411; live_blocks = 142165064; free_words = 1188950267;
 free_blocks = 2149630; largest_free = 1546702; fragments = 57786;
 compactions = 0; top_heap_words = 1715582464; stack_size = -17469354802087}
# Gc.compact ();;
- : unit = ()
# Gc.stat ();;
- : Gc.stat =
{Gc.minor_words = 2302521471864.; promoted_words = 15123686288.;
 major_words = 21010814070.; minor_collections = 8790126;
 major_collections = 219; heap_words = 734692864; heap_chunks = 4;
 live_words = 394400770; live_blocks = 112766591; free_words = 340292094;
 free_blocks = 3; largest_free = 169203712; fragments = 0; compactions = 1;
 top_heap_words = 1715582464; stack_size = -17469354802221}
  1. Periodically calling Gc.compact in the daemon for proof-level FULL

  2. Added two environment variables MINA_COMPACTION_MS and MINA_COMPACTION_INTERVAL_MS to set expected compaction time (default: 6000 ms) and time between calling Gc.compact (default: slot_duration * 2) respectively.

Ran the daemon with the default values for ~6 hours. It did reduced the heap words, but the memory usage still grew linearly

Closes #7542

@deepthiskumar deepthiskumar requested a review from a team as a code owner January 20, 2021 10:21
@deepthiskumar deepthiskumar added the ci-build-me Add this label to trigger a circle+buildkite build for this branch label Jan 20, 2021
src/lib/mina_lib/mina_lib.ml Outdated Show resolved Hide resolved
src/lib/mina_lib/mina_lib.ml Outdated Show resolved Hide resolved
@deepthiskumar deepthiskumar requested a review from a team as a code owner January 21, 2021 02:34
@deepthiskumar deepthiskumar added the ready-to-merge Adding this label will trigger mergify and trigger CI to run and merge the PR label Jan 21, 2021
Copy link
Member

@mrmr1993 mrmr1993 left a comment

Choose a reason for hiding this comment

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

Very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build-me Add this label to trigger a circle+buildkite build for this branch ready-to-merge Adding this label will trigger mergify and trigger CI to run and merge the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants