The other day I ran into a problem while trying to enable Mule to use more than 4GB of memory despite being on 64-bit hardware and OS. It was a bit of a pain to figure out since a few key steps aren’t intuitive.
First, the Mule installation is at:
/usr/java/apps/mule-standalone-2.2.1
All commands below are provided relative to this base directory.
The top of ./conf/wrapper.conf should look like this:
#********************************************************************
# System Properties
#********************************************************************
# Location of your Mule installation.
wrapper.java.additional.1=-Dmule.home="%MULE_HOME%"
wrapper.java.additional.1.stripquotes=TRUE
wrapper.java.additional.2=-Dmule.base="%MULE_BASE%"
wrapper.java.additional.2.stripquotes=TRUE
wrapper.java.additional.3=-server
wrapper.java.additional.4=-XX:MaxPermSize=512m
wrapper.java.additional.5=-XX:+CMSPermGenSweepingEnabled
wrapper.java.additional.6=-XX:+CMSClassUnloadingEnabled
wrapper.java.additional.7=-Xmx35840m
Next scroll down to find a line similar to the following. Ensure that it’s set to 0
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=0
At this point, I restarted Mule and assumed that all would work well, but that didn’t turn it to be the case. Unfortunately, Mule still defaults to the 32-bit wrapper and only uses 4GB of addressable memory despite more being available. In order to fix this you need to disable the 32-bit wrapper by executing:
chmod a-x ./lib/boot/exec/wrapper-linux-x86-32
Now restart Mule and confirm that the new changes have taken effect by executing:
ps aux | grep mule
From the results, look for the items that are in red color below.
root 24917 0.2 0.0 17024 784 ? Sl 18:00 0:09
/usr/java/apps/mule-standalone-2.2.1/lib/boot/exec/wrapper-linux-x86-64
/usr/java/apps/mule-standalone-2.2.1/conf/wrapper.conf
wrapper.syslog.ident=mule wrapper.pidfile=...
root 24919 96.2 58.6 39278964 14500884 ? Sl 18:00 60:53
java -Dmule.home=/usr/java/apps/mule-standalone-2.2.1
-Dmule.base=/usr/java/apps/mule-standalone-2.2.1 -server
-XX:MaxPermSize=512m -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled -Xmx35840m -Djava.endorsed.dirs=...