Briefly, this error occurs when the Elasticsearch Java Virtual Machine (JVM) is swapped out due to insufficient memory. This can degrade the performance of Elasticsearch. To resolve this issue, you can disable swapping by setting bootstrap.memory_lock to true in the Elasticsearch configuration file. Alternatively, you can increase the system’s RAM or adjust the JVM heap size to ensure it has enough memory to operate efficiently. Also, ensure that the Elasticsearch process has the necessary permissions to lock the memory.
This guide will help you check for common problems that cause the log ” This can result in part of the JVM being swapped out. ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: bootstrap.
Log Context
Log “This can result in part of the JVM being swapped out.” classname is JNANatives.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
return; } // mlockall failed for some reason logger.warn("Unable to lock JVM Memory: error={}; reason={}"; errno; errMsg); logger.warn("This can result in part of the JVM being swapped out."); if (errno == JNACLibrary.ENOMEM) { if (rlimitSuccess) { logger.warn( "Increase RLIMIT_MEMLOCK; soft limit: {}; hard limit: {}"; rlimitToString(softLimit);