Indexing Buffer Size: Refine default setting to 10% (from 40%) and add more settings, closes #334.

This commit is contained in:
kimchy 2010-08-24 18:12:45 +03:00
parent 7ae8d4c669
commit 49b4659322
1 changed files with 17 additions and 5 deletions

View File

@ -49,13 +49,25 @@ public class IndexingMemoryBufferController extends AbstractComponent {
super(settings); super(settings);
this.indicesService = indicesService; this.indicesService = indicesService;
String indexingBuffer = componentSettings.get("index_buffer_size", "40%"); ByteSizeValue indexingBuffer;
if (indexingBuffer.endsWith("%")) { String indexingBufferSetting = componentSettings.get("index_buffer_size", "10%");
double percent = Double.parseDouble(indexingBuffer.substring(0, indexingBuffer.length() - 1)); if (indexingBufferSetting.endsWith("%")) {
this.indexingBuffer = new ByteSizeValue((long) (((double) JvmInfo.jvmInfo().mem().heapMax().bytes()) * (percent / 100))); double percent = Double.parseDouble(indexingBufferSetting.substring(0, indexingBufferSetting.length() - 1));
} else { indexingBuffer = new ByteSizeValue((long) (((double) JvmInfo.jvmInfo().mem().heapMax().bytes()) * (percent / 100)));
this.indexingBuffer = ByteSizeValue.parseBytesSizeValue(indexingBuffer, null); ByteSizeValue minIndexingBuffer = componentSettings.getAsBytesSize("min_index_buffer_size", new ByteSizeValue(48, ByteSizeUnit.MB));
ByteSizeValue maxIndexingBuffer = componentSettings.getAsBytesSize("max_index_buffer_size", null);
if (indexingBuffer.bytes() < minIndexingBuffer.bytes()) {
indexingBuffer = minIndexingBuffer;
} }
if (maxIndexingBuffer != null && indexingBuffer.bytes() > maxIndexingBuffer.bytes()) {
indexingBuffer = maxIndexingBuffer;
}
} else {
indexingBuffer = ByteSizeValue.parseBytesSizeValue(indexingBufferSetting, null);
}
this.indexingBuffer = indexingBuffer;
this.minShardIndexBufferSize = componentSettings.getAsBytesSize("min_shard_index_buffer_size", new ByteSizeValue(4, ByteSizeUnit.MB)); this.minShardIndexBufferSize = componentSettings.getAsBytesSize("min_shard_index_buffer_size", new ByteSizeValue(4, ByteSizeUnit.MB));
logger.debug("using index_buffer_size [{}], with min_shard_index_buffer_size [{}]", this.indexingBuffer, this.minShardIndexBufferSize); logger.debug("using index_buffer_size [{}], with min_shard_index_buffer_size [{}]", this.indexingBuffer, this.minShardIndexBufferSize);