-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
In #15458 we found that cold index optimizations (deferring term states to send the madvise WILLNEED signal) can hurt performance when running a hot index. This might also be true for other cases where Lucene uses madvise?
We could have a parameter for users to select hot or cold index mode, depending on their use case.
We can also try to implement an adaptive mode, which enables cold index optimizations when the index is cold and enables hot index optimizations otherwise. I thought (#15458 (comment)) we could use the isLoaded method for it, but as @mikemccand pointed out, this method is quite expensive (#14156 (comment)). I think we can implement an isProbablyLoaded method (which checks only the first, middle, and last pages of a memory segment) to overcome that.
As for TermStates.get itself, we can check if deferring dictionary lookup improves cold index performance (#15458 (comment) ). If it does, I think we can propagate the isProbablyLoaded method results to it and defer the dictionary lookup only if the index is cold.
We can also look at other madvise use cases and see if we can apply the same mechanism to them?