Skip to content

Apache Lucene open-source search software

Disable ConcurrentMergeScheduler's auto I/O throttling by default. (#13293)

Adrien Grand927f081fb0d9
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 36aea0f7661..74bfa5f4917 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -177,6 +177,9 @@ Changes in Runtime Behavior
`-Dorg.apache.lucene.store.defaultReadAdvice=normal`. This may be useful on systems
with lots of RAM as this increases read-ahead. (Adrien Grand, Uwe Schindler)
+* GITHUB13293: Auto I/O throttling is now disabled by default on ConcurrentMergeScheduler.
+ (Adrien Grand)
+
Changes in Backwards Compatibility Policy
-----------------------------------------
diff --git a/lucene/MIGRATE.md b/lucene/MIGRATE.md
index 781e72c268f..b4b1c71c8be 100644
--- a/lucene/MIGRATE.md
+++ b/lucene/MIGRATE.md
@@ -242,6 +242,12 @@ List<Object> results = searcher.search(query, new CustomCollectorManager());
6. `ByteBuffersDataInput#size()`. Use `ByteBuffersDataInput#length()` instead
7. `SortedSetDocValuesFacetField#label`. `FacetsConfig#pathToString(String[])` can be applied to path as a replacement if string path is desired.
+### Auto I/O throttling disabled by default in ConcurrentMergeScheduler (GITHUB#13293)
+
+ConcurrentMergeScheduler now disables auto I/O throttling by default. There is still some throttling
+happening at the CPU level, since ConcurrentMergeScheduler has a maximum number of threads it can
+use, which is only a fraction of the total number of threads of the host by default.
+
## Migration from Lucene 9.0 to Lucene 9.1
### Test framework package migration and module (LUCENE-10301)
diff --git a/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java b/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
index e1beb1cba92..f27308f2aca 100644
--- a/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
+++ b/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
@@ -108,7 +108,7 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
protected double targetMBPerSec = START_MB_PER_SEC;
/** true if we should rate-limit writes for each merge */
- private boolean doAutoIOThrottle = true;
+ private boolean doAutoIOThrottle = false;
private double forceMergeMBPerSec = Double.POSITIVE_INFINITY;
@@ -202,7 +202,8 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
/**
* Turn on dynamic IO throttling, to adaptively rate limit writes bytes/sec to the minimal rate
- * necessary so merges do not fall behind. By default this is enabled.
+ * necessary so merges do not fall behind. By default this is disabled and writes are not
+ * rate-limited.
*/
public synchronized void enableAutoIOThrottle() {
doAutoIOThrottle = true;
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java b/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
index 08b9bf9ac1b..5f85b5d3774 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
@@ -900,10 +900,11 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
public void testAutoIOThrottleGetter() throws Exception {
ConcurrentMergeScheduler cms = new ConcurrentMergeScheduler();
- cms.disableAutoIOThrottle();
assertFalse(cms.getAutoIOThrottle());
cms.enableAutoIOThrottle();
assertTrue(cms.getAutoIOThrottle());
+ cms.disableAutoIOThrottle();
+ assertFalse(cms.getAutoIOThrottle());
}
public void testNonSpinningDefaults() throws Exception {
@@ -944,6 +945,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
super.doStall();
}
};
+ cms.enableAutoIOThrottle();
cms.setMaxMergesAndThreads(2, 1);
iwc.setMergeScheduler(cms);
iwc.setMaxBufferedDocs(2);