Swap Space Requirements
26 July 2022 05:43 PM


It is important to have swap space configured on local disk as recommended on the computers in which MarkLogic runs. The general recommendation(as a minimum) is 2x physical memory allocated for swap, although that can be relaxed for Linux systems (see below).  While a properly configured MarkLogic Server installation should not need to use swap space during normal operations, the swap space is still important so that the operating system can allocate very large chunks of memory.  Even though it might seem counter-intuitive, having swap space configured appropriately actually allows the computer to run more efficiently by not needing to use its swap space.  When MarkLogic asks the operating system for a large chunk of memory (for example, when performing a large search), if there is not enough swap space available, then the operating system will have to use the swap space before it can allocate the memory, causing slow performance and possible search failures with SVC-MALLOC 'out of memory' errors. 


On Linux systems, the minimum swap space size should be set to 1x the size of RAM (if the node hosting ML has less than 32GB of RAM) or 32 GB (if the node has 32GB or more of RAM). If you have Huge Pages set up on a Linux system, the minimum swap space size on that machine should be equal to the size of your physical memory minus the size of your Huge Pages (because Linux Huge Pages are not swapped), or 32GB, whichever is lower.  For more information about huge pages, see Linux Huge Pages.

Another reason for configuring sufficient swap on a Unix system is to insure that the MarkLogic process is not killed by the OOM (Out Of Memory) killer.  Since the MarkLogic task will be the largest on the server, the OOM task will kill MarkLogic if the system runs out of memory.  In the event that the server has an issue causing it to thrash, having the recommended amount of swap space will allow for a more graceful shutdown.


For Windows systems we recommend configuring the server to use 2x physical memory. However, Windows systems are normally set up to grow the swap (page) file as needed. 


For Solaris we recommend configuring the system to use 2x physical memory.

The reason for configuring 2x swap on a Solaris system is because the system calls used by MarkLogic to execute converter programs and to process fatal signals (in order to get stack traces) requires an enough swap space to exist in order to mirror the existing MarkLogic process space.  That space is not used, but the space needs to be available in order to allocate the memory. 

Additional Reading

Knowledgebase: Memory Consumption Logging and Status 

Knowledgebase: RAMblings - Opinions on Scaling Memory in MarkLogic Server 

(7 vote(s))
Not helpful

Comments (0)