| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | [[index-modules-indexing-pressure]]== Indexing pressureIndexing documents into {es} introduces system load in the form of memory andCPU load. Each indexing operation includes coordinating, primary, and replicastages. These stages can be performed across multiple nodes in a cluster.Indexing pressure can build up through external operations, such as indexingrequests, or internal mechanisms, such as recoveries and {ccr}. If too muchindexing work is introduced into the system, the cluster can become saturated.This can adversely impact other operations, such as search, clustercoordination, and background processing.To prevent these issues, {es} internally monitors indexing load. When the loadexceeds certain limits, new indexing work is rejected[discrete][[indexing-stages]]=== Indexing stagesExternal indexing operations go through three stages: coordinating, primary, andreplica. See <<basic-write-model>>.[discrete][[memory-limits]]=== Memory limitsThe `indexing_pressure.memory.limit` node setting restricts the number of bytesavailable for outstanding indexing requests. This setting defaults to 10% ofthe heap.At the beginning of each indexing stage, {es} accounts for thebytes consumed by an indexing request. This accounting is only released at theend of the indexing stage. This means that upstream stages will account for therequest overheard until all downstream stages are complete. For example, thecoordinating request will remain accounted for until primary and replicastages are complete. The primary request will remain accounted for until eachin-sync replica has responded to enable replica retries if necessary.A node will start rejecting new indexing work at the coordinating or primarystage when the number of outstanding coordinating, primary, and replica indexingbytes exceeds the configured limit.A node will start rejecting new indexing work at the replica stage when thenumber of outstanding replica indexing bytes exceeds 1.5x the configured limit.This design means that as indexing pressure builds on nodes, they will naturallystop accepting coordinating and primary work in favor of outstanding replicawork.The `indexing_pressure.memory.limit` setting's 10% default limit is generouslysized. You should only change it after careful consideration. Only indexingrequests contribute to this limit. This means there is additional indexingoverhead (buffers, listeners, etc) which also require heap space. Othercomponents of {es} also require memory. Setting this limit too high can denyoperating memory to other operations and components.[discrete][[indexing-pressure-monitoring]]=== MonitoringYou can use the<<cluster-nodes-stats-api-response-body-indexing-pressure,node stats API>> toretrieve indexing pressure metrics.[discrete][[indexing-pressure-settings]]=== Indexing pressure settings`indexing_pressure.memory.limit`::  Number of outstanding bytes that may be consumed by indexing requests. When  this limit is reached or exceeded, the node will reject new coordinating and  primary operations. When replica operations consume 1.5x this limit, the node  will reject new replica operations. Defaults to 10% of the heap.
 |