If MailArchiva runs out of memory, unpredictable results can occur. For example, the server may stop archiving emails or the JVM under which MailArchiva runs will exit entirely.
When the server behaving erratically, check the debug.log file for OutOfMemory errors. Normally, if there is an OutOfMemory error, the reason is outputted in the debug.log file.
There are three possible causes for the error:
- Not enough heap space is allocated (java.lang.OutOfMemoryError: Heap space)
There may be a large volume of email archive traffic being processed by the server, causing the email archiving server to allocate numerous objects on the heap.
Note: In high volume environments, your server will require more memory than usual.
- Not enough virtual memory (java.lang.OutOfMemoryError: MappedByteBuffer).
This normally indicates that too much Java heap space has been allocated MailArchiva process. MailArchiva is unable to allocate enough virtual memory (memory allocated outside of the virtual environment).
Resolutions
- Heap Space: Increase The Amount of Memory Allocated To MailArchiva
Refer to Memory Settings for instructions on how to allocate more memory to MailArchiva.
- Upgrade Your Email Archive Software To Latest Version
Visit http://www.mailarchiva.com/downloads to download the latest version
- Virtual Memory: Decrease Heap Space
This memory is allocated outside of the JVM environment. Decrease the amount of heap space to between 1/3 and 1/2 of total physical RAM on the machine.
Linux Process Dies (OOMKiller)
The Linux OS may kill the MailArchiva process unexpectedly and unnecessarily, even though MailArchiva memory management is behaving responsibly. When this scenario occurs, the following log entry is found in the Linux kernel logs (run dmesg on the Linux terminal):
[15980693.253164] Killed process 7613 (java) total-vm:63232208kB, anon-rss:13432540kB, file-rss:0kB
Most likely the server is running out of virtual memory. It is not necessary to increase heap size. Either make available more physical memory to the server or enable the swap.
High Memory Usage
The Java virtual machine will tend to use the maximum allowable memory (specified by -xMx parameter on JVM start). This doesn't mean that MailArchiva is using that amount of memory. It is typically using far less (<90MB per instance). It merely means that the JVM garbage collector is not deallocating available memory for performance reasons.
Garbage collection of memory consumes resources. Under normal configuration, the JVM defers the freeing up of memory until it needs to, to ensure that the process is running efficiently. From the Process Viewer, MailArchiva may appear to be using a large amount of memory. This is only because the -xMx parameter specified in the startserver script, told the JVM to go ahead and use a large amount of memory.
To reduce the amount of memory that MailArchiva uses, lower the amount of maximum memory specified as described in Memory Settings.
Found this information useful? Visit mailarchiva.com to learn more about MailArchiva.