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

New mapped_private mode: avoid crash by flushing dirty pages when memory pressure gets high. #1725

Closed
wants to merge 13 commits into from

Conversation

greg7mdp
Copy link
Contributor

@greg7mdp greg7mdp commented Oct 5, 2023

Resolves #1721.

The Linux kernel assigns and maintains an Out of Memory (OOM) score on a per-process basis, The valid range is from 0 (never kill) to 1000 (always kill), the lower the value is, the lower is the probability the process will be killed.

We track this score for Leap, and when the score gets high, flush the dirty pages of our private mapping to disk, lowering the Leap process OOM score, and thus preventing the system from killing our process.

Currently, we trigger the flush() for an oom value of 980, which is pretty hard to reach on a system which has more memory than the state database working set (about 20GB for EOS). I tried launching a bunch of programs gobbling memory while nodeos was running, but these programs were killed by the OS while nodeos continued working happily, even with a lower oom_score threshold (I tried 900 and 800).

This PR makes leap mapped_private mode function in a somewhat optimal mode, using as much memory as possible for its chainbase db in order to preventing constant writebacks to disk, while still doing occasional writebacks (to avoid crashing) on systems with limited RAM.

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.

New mapped_private mode: avoid crash by flushing dirty pages when memory pressure gets high.
1 participant