-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Series creation improvements #9380
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We
mmap
in (I think) five places in the database:mmap
TSI index files (.tsi
).mmap
TSI log files (.tsl
).mmap
the Series File hashmap index (_series/*/index
).mmap
the Series File segment files (_series/*/0000
).mmap
the TSM index (.tsm
).As I understand it,
SYS_MADVISE
is there to inform the kernel about how the memory within the mmap'd data will be accessed. The current setting is telling the kernel that we will need to randomly access pages, which are typically going to be4KB
of the mapped data.For the above five examples I think that the way we access pages would probably be different.
tsm
index to know its access patterns.To me, it seems like we should be passing in the advice values to
Map
depending on the expected use-case. It looks like we might have a mixture ofMADV_NORMAL
,MADV_SEQUENTIAL
andMADV_RANDOM
.@jwilder I guess when you switched from
MADV_RANDOM
toMADV_NORMAL
then the kernel was doing some read ahead that was reducing the number of IO read operations. Though, of course, if we usedMADV_SEQUENTIAL
then more aggressive read ahead would be done and read IOPS might be reduced even further.I think we could experiment with different advise parameters for the different subsystems that use
mmap
and set the advise value accordingly.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.
I've had to remove any place where we're using
MADV_RANDOM
in the past due to adverse performance problems. See: #8872 and #5221. Other projects (boltdb/bolt#691) have seen similar issues.I only add
madavise
calls in specific spots after testing them quite extensively and can see that they improve what I'm measuring. Despite what the docs say they do, it's kind of a black box as to what kernel actually does.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.
@jwilder I guess what I'm saying is: we should do some explicit experimentation in the future on all the sub systems and see if any advice other than
NORMAL
is appropriate anywhere. If we're doing really sequential stuff thenMADV_SEQUENTIAL
might be even better for read IOPS thanMADV_NORMAL
for example.