Package org.elasticsearch.indices
Class IndexingMemoryController
- java.lang.Object
-
- org.elasticsearch.indices.IndexingMemoryController
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,IndexingOperationListener
public class IndexingMemoryController extends java.lang.Object implements IndexingOperationListener, java.io.Closeable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.index.shard.IndexingOperationListener
IndexingOperationListener.CompositeListener
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<ByteSizeValue>
INDEX_BUFFER_SIZE_SETTING
How much heap (% or bytes) we will share across all actively indexing shards on this node (default: 10%).static Setting<ByteSizeValue>
MAX_INDEX_BUFFER_SIZE_SETTING
Only applies whenindices.memory.index_buffer_size
is a %, to set a ceiling on the actual size in bytes (default: not set).static Setting<ByteSizeValue>
MIN_INDEX_BUFFER_SIZE_SETTING
Only applies whenindices.memory.index_buffer_size
is a %, to set a floor on the actual size in bytes (default: 48 MB).static Setting<TimeValue>
SHARD_INACTIVE_TIME_SETTING
If we see no indexing operations after this much time for a given shard, we consider that shard inactive (default: 5 minutes).static Setting<TimeValue>
SHARD_MEMORY_INTERVAL_TIME_SETTING
How frequently we check indexing memory usage (default: 5 seconds).
-
Method Summary
Modifier and Type Method Description protected void
activateThrottling(IndexShard shard)
Asks this shard to throttle indexing to one threadprotected java.util.List<IndexShard>
availableShards()
protected void
checkIdle(IndexShard shard, long inactiveTimeNS)
ask this shard to check now whether it is inactive, and reduces its indexing buffer if so.void
close()
protected void
deactivateThrottling(IndexShard shard)
Asks this shard to stop throttling indexing to one threadprotected long
getIndexBufferRAMBytesUsed(IndexShard shard)
returns how much heap this shard is using for its indexing bufferprotected long
getShardWritingBytes(IndexShard shard)
returns how many bytes this shard is currently writing to diskvoid
postDelete(ShardId shardId, Engine.Delete delete, Engine.DeleteResult result)
Called after the delete operation occurred.void
postIndex(ShardId shardId, Engine.Index index, Engine.IndexResult result)
Called after the indexing operation occurred.protected Scheduler.Cancellable
scheduleTask(ThreadPool threadPool)
protected void
writeIndexingBufferAsync(IndexShard shard)
ask this shard to refresh, in the background, to free up heap-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.index.shard.IndexingOperationListener
postDelete, postIndex, preDelete, preIndex
-
-
-
-
Field Detail
-
INDEX_BUFFER_SIZE_SETTING
public static final Setting<ByteSizeValue> INDEX_BUFFER_SIZE_SETTING
How much heap (% or bytes) we will share across all actively indexing shards on this node (default: 10%).
-
MIN_INDEX_BUFFER_SIZE_SETTING
public static final Setting<ByteSizeValue> MIN_INDEX_BUFFER_SIZE_SETTING
Only applies whenindices.memory.index_buffer_size
is a %, to set a floor on the actual size in bytes (default: 48 MB).
-
MAX_INDEX_BUFFER_SIZE_SETTING
public static final Setting<ByteSizeValue> MAX_INDEX_BUFFER_SIZE_SETTING
Only applies whenindices.memory.index_buffer_size
is a %, to set a ceiling on the actual size in bytes (default: not set).
-
SHARD_INACTIVE_TIME_SETTING
public static final Setting<TimeValue> SHARD_INACTIVE_TIME_SETTING
If we see no indexing operations after this much time for a given shard, we consider that shard inactive (default: 5 minutes).
-
-
Method Detail
-
scheduleTask
protected Scheduler.Cancellable scheduleTask(ThreadPool threadPool)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
availableShards
protected java.util.List<IndexShard> availableShards()
-
getIndexBufferRAMBytesUsed
protected long getIndexBufferRAMBytesUsed(IndexShard shard)
returns how much heap this shard is using for its indexing buffer
-
getShardWritingBytes
protected long getShardWritingBytes(IndexShard shard)
returns how many bytes this shard is currently writing to disk
-
writeIndexingBufferAsync
protected void writeIndexingBufferAsync(IndexShard shard)
ask this shard to refresh, in the background, to free up heap
-
activateThrottling
protected void activateThrottling(IndexShard shard)
Asks this shard to throttle indexing to one thread
-
deactivateThrottling
protected void deactivateThrottling(IndexShard shard)
Asks this shard to stop throttling indexing to one thread
-
postIndex
public void postIndex(ShardId shardId, Engine.Index index, Engine.IndexResult result)
Description copied from interface:IndexingOperationListener
Called after the indexing operation occurred. Note that this is also called when indexing a document did not succeed due to document related failures. SeeIndexingOperationListener.postIndex(ShardId, Engine.Index, Exception)
for engine level failures- Specified by:
postIndex
in interfaceIndexingOperationListener
-
postDelete
public void postDelete(ShardId shardId, Engine.Delete delete, Engine.DeleteResult result)
Description copied from interface:IndexingOperationListener
Called after the delete operation occurred. Note that this is also called when deleting a document did not succeed due to document related failures. SeeIndexingOperationListener.postDelete(ShardId, Engine.Delete, Exception)
for engine level failures- Specified by:
postDelete
in interfaceIndexingOperationListener
-
checkIdle
protected void checkIdle(IndexShard shard, long inactiveTimeNS)
ask this shard to check now whether it is inactive, and reduces its indexing buffer if so.
-
-