Jboss Performance Tuning Basics 1

Tuning Jboss for performance. Some of the basics will be covered in this Part and Part 2 will go more in depth.

Update Java

If its a new install or an existing application update java to take advantage of any bug fixes and performance improvements that have been made.

Heap

Its generally best practice to set -Xmx and -Xms (the heap) the same. Giving them a ton of memory isn’t always the best thing because it could/will increases stop the world GC pauses. Make sure you leave enough memory for the OS.

GC Logging

Add this to monitor GC pauses. This will give you a log of each pause and how long it lasted so when someone says its slow you can check the log for that time and  see if it was caused by GC.

-verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime

LargePages

Another option that can improve performance by alot is -XX:+UseLargePages. You have to make some changes to the OS for this. http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html

-XX:+UseLargePages

Garbage collection

I have had alot of success using the Concurrent Mark Sweep collector. With Concurrent Mark Sweep collector the more cores the server has the better. If you only have a couple cores look at using one of the other low pause garbage collectors. Few cores with Concurrent Mark Sweep will make it preform worse. I like 12+ cores but if you have little traffic 6+ should work. -XX:+UseConcMarkSweepGC -XX:+UseParNewGC. Whats best for one app may not be best for all apps. Its best to test diffent collectors and setting under a production type load.

If on a VM with few cores you can still use Concurrent Mark Sweep by seting ParallelGCThreads. Default is 1 per core through testing I found 1.5 per core to run best on most hardware.

Monitoring tools

http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html
http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html

Summery

So after the OS changes (for large pages) and java update this is what it would look like all together as a starting point for a server that has 4GB or more of memory.  Remember to check the console log for errors. If for some reason java can’t grab the huge pages Jboss will still start and run but will show a error in console log.

JAVA_OPTS=”-Xmx2G -Xms2G -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime”

 

Books


Java Performance

JBoss AS 7 Configuration, Deployment and Administration

JBoss in Action: Configuring the JBoss Application Server



Leave a Reply

Your email address will not be published. Required fields are marked *

*


*