Why Wazuh indexer heap size and memory locking decide cluster stability
Many Wazuh indexer nodes run with heap and swap settings that nobody chose on purpose. The default is whatever the package or host gave them, and the problem only shows up later as slow searches, stalled indexing or a node that drops out of the cluster under load. The Wazuh indexer is the full-text search and analytics engine that stores the alerts your team investigates, so its memory behavior affects every dashboard query and every alert written from the Wazuh server. The indexer runs on the Java Virtual Machine, and its JVM heap is the memory region where the engine holds working data structures for indexing and searching. Heap sizing is the first decision, and memory locking is the second, because a heap that the operating system can page out is not really reserved for the indexer.
The common planning rule is to give the heap about half of the node's RAM, leave the rest for the operating system and the Lucene file cache that speeds up searches, and set the minimum and maximum heap sizes to the same value so the JVM does not resize the heap while the node is busy. Swapping is the reason this matters. When the kernel moves heap pages to disk, a search or indexing request that touches those pages waits on disk I/O, and latency climbs in ways that look like cluster problems rather than memory problems. Teams usually need this review when they add a node, move a node to larger RAM, or see indexing slow down or nodes leave the cluster without an obvious cause. Confirm the heap and lock settings on every node, since mixed configurations are a common source of uneven behavior. The exact configuration keys, file locations and limits for your Wazuh release should be checked against the Wazuh documentation for your installed version before you change anything.
Heap and memory lock options and when each fits
This table compares the main heap sizing and memory locking choices for the Wazuh indexer, with the fit, risk and verification step for each. Read each row against your host layout, then confirm the chosen settings on every indexer node before you rely on them.
| Option | When it fits | Risk | What to verify |
|---|---|---|---|
| Heap at half of RAM, minimum equal to maximum | Dedicated indexer nodes where the operating system and page cache have their own memory | Too large a heap leaves the operating system short of memory for file caching, and too small a heap slows indexing and searches | Heap settings in the JVM options file match on every node, and the value sits near half of the physical memory the node actually has |
| Smaller heap on shared hosts | Single-node lab systems or hosts that also run the Wazuh server or dashboard | Lower heap means less room for indexing and queries, so large searches may fail or slow down under load | Other services leave enough free memory, and the dashboard stays responsive during a heavy query |
| Heap set above half of RAM | Rarely justified, only after testing on your own data and workload | The host can run out of memory for non-heap use and the process may be stopped by the operating system | Confirm the reason in writing and check memory use under peak indexing and search load |
| Disable swap entirely | Dedicated indexer hosts where swapping would slow the node badly and memory is sized for the workload | Without swap, memory exhaustion can end a process abruptly instead of slowing it down | No swap partition or swap file is active, and the host has monitoring that alerts on memory pressure |
| Limit swappiness on hosts that keep swap | Hosts where swap is needed for other services or the operating system policy requires it | The kernel may still swap some heap pages, which causes long garbage collection pauses and slow queries | The kernel setting is applied, persists across reboots, and the indexer node shows no swapping in host metrics |
| Memory locking enabled | Production indexer nodes where heap memory should stay in RAM and not be paged out | Locking needs higher memory lock limits in systemd, and a missing limit can stop the node from starting or leave locking inactive | The memory lock setting is on in the indexer configuration, the service unit allows the lock limit, and the node reports that memory locking is active |
| Memory locking disabled | Test environments or hosts where the lock limit cannot be raised under your change policy | Heap pages may be swapped out, which degrades performance without an obvious error | Swap is disabled or tightly limited as a compensating control, and the decision is recorded with the host owner |
How to set the heap and confirm mlockall is active
This sequence sets a fixed JVM heap on a dedicated Wazuh indexer node, enables memory locking, and raises the systemd limit so the indexer can keep its heap out of swap. Each step ends with a check so you know the setting took effect.
Confirm RAM and that the host is dedicated
Before changing anything, record the total physical RAM on the node with a command such as
free -hand confirm the host runs only the Wazuh indexer. Check for other heavy services withpsor your configuration management inventory. The output is a written figure for total RAM and a list of co-resident services. If anything other than the indexer shares the host, stop here and decide with the owner whether to move it, because the heap sizing in the next step assumes the indexer has the machine to itself.Set equal minimum and maximum heap values
Edit the JVM options file for the indexer, usually named
jvm.optionsor a file underjvm.options.d/, and set-Xmsand-Xmxto the same value. Follow the heap guidance in the Wazuh and OpenSearch-based indexer documentation for your version, which generally places the heap at about half of RAM and below the JVM's compressed object pointer threshold. Confirm the exact path for your installation method, since package, Docker and Kubernetes deployments place these files differently. Check: the file contains one-Xmsline and one-Xmxline with identical values, and nothing else in the configuration overrides them.Enable bootstrap memory locking in indexer configuration
In the indexer configuration file, usually
opensearch.ymlor the equivalent file for your deployment, set the bootstrap memory lock option to true so the JVM requests that its heap be locked into physical memory at startup. Confirm the exact file name and key for your version in the indexer documentation before editing. Check: the key is present once, is set to true, and is not commented out. A later startup log line will confirm whether the lock succeeded.Raise the memory lock limit in the systemd override
Locking a large heap fails if the service is allowed to lock less memory than the heap requires. Create a systemd drop-in with
systemctl editfor the indexer service, then setLimitMEMLOCKtoinfinityin the[Service]section, as the indexer documentation describes for your version. Save the file, runsystemctl daemon-reload, and check withsystemctl show <indexer-service> -p LimitMEMLOCK. The expected output is the limit you set. If the value is still the default, the override is not being loaded.Restart the indexer service
Restart the indexer service on this node only, so the cluster can recover the shard allocation before the next node is changed. Watch the service status and journal until the node reports as started and joins the cluster. Check: the service is active and the journal does not show an out-of-memory or bootstrap failure. If you run a multi-node cluster, confirm the cluster health returns to its previous state before you repeat these steps on the next node.
Verify that memory locking is active
Confirm the lock in two places. First, check the startup log for a message that memory locking succeeded, or a warning that it failed, which the indexer writes when bootstrap memory locking is enabled. Second, query the node stats API for the node and review the memory fields, or confirm the process limits with
grep Locked /proc/<pid>/status. The check passes when the log reports a successful lock and the process shows locked memory close to the heap size. If the log reports a failure, return to the systemd limit and the file ownership before you change the heap value again.
Operational risks to plan for around heap and swap changes
Changing the indexer heap or swap policy affects every node that holds shards, so the risks are mostly about sequence and consistency. The cards below cover the operational steps that keep the cluster available and make the change reviewable afterward.
Restart nodes in a rolling order
Each heap change needs a node restart, and restarting several data nodes at once can leave shards unassigned. Restart one node at a time, wait for the cluster to return to a healthy state, then move to the next. Confirm the cluster health and shard allocation before each step, and agree the order with the team that owns the cluster before the window opens.
Keep heap within host memory
A heap setting larger than the memory left after the operating system, file cache and other processes can trigger the Linux OOM killer, which stops the indexer process without a clean shutdown. Compare the configured heap with total host memory on every node, including nodes that were sized differently when first built. Treat any mismatch as a blocker until it is corrected.
Apply one swap policy across nodes
If some indexer nodes swap and others do not, latency and garbage collection behavior will differ between nodes, and the cluster will look uneven in monitoring. Set the same swap policy and memory lock settings on every node in the cluster, and record any exception with its reason. Check the policy again after kernel or image updates, since those can change defaults.
Watch heap and garbage collection
After a change, watch heap usage and garbage collection activity on each node for long enough to see normal indexing and search load, not just the first minutes after restart. Frequent or long collection pauses can point to a heap that is too small or too large for the data on that node. Ask your team which dashboards or API outputs will show these values before the change, so the review uses agreed signals.
Record settings in configuration management
Heap size, memory lock and systemd limits set by hand on one node are easy to lose when a node is rebuilt or a new node joins. Put the values in the same configuration management code that installs the indexer, with a comment that explains the sizing basis. Review that code whenever the host memory or cluster size changes, so the recorded state matches what runs on each node.
Verifying memory locking and heap behavior after a change
Confirm that memory locking is active and that the heap behaves as planned on every indexer node before you treat the change as finished. Start by checking that the memory lock setting reports as active on each node, using the node-level information the indexer exposes through its API. Run the check on every node, not only the one you edited, because a single node that missed the systemd limit change will still start and look healthy while swapping under load. If a node reports the lock as inactive, stop and fix the systemd limits and the jvm.options file on that host before restarting anything else.
Next, confirm that heap usage stays inside the bounds you set. Watch the JVM heap figures per node while the cluster handles normal indexing and dashboard searches, and compare them with the minimum and maximum values in the jvm.options file. Heap usage that sits close to the maximum for long periods, or that climbs steadily without falling back after garbage collection, is a sign that the heap is undersized for the shard count or query pattern, and that is a planning question to revisit with the shard and replica design rather than a reason to raise the heap without limit. Check the garbage collection logs as well, since frequent long pauses can show up in the logs before they appear in dashboard latency.
Finally, watch the host for swap activity. A locked heap should not be swapped, so any swap-in or swap-out activity on an indexer host after the change points to a gap in the setup, such as a missed limit or a process that is not picking up the new settings. Record a baseline before the change: the lock status per node, heap usage under a representative load, and swap activity on each host over a normal working period. Repeat the same checks after each node restart and after any change to memory on the host. Ask your indexer administrators to confirm the exact setting names and expected output for your installed version, since those details should come from the Wazuh documentation for that release.
Questions teams ask about indexer heap and memory locking
Can our team change the Wazuh indexer heap and memory lock settings ourselves?
Yes, many teams can, provided they have administrative access to every indexer node and a way to restart nodes one at a time. The change itself is small: set the heap in the JVM options file, configure memory locking, and adjust the systemd limits. The effort comes from checking each node, confirming the cluster stays healthy during restarts and recording the change under your own change control. Teams without an experienced Linux or Elasticsearch-style operator, or with many nodes and tight maintenance windows, often ask a partner to plan the sequence and verify the result. Confirm your own skills and approval path before deciding.
What drives the effort of changing indexer memory settings?
The main drivers are the number of indexer nodes, whether those nodes share hosts with other components, whether the cluster already has outages or unassigned shards, and how strict your change control is. Each node needs its own check, so effort grows with node count. Shared hosts add risk because the heap and locked memory compete with other workloads, which may force a sizing review. An unhealthy cluster must be stabilized before any restart. Ask any partner for a quote that lists the node count, host layout, change approval steps and verification tasks, since a fixed-scope quote depends on that written scope.
Does changing the heap size or memory locking require downtime?
The change is normally made one node at a time with a restart of each node, so the cluster can stay available if it is healthy and has enough replicas to cover the node being restarted. Whether you see any interruption depends on the cluster's current state, replica settings and how fast each node rejoins. Confirm the exact restart and rejoin behavior against the Wazuh documentation for your version, and test the sequence on a non-production cluster first. Plan a maintenance window anyway for the first change, so that a slow rejoin does not affect alert search or ingestion at a bad moment.
What do we need to provide for this work?
You need administrative access to each indexer host, the ability to restart services, and a current inventory of the nodes and their memory. You also need an agreed maintenance window, a rollback plan, and access to a test cluster that resembles production as closely as practical. Share the current cluster health, shard allocation and any known outages before work begins. Record who approves changes and how evidence is captured. These inputs determine how many checks are needed and how long each step takes, so they should appear in the written scope.
How do heap and memory locking relate to shard and hot-warm planning?
Heap size limits how much cluster state, field data and query work each node can handle, so it affects how many shards a node can serve comfortably. A node with too little heap may struggle with a large shard count, which pushes teams to plan shards and replicas together with memory. Hot-warm tiers change the picture because warm nodes often run on cheaper hardware with different memory. Set the heap per node class after you decide the shard layout and tier design, then revisit it when either changes. Treat these topics as one sizing exercise rather than three separate tasks.
What would a partner deliver for heap and memory locking work?
A partner working under a written scope would typically deliver a sizing review for each node, the configuration changes, the systemd limit changes, a documented restart sequence, and evidence that memory locking is active on every node. Verification would show the configured heap and locked memory state after the change, plus cluster health before and after. Deliverables should also include a rollback procedure and a short runbook for your team. The exact list, timelines and effort depend on your node count and environment, so request a quote tied to a written scope.
How heap, memory lock and host RAM fit together
The diagram starts with the host's physical RAM, which is shared by the operating system page cache, the Wazuh indexer JVM heap and other processes on the same host. The heap is fixed in size, and systemd memory lock limits must allow the indexer process to lock that heap in memory through mlockall. The last step is to check the indexer logs and node settings to confirm that memory locking is active. If any step fails, the indexer can swap, which slows searches and indexing.
Host RAM divides into heap, page cache and other processes, with memory locking checked at the end.
How DeployOpen scopes indexer memory work
DeployOpen treats heap sizing and memory locking on the Wazuh indexer as a scoped change to a running system, not a one-line edit. The work runs inside your own infrastructure, in your cloud accounts, data center or air-gapped network, and the first step is agreeing in writing which indexer nodes are in scope, which platform and operations teams own them, and who approves the change window. The written scope names the JVM heap settings to change, the systemd unit or override files that set memory lock limits, the nodes and their current RAM and swap configuration, and the verification evidence the client will receive. Most engagements of this kind are fixed-scope, so the deliverables and the boundaries of the work are settled before anyone touches a node, and a quote follows from that written scope rather than from a standard price list.
Before any change is made, DeployOpen asks for a non-production Wazuh indexer cluster where one is available, so the heap value, the memory lock setting and the service restart can be rehearsed against a cluster with a similar node layout. Where no non-production cluster exists, the scope says so and the change plan includes a rollback path and a node-by-node sequence that keeps the cluster healthy while each node restarts. The cost drivers are the number of nodes, how much of the change must be coordinated with your change advisory process, and how many environments must be covered. Your team should confirm the exact effort and duration with the partner in that written scope, since no fixed figure applies across environments.
The closing deliverable is documentation. DeployOpen records the final heap settings per node, the systemd limits applied, the swap configuration, and the output that shows the memory lock is active after restart, together with the configuration files changed and the rollback steps. That record is what your security, compliance and platform teams review later, and it is also what your team needs when the next Wazuh upgrade or node addition changes the memory profile. Ask any partner for a sample of this evidence before signing, and confirm which items you will own after handover, including who maintains the override files and who re-checks memory settings after each patch release listed in the Wazuh release notes.
How DeployOpen works on this
DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, including the Wazuh indexer. For heap sizing and memory locking, we start from your host memory, the other services sharing those hosts, and how the indexer is verified after each change.
How we scope
- Inventory each indexer node's RAM, swap configuration and co-located services before choosing a heap size.
- Agree in writing which nodes, JVM settings, systemd overrides and verification checks the engagement covers.
- Confirm who owns change windows, rollback steps and restarts for each indexer node in your environment.
How we build
- Set the heap in the indexer JVM options file so minimum and maximum values match on every node.
- Apply the systemd memory lock limit override and confirm the indexer starts with memory locking enabled.
- Test node restarts one at a time and record the cluster health and memory state before and after each change.
How we hand over
- Document the chosen heap size, the reasoning for it and the host memory assumptions behind it.
- Provide a verification runbook showing how your team checks that mlockall is active after restarts and upgrades.
- Walk your operations team through the configuration files, the rollback procedure and the points where memory changes need review.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial engagement.
- Recheck heap and memory locking settings when Wazuh patch releases or host changes affect the indexer.
- Review memory pressure and swap behavior with your team as node count, index volume or retention changes.

