Sfoglia il codice sorgente

Default the circuit breaker limit to 80% of the maximum JVM heap

Lee Hinman 11 anni fa
parent
commit
47607a69a1

+ 2 - 3
docs/reference/index-modules/fielddata.asciidoc

@@ -77,7 +77,7 @@ field data format.
 ==== Numeric field data types
 
 `array` (default)::
-    Stores field values in memory using arrays. 
+    Stores field values in memory using arrays.
 
 `doc_values`::
     Computes and stores field data data-structures on disk at indexing time.
@@ -250,8 +250,7 @@ if set. It can be configured with the following parameters:
 |=======================================================================
 |Setting |Description
 |`indices.fielddata.breaker.limit` |Maximum size of estimated field data
-to allow loading. Defaults to `indices.fielddata.cache.size` if set, unbounded
-if not.
+to allow loading. Defaults to 80% of the maximum JVM heap.
 |`indices.fielddata.breaker.overhead` |A constant that all field data
 estimations are multiplied with to determine a final estimation. Defaults to
 1.03

+ 6 - 3
src/main/java/org/elasticsearch/indices/fielddata/breaker/InternalCircuitBreakerService.java

@@ -26,6 +26,7 @@ import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.ByteSizeValue;
 import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache;
+import org.elasticsearch.monitor.jvm.JvmInfo;
 import org.elasticsearch.node.settings.NodeSettingsService;
 
 /**
@@ -41,15 +42,17 @@ public class InternalCircuitBreakerService extends AbstractLifecycleComponent<In
 
     public static final double DEFAULT_OVERHEAD_CONSTANT = 1.03;
 
+    private static final long JVM_HEAP_MAX_BYTES = JvmInfo.jvmInfo().getMem().getHeapMax().bytes();
+    private static final long DEFAULT_BREAKER_LIMIT = (long) (0.8 * JVM_HEAP_MAX_BYTES); // 80% of the max heap
+
     private volatile MemoryCircuitBreaker breaker;
     private volatile long maxBytes;
     private volatile double overhead;
 
     @Inject
-    public InternalCircuitBreakerService(Settings settings, NodeSettingsService nodeSettingsService, IndicesFieldDataCache fieldDataCache) {
+    public InternalCircuitBreakerService(Settings settings, NodeSettingsService nodeSettingsService) {
         super(settings);
-        long fieldDataMax = fieldDataCache.computeSizeInBytes();
-        this.maxBytes = settings.getAsBytesSize(CIRCUIT_BREAKER_MAX_BYTES_SETTING, new ByteSizeValue(fieldDataMax)).bytes();
+        this.maxBytes = settings.getAsBytesSize(CIRCUIT_BREAKER_MAX_BYTES_SETTING, new ByteSizeValue(DEFAULT_BREAKER_LIMIT)).bytes();
         this.overhead = settings.getAsDouble(CIRCUIT_BREAKER_OVERHEAD_SETTING, DEFAULT_OVERHEAD_CONSTANT);
 
         this.breaker = new MemoryCircuitBreaker(new ByteSizeValue(maxBytes), overhead, null, logger);