Skip to content

Lesson 8 of 9 · 23m

Capacity Planning, Disk Watermarks, and Node Roles

Plan around disk, heap, CPU, indexing pressure, and node responsibilities before the cluster enters watermark-driven allocation failure.

Search clusters rarely run out of disk in a clean, linear way. They approach high watermark, allocation stalls, logs fill with shard relocation failures, someone deletes old indexes too late, and then the cluster must rebalance while ingest is still hammering it. Capacity planning is primarily about avoiding that nonlinear collapse.

Watermarks are guardrails, not free space targets

Elasticsearch-style disk watermarks typically look like this conceptually:

low watermark    stop allocating new shards to node
high watermark   try to relocate shards away
flood stage      enforce index read-only blocks

Exact defaults depend on distribution and version. The operational lesson is stable: do not plan to operate near them. If high watermark is 90%, your real capacity target may be 70-75% so relocation, snapshot restore, and sudden growth remain possible.

When flood stage fires, indexes may become read-only:

curl -X PUT 'http://localhost:9200/_all/_settings'   -H 'content-type: application/json' -d '{"index.blocks.read_only_allow_delete": false}'

Only clear blocks after freeing space and understanding why they were imposed. Clearing the block without capacity recovery just re-enters the same failure.

Heap matters, but heap is not the whole budget

A common rule is to cap JVM heap at roughly half of physical memory, often no more than about 26-32 GB depending on compressed object pointer behavior, leaving the rest for the operating system page cache. Search is deeply dependent on page cache for segment files. Giving the JVM everything can starve the filesystem cache and make performance worse.

Heap pressure sources include cluster state, aggregations, field data, indexing buffers, shard metadata, and oversized coordinating requests. GET _cat/nodes is a starting point:

curl -s 'http://localhost:9200/_cat/nodes?v&h=name,node.role,heap.percent,ram.percent,cpu,load_1m,disk.used_percent'

Do not diagnose memory from heap alone. Also inspect GC logs, indexing pressure, circuit breaker trips, and query shapes.

Dedicated roles simplify failure analysis

Small clusters often run every role on every node. Larger clusters benefit from separation:

# conceptual node roles
node.roles: [ master ]
node.roles: [ data_hot ]
node.roles: [ data_warm ]
node.roles: [ data_cold ]
node.roles: [ ingest ]
node.roles: [ coordinating_only ]

Dedicated master nodes reduce the chance that heavy data-node work disrupts cluster management. Coordinating-only nodes can absorb fan-out and aggregation merge cost. Ingest nodes isolate pipelines. This is not mandatory on day one, but role confusion makes capacity incidents hard to reason about.

Estimate storage honestly

Indexing is not the raw JSON size. Include inverted index structures, stored fields, doc values, segment overhead, replicas, translog, merge temporary space, and snapshots held elsewhere. A simple model:

primary indexed size per day  40 GB
replica factor                x2 total copies
retention                     30 days
headroom for merge/relocation x1.3
minimum cluster storage       40 * 2 * 30 * 1.3 = 3.12 TB

Then adjust for compression, mapping choices, _source, field types, and actual measurements. Compression helps, but analysis fields and doc values still cost real bytes.

Field notes

  • Deleting documents does not immediately reclaim space because Lucene segments are immutable; merges eventually reclaim deleted docs.
  • Index deletion is far cheaper operationally than deleting huge numbers of documents by query.
  • Rebalancing consumes IO and network. Capacity recovery can temporarily make performance worse before it gets better.
  • Autoscaling helps only when data lifecycle and shard rules are designed for it; adding nodes cannot fix mapping explosions or runaway query cost.

Was this lesson helpful?

Sign in to rate