HiveMQ is a performance optimised Java application and as such we strongly recommend running HiveMQ on dedicated machines or containers and allowing the HiveMQ process unrestricted access to all available system memory.
To optimise performance we recommend increasing the default heap allocation (1/4) in the JVM.
It is necessary to leave a reasonable amount of system memory for off-heap usage like I/O operations, NativeSSL sessions or TCP socket management.
Best practises are to allocate the following percentages of available system memory as the heap-size for the HiveMQ process:
HiveMQ 3.4.x | 66% |
---|---|
HiveMQ 4.2.x | 66% |
since HiveMQ 4.3.x | 50% |
Due to diminishing return effects and potential for very long garbage collection times we do not recommend the use of more than 32 GB heap-size for any HiveMQ deployment.
Why the change with HiveMQ 4.3?
HiveMQ introduces a new file persistence in version 4.3. This file persistence comes with a significant performance improvement at the cost slightly more off-heap memory requirements.
To ensure system stability, we therefore strongly suggest not using more than 50% of the available system memory to guarantee necessary memory availability at all times.
See our HiveMQ User Guide for details on how to set the heap-size.
We recommend allocating identical values for initial (-Xms) and maximum (-Xmx) heap allocation.