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

Use MAP_POPULATE for our bbolt mmaps #13573

Merged
merged 5 commits into from Jan 11, 2022
Merged

Conversation

ncabatoff
Copy link
Collaborator

... assuming the files fit in memory. This should improve startup times when freelist sync is disabled.

…y. This should improve startup times when freelist sync is disabled.
@vercel vercel bot temporarily deployed to Preview – vault-storybook January 5, 2022 16:04 Inactive
@vercel vercel bot temporarily deployed to Preview – vault January 5, 2022 16:04 Inactive
@ncabatoff
Copy link
Collaborator Author

I have only tested this to the extent of verifying via strace that MAP_POPULATE is used on linux.

@vercel vercel bot temporarily deployed to Preview – vault January 5, 2022 17:11 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook January 5, 2022 17:11 Inactive
@raskchanky
Copy link
Contributor

@ncabatoff Is it worth adding an env var to this to allow users to explicitly opt out of MAP_POPULATE completely?

@ncabatoff
Copy link
Collaborator Author

@ncabatoff Is it worth adding an env var to this to allow users to explicitly opt out of MAP_POPULATE completely?

Good thinking, I'll add that.

@vercel vercel bot temporarily deployed to Preview – vault-storybook January 10, 2022 20:25 Inactive
@vercel vercel bot temporarily deployed to Preview – vault January 10, 2022 20:25 Inactive
# Conflicts:
#	physical/raft/bolt_32bit_test.go
#	physical/raft/bolt_64bit_test.go
@ncabatoff
Copy link
Collaborator Author

Added the suggested env var override. Did some more serious testing on a Linux machine: besides just looking at strace to see that the option is used/not used based on env var, I actually gave it a 300MB vault.db that had seen lots of activity and had a big freelist. With MAP_POPULATE, it took 2-6s to open the DB; without, 12-47s. The machine was doing nothing else, I have no idea why it was so variable, but I did many runs, dropping caches in between.

To test the memory check, I used truncate -s to grow the vault.db file to bigger than my RAM. When I looked at the strace output, I saw that vault.db was opened without MAP_POPULATE, where raft.db (still small) did use MAP_POPULATE.

@ncabatoff ncabatoff added this to the 1.8.8 milestone Jan 11, 2022
@ncabatoff ncabatoff merged commit e712044 into main Jan 11, 2022
@ncabatoff ncabatoff deleted the vault-4679-use-map-populate branch January 11, 2022 13:16
ncabatoff added a commit that referenced this pull request Jan 11, 2022
* Use MAP_POPULATE for our bbolt mmaps, assuming the files fit in memory.  This should improve startup times when freelist sync is disabled.
heppu pushed a commit to heppu/vault that referenced this pull request Jan 13, 2022
* Use MAP_POPULATE for our bbolt mmaps, assuming the files fit in memory.  This should improve startup times when freelist sync is disabled.
joatmon08 pushed a commit that referenced this pull request Jan 25, 2022
* Use MAP_POPULATE for our bbolt mmaps, assuming the files fit in memory.  This should improve startup times when freelist sync is disabled.
qk4l pushed a commit to qk4l/vault that referenced this pull request Feb 4, 2022
* Use MAP_POPULATE for our bbolt mmaps, assuming the files fit in memory.  This should improve startup times when freelist sync is disabled.
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