Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Add madvise setting for sequential dbs #737

Closed
wants to merge 1 commit into from
Closed

Add madvise setting for sequential dbs #737

wants to merge 1 commit into from

Conversation

glinton
Copy link

@glinton glinton commented Nov 28, 2017

Madvise allows advising the kernel how the mmap should be accessed. The default is "random", but if the db is being used sequentially, setting to "normal" has been shown to improve performance on high latency filesystem storage.

Resolves #691

Example:

madvise := syscall.MADV_NORMAL
db, err := bolt.Open(path, 0644, &bolt.Options{
	Timeout:    0,
	NoGrowSync: false,
	Madvise: &madvise,
})

The reason for the pointer is because an empty value would be "normal" (0x0), use options only if set, and keep using "random" by default.

Madvise allows advising the kernel how the mmap should be accessed. The
default is "random", but if the db is being used sequentially, setting
to "normal" has been shown to improve performance on high latency
filesystem storage.

Resolves #691
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants