I often get asked to recommend some JVM parameters for people running one (or more) of the Oracle Fusion Middleware 11g products – like BPM, SOA, UCM, WebCenter, etc. on top of WebLogic Server.
Here are my current list of recommended settings and why I like them. I will update this post if I add more.
- -XX:+PrintGCTimeStamps
- -XX:+PrintGCDetails
- -Xloggc:gc.log
These three settings will cause the JVM to print out more detailed information about garbage collection and to produce a log (called gc.log in this example) that contains garbage collection statistics and information that is very useful when trying to do some JVM tuning. - -Xms2048m
- -Xmx2048m
These two settings control the size of the Heap. I like to always make them the same value (2048m in this example – you need to put in the right value for your system, not just copy this one). Making them the same size means the JVM will not spend time trying to work out if it needs to increase the size of the heap. Changing the heap size is a very expensive operation, and if there were a large difference between these two settings, it could happen quite a few times before the heap reaches its maximum size. - -XX:+HeapDumpOnOutOfMemoryError
This one will cause the JVM to take a heap dump if (in a development environment I might say “when”) you get an OutOfMemoryException. This is really useful to work out what caused the problem. If you don’t have this turned on when your JVM crashes, you will need to wait for it to happen again before you can capture some dumps. Having in turned on just in case is a good idea.
For HotSpot only:
- -XX:PermSize=512m
- -XX:MaxPermSize=512m
These two control the size of the Permanent Generation (one of the memory areas used by the HotSpot JVM). Like the heap size, I like to make them the same, for the much the same reason. If you get an OutOfMemory: PermGen error in your log, it is telling you you don’t have enough memory in this space. Again, you need to put in the right value for your system, not just copy this one. - -XX:+UseCompressedOops
Use this setting if you have a 64-bit JVM. This will help to reduce the memory footprint of the JVM.
Pingback: Installing WebLogic Server on Mac OS X | RedStack
Pingback: Setting up the development environment for the Worklist | RedStack
Mark, thanks for the JVM suggestions. Being new to tuning JVM, can you explain in more simpler terms on what you mean by “you need to put in the right value for your system, not just copy this one”? What are the factors needed to decide what vale to use?
Thanks Terry, I planning to post a few more articles on JVM tuning soon. Basically though you need to make sure that the MaxPermSize + Xmx + some memory for the JVM (let’s say a few hundred MB) < the amount of available memory. On older OS's (Windows 95 for example) you may need this to be available continguous memory. If you set these so that the sum is too big, the JVM will refuse to start, so one way to work it out is to start with them set larger than the amount of memory you have, and then scale back until you find the limit. Then watch the performance and see if this is enough/too much/just right – again more to come on this later. Thanks for reading!