Skip to content

Commit ff65fd1

Browse files
authored
Turn direct IO for BBQ rescoring off by default (elastic#130014)
Add a changelog entry for direct io option
1 parent 77b459c commit ff65fd1

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

docs/changelog/125921.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pr: 125921
2+
summary: Allow direct IO for BBQ rescoring
3+
area: Vector Search
4+
type: feature
5+
highlight:
6+
title: Allow direct IO for BBQ rescoring
7+
body: |-
8+
BBQ rescoring performance can be drastically affected by the amount of available
9+
off-heap RAM for use by the system page cache. When there is not enough off-heap RAM
10+
to fit all the vector data in memory, BBQ search latencies can be affected by as much as 5000x.
11+
Specifying the `vector.rescoring.directio=true` Java option on all vector search
12+
nodes modifies rescoring to use direct IO, which eliminates these very high latencies
13+
from searches in low-memory scenarios, at a cost of a reduction
14+
in vector search performance for BBQ indices when the vectors do all fit in memory.
15+
16+
This option is released in 9.1 as a tech preview whilst we analyse its effect
17+
for a variety of use cases.
18+
issues: []

server/src/internalClusterTest/java/org/elasticsearch/index/store/DirectIOIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.apache.lucene.store.IndexOutput;
1818
import org.apache.lucene.tests.util.LuceneTestCase;
1919
import org.elasticsearch.common.settings.Settings;
20+
import org.elasticsearch.index.codec.vectors.es818.ES818BinaryQuantizedVectorsFormat;
2021
import org.elasticsearch.plugins.Plugin;
2122
import org.elasticsearch.search.vectors.KnnSearchBuilder;
2223
import org.elasticsearch.search.vectors.VectorData;
@@ -43,7 +44,9 @@
4344
public class DirectIOIT extends ESIntegTestCase {
4445

4546
@BeforeClass
46-
public static void checkSupported() throws IOException {
47+
public static void checkSupported() {
48+
assumeTrue("Direct IO is not enabled", ES818BinaryQuantizedVectorsFormat.USE_DIRECT_IO);
49+
4750
Path path = createTempDir("directIOProbe");
4851
try (Directory dir = open(path); IndexOutput out = dir.createOutput("out", IOContext.DEFAULT)) {
4952
out.writeString("test");

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/ES818BinaryQuantizedVectorsFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
*/
8888
public class ES818BinaryQuantizedVectorsFormat extends FlatVectorsFormat {
8989

90-
static final boolean USE_DIRECT_IO = Boolean.parseBoolean(System.getProperty("vector.rescoring.directio", "true"));
90+
public static final boolean USE_DIRECT_IO = Boolean.parseBoolean(System.getProperty("vector.rescoring.directio", "false"));
9191

9292
public static final String BINARIZED_VECTOR_COMPONENT = "BVEC";
9393
public static final String NAME = "ES818BinaryQuantizedVectorsFormat";

server/src/test/java/org/elasticsearch/index/codec/vectors/es818/ES818BinaryQuantizedVectorsFormatTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ private Directory newFSDirectory() throws IOException {
333333
}
334334

335335
static void checkDirectIOSupported() {
336+
assumeTrue("Direct IO is not enabled", ES818BinaryQuantizedVectorsFormat.USE_DIRECT_IO);
337+
336338
Path path = createTempDir("directIOProbe");
337339
try (Directory dir = open(path); IndexOutput out = dir.createOutput("out", IOContext.DEFAULT)) {
338340
out.writeString("test");

server/src/test/java/org/elasticsearch/index/codec/vectors/es818/ES818HnswBinaryQuantizedVectorsFormatTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ private Directory newFSDirectory() throws IOException {
221221
}
222222

223223
static void checkDirectIOSupported() {
224+
assumeTrue("Direct IO is not enabled", ES818BinaryQuantizedVectorsFormat.USE_DIRECT_IO);
225+
224226
Path path = createTempDir("directIOProbe");
225227
try (Directory dir = open(path); IndexOutput out = dir.createOutput("out", IOContext.DEFAULT)) {
226228
out.writeString("test");

0 commit comments

Comments
 (0)