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

Recommend lowering the default mmap readahead. #13223

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
* fragmented address space. If you get an {@link IOException} about mapping failed, it is
* recommended to reduce the chunk size, until it works.
*
* <p><b>NOTE</b>: On some platforms like Linux, mmap comes with a higher readahead than regular
* read() operations, e.g. 128kB for mmap reads and 16kB for regular reads. Such a high default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point to place in the kernel where this is happening?

* readahead can hurt performance on indexes that exceed the size of the page cache, by triggering
* more page cache trashing as well as more contention on the page cache. For typical workloads
* involving Lucene indexes, it is recommended to update the default readahead of mmap to the same
* readahead that is used by regular read() operations. This can be done by calling <code>
* sudo blockdev --setra 32 &lt;filesystem&gt;</code>, where 32 is the number of 512 byte sectors to
* read ahead, ie. 16kB, and &lt;filesystem&gt; is the filesystem where Lucene indexes are stored.
*
* <p>This class supports preloading files into physical memory upon opening. This can help improve
* performance of searches on a cold page cache at the expense of slowing down opening an index. See
* {@link #setPreload(BiPredicate)} for more details.
Expand Down