Someone asked me recently, how much memory the JBoss AS 6 consumes after booting. I promised to let them know via my blog. So, here are the answers. To get the numbers, I built the latest AS source, started the AS. Using the jdk jmap and jps tools, I generated a heap dump of the AS.
jmap -dump:format=b,file=oct7_2010.bin 1469
Dumping heap to /work/heapdumps/oct7_2010.bin ...
Heap dump file created
The jps command gives a list of running java processes, so you know which running process id to pass to the jmap command. Jmap will generate the heap dump file. The heap dump contains all of the Java object instances (yes, all data values are included so carefully guard any heapdumps that contain private/senstive information).
Next, we use a memory analysis tool to read the heapdump. I used the Eclipse Memory Analyzer tool, which I ran in standalone mode. Earlier in the AS 6 development (May of 2009), we were consuming 120.4MB after starting the AS (default profile). Since then, we have gotten it down to 77.1MB, which is a good improvement considering the number of features added since then. Just to give some perspective, in May of 2009, 37.5MB was consumed by JMX objects. When I looked today, I only saw 8.6MB of memory used for JMX objects. I'm not yet satisfied but we are improving.
Below are some screens from the memory analyzer tool:
The Eclipse Memory Analyzer tool is also very good at researching all kinds of memory problems. I used it once (in a previous role) to find out why one of the production cluster nodes experienced an out of memory error early in the morning. There was enough context in the generated heap dump, to tell me that a user had pressed an administrative menu option that we neglected to tune the db queries for (need I say more :-) It was a relief to know that the OOM wasn't caused by our normal nightly batch operations.
As always, your help is welcome in making improvements in the JBoss projects. Community developers are often available in IRC to help others learn how to contribute to the JBoss projects.