Skip to content

Use MAP_POPULATE for our bbolt mmaps#13573

Merged
ncabatoff merged 5 commits intomainfrom
vault-4679-use-map-populate
Jan 11, 2022
Merged

Use MAP_POPULATE for our bbolt mmaps#13573
ncabatoff merged 5 commits intomainfrom
vault-4679-use-map-populate

Conversation

@ncabatoff
Copy link
Copy Markdown
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.
@ncabatoff ncabatoff requested a review from raskchanky January 5, 2022 15:53
@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
Copy Markdown
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
Copy Markdown
Collaborator

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

@ncabatoff
Copy link
Copy Markdown
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
Copy Markdown
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.
pbromb pushed a commit to pbromb/vault that referenced this pull request Apr 13, 2026
…github.com/moby/moby into release/1.21.x+ent (hashicorp#13572) (hashicorp#13629)

* [VAULT-43618] sdk: migrate from github.com/docker/docker to github.com/moby/moby (hashicorp#13549) (hashicorp#13573)
Resolve GHSA-x744-4wpc-v9h2 and GHSA-pxq6-2prw-chj9 in `vault` by replacing
`github.com/docker/docker` with `github.com/moby/moby/client` @ `v0.3.0` and
`github.com/moby/moby/api` @ `v1.54.0`. This is necessary as `docker/docker`
 is no longer maintained and the fixes are not available in it.

Resolve GO-2026-4518, GHSA-x6gf-mpr2-68h6 and GHSA-jqcq-xjh3-6g23 by
upgrading to github.com/jackc/pgx/v5. This is necessary as v4 is not
longer maitained.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
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.

2 participants