I am running Jboss 4.0.4 - GA on my production enviroment machine : RHEL 5, 8GB ram, Xeon Quad core processors.
Recently i have been getting the following error when Jboss crashes:
java.lang.OutOfMemoryError: Java heap space
this usually occurs during heavy loads on my application
having googled around, i realized that i have to increase the amount of memory assigned to jboss, my JAVA_OPTS were as follows:
JAVA_OPTS="-server -Xms128m -Xmx512m -XX:PermSize=128M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
I have since adjusted it to :
JAVA_OPTS="-server -Xms512m -Xmx1024m -XX:PermSize=512M -XX:MaxPermSize=1024M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
After running load tests (J-meter), i noted a marked improvement over the old settings (No more crashes), so i tried to increase the XmX settings to be more than 1GB
However after doing so, i was not able to get jboss started at all.
Is this a limitation of the current version of Jboss i am using (4.0.4)? From what i checked there is more than enough memory to be assigned to jboss to go beyond 1G of memory, so i am guessing this could be a limitation of the Jboss i am using.
Any Advice Would be greatly appreciated!,
Jack, welcome to the JBoss forums!
Are you running a 32-bit or 64-bit OS, and if a 64-bit OS, is your JVM 32-bit or 64-bit? With a 32-bit JVM your heap size is usually limited to around 1.5GB to 2.5 GB, depening on the OS you are using and on how the OS is configured.
If you need a larger heap, you will need a 64-bit JVM (which will run only on a 64-bit OS).
Needless to say, this is entirely a JVM issue, the version of JBoss AS has no bearing on this.
Thanks so much for the reply, Currently i am running RHEL5 w/ Jboss 4.0.4-GA, i am pretty sure its only a 32bit operating system
Is there any other way i can squeeze out more memory for the JVM running on my machine?
Installing a 64bit JVM is pretty out of the question as i am running a 32bit O/S as mentioned.
Any ideas on what configurations i can do on my OS to allot greater memory space to the JVM ?
from what I can read you have met memory limitations too early (probably you haven't been able to allocate even 1.6GB).
You should investigate at first what kind of kernel you are running (hint: uname -a) because linux k
kernel 2.6 should be able to allocate at least 2Gb.
If you are running a new kernel (>=2.6) then it's likely that the JVM cannot find a contiguous block of memory to be allocated: in other words the JVM requires a single chunk of memory (not fragmented) at startup.
I'm not an expert sysadmin but maybe setting the linux kernel to use larger pages and allowing the JVM to use it (XX:+UseLargePages) could do the trick....see this article in the section "Linux tuning parameters"
P.s. consider that too large Java Heaps (> 2.5 G) will cause GC pauses to become potentially troublesome.
Hope it helps
Wow, that was very helpful thanks!
I do agree totally that i am hitting the memory limitations too early (that why it baffles me).
The kernel that is currently running on my machine is indeed 2.6 and above.
Prior to this machine i was running a much older machine on a 2.4 Kernel (RH9) and that machine naturally was lower spec-ced and all but it had no such issues what so ever.
I really don't think the a slight increase of users on my application would cause this crash.
The link was very helpful!
Thanks so much!
You should also analyze some heap dumps, they might help you determine where your app is creating or holding on to too many objects. You cna use tools such as jmap (comes with JDK 5), VisualVM (comes with JDK 6 or you can downlaod separately, needs JDK 6 to run but will analyze JDK 5 heaps) or Eclipse MAT. This way you can reduce the memory equirements for your app.