Avoiding Elasticsearch Memory Swapping
BigData Training Architect II in Content
Most operating systems try to use as much memory as possible for file system caching. This causes application memory to be eagerly swapped out which can result in parts of the Java Virtual Machine (JVM) heap being swapped to disk. For Elasticsearch, swapping is catastrophic for node stability and performance. It is actually more effective for the cluster to let the operating system kill the node than to let it continue in the event of the heap being swapped out. Disabling swap files or reducing the swappiness of the Linux systems can avoid Elasticsearch memory swapping, however there is a way to allow the system to swap all but Elasticsearch's heap using
mlockall. This learning activity gives you the opportunity to bootstrap Elasticsearch with memory locking in order to avoid swapping Elasticsearch's heap, while still allowing the host to use swap for other things.