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

Configurable DB Mmap Size for Beacon Node and Validator Client #8448

Merged
merged 7 commits into from
Feb 15, 2021

Conversation

rauljordan
Copy link
Contributor

@rauljordan rauljordan commented Feb 15, 2021

What type of PR is this?

Feature

What does this PR do? Why is it needed?

Currently, we notice that operating a large number of validators has really terrible performance during the first 10-30 minutes of operation, with many deadlines exceeded and long read/write times for db operations. After some investigation into bolt db defaults, looks like they have a very conservative default for the initial mmap size. During startup, bolt dynamically remaps the file to match the resource demand of the software, and during this time, read operations and write operations can have high contention rates between each other. We believe this is the root cause of the degraded performance we see on Pyrmont, and such an issue has also been reported to bolt authors and brought up several times in the past.

This PR creates a shared flag named --bolt-initial-mmap-size which is set to a default of 512Mb

More information

BoltDB options expressly mention the following:

// InitialMmapSize is the initial mmap size of the database
// in bytes. Read transactions won't block write transaction
// if the InitialMmapSize is large enough to hold database mmap
// size. (See DB.Begin for more information)
//
// If <=0, the initial map size is 0.
// If initialMmapSize is smaller than the previous database size,
// it takes no effect.
InitialMmapSize int

Supplemental reading: How databases use mmap

@rauljordan rauljordan requested a review from a team as a code owner February 15, 2021 17:55
@rauljordan rauljordan self-assigned this Feb 15, 2021
@rauljordan rauljordan added Priority: Critical Highest, immediate priority item Ready For Review labels Feb 15, 2021
@prylabs-bulldozer prylabs-bulldozer bot merged commit 36b6a71 into develop Feb 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the initialmmapflag branch February 15, 2021 20:29
@nisdas nisdas mentioned this pull request Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Critical Highest, immediate priority item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants