-
Notifications
You must be signed in to change notification settings - Fork 180
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
Prevent Linux Page Cache from hoarding 294GB - 394GB RAM on Execution Nodes #2336
Conversation
Use sys/unix package to advise Linux to evict from cache: * existing checkpoint file after it is loaded * new checkpoint file after it is created This prevents 132+ GB from accumulating in Linux page cache after each checkpointing.
At startup, advise Linux to evict all checkpoint files from Linux page cache.
logger.Info().Msgf("run %q to drop file from OS file cache", cmd.String()) | ||
// evictFileFromLinuxPageCache advises Linux to evict a file from Linux page cache. | ||
// A use case is when a new checkpoint is loaded or created, Linux may cache big | ||
// checkpoint files in memory until evictFileFromLinuxPageCache causes them to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// checkpoint files in memory until evictFileFromLinuxPageCache causes them to be | |
// checkpoint files in memory until evictFileFromLinuxPageCache is called to force them to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evictFileFromLinuxPageCache
calls posix_fadvise
under the hood. And posix_fadvise
docs say that it's not binding advice and merely constitutes an expectation on behalf of the application.
In benchnet tests, the file is always removed from Linux page cache after calling evictFileFromLinuxPageCache
.
Codecov Report
@@ Coverage Diff @@
## master #2336 +/- ##
==========================================
- Coverage 57.47% 57.40% -0.07%
==========================================
Files 645 646 +1
Lines 38428 38634 +206
==========================================
+ Hits 22085 22179 +94
- Misses 13530 13623 +93
- Partials 2813 2832 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Description
Linux automatically caches files when we read or write files, so this PR uses
posix_fadvise(2)
to evict some very large files after they are used (98GB each as of June 15, 2022).Prior to this PR, Linux was increasing its page cache by 196GB after each checkpointing (+98GB after reading old file and another +98GB after creating new file). After just two checkpointings, Linux page cache can potentially grow nearly 400GB which was caused various problems such as Grafana EN Memory Usage chart being obfuscated.
This PR replaces PR #2281 which didn't do anything because we didn't want to deploy a file it requires (/bin/dd). Unlike PR #2291, this PR doesn't require
/bin/dd
.Updates Epic #1744 because Grafana EN Memory Usage Chart was previously obfuscating/hiding the impact of ledger and checkpoint memory optimizations (e.g. PR #1944).
Changes:
dd
not being found in/usr/bin
and/bin
Next Steps
A separate PR will advise Linux to evict segments of checkpoint files during use, which will provide more fine-grained control as described in Other Approaches section of PR #2280.