Tuning JBoss Application Server
JVM Tuning in JBoss
HotSpot JIT JVM: -server
Memory Allocation: -Xms, -Xmx, -Xss
GC Avoidance
Monitoring: -verbose:gc
Frequency
Minor vs. Full GC
Optimization
GC should run as infrequently and as quickly as possible
Example: -XX:NewSize=80m -XX:MaxNewSize=80m -Xms400m -Xmx400m -XX:+UseParallelGC -XX:ParallelGCThreads=2
Use 64bit Hardware/OS/JVM to be able to allocate over 4GB
Do not use extra large or extra small heaps
Use multi processor/core machine to take advantage of parallel GC
Use Sun’s Java 5 JVM (self-tuning) over 1.4 (or older)
Tuning GC on Java
Tomcat Tuning in JBoss
Tune connectors in server.xml
maxThreads + 25% = max
minSpareThreads + 5% = normal
maxSpareThreads + 5% = peak
Remove unnecessary Valves, Loggers, and Connectors
Precompile JSPs
Turn off "development" mode on jsp handler (servlet) in conf/web.xml
Session timeout
JSPs can be precompiled (by developers or assemblers) using Ant’s jspc task.
RMI Tuning in JBoss
By default JBoss creates a new thread for each RMI request
Wasteful and unscalable during spikes
Switch to pooled invoker
In conf/standardjboss.xml replace all occurrences of :jboss:service=invoker,type=jrmp by jboss:service=invoker,type=pooled
Log4J Tuning - JBoss
System-wide logging set on DEBUG or TRACE can bring JBoss to a standstill
Configured in conf/log4j.xml
By default, JBoss uses INFO priority and logs to both CONSOLE and FILE
Consider changing the <root> priority to ERROR
Consider logging to FILE only
Consider using category filters for your own class hierarchies
<category name="my.package">
<priority value="INFO"/>
</category>
<root>
<priority value="ERROR" />
<appender-ref ref="FILE"/>
</root>
Tuning Other Services
Increase the scan frequency of the deployment scanner (default: 5 secs)
Consider setting MinimumSize on [stateless] Session Bean Container pool (conf/standardjboss.xml)
Use Hibernate in place of CMP (2.x)
Avoid XA connection pools
Use JDBC drivers to check on connections
Desired to gain proficiency on JBOSS?Explore the blog post on JBOSS training to become a pro in JBOSS.
Slimming JBoss
Remove services that are not needed
Not a huge impact on performance
Frees up memory and other resource (like threads)
Faster JBoss startup
Excellent security practice
Breaks Java EE TCK
Create a new configuration set (copy of default)
Services that can be trimmed include the following:
Mail Service (and libraries)
Cache Invalidation Service
J2EE client deployer service
HAR deployer and Hibernate session management services
Hypersonic (provide a different DefaultDS for JMS MQ)
JMS MQ
HTTP Invoker (RMI over HTTP)
Support for XA Data Sources
JMX Console
JMX Invoker Adaptor (JMX calls over RMI)
Web Console
JSR-177 for JMX
Console/Email Monitor Alerts
Properties Service
Scheduler Service/Manager
UUID key generation
EAR Deployer
JMS Queue Destination Manager
CORBA/IIOP Service
Client User Transaction Service
Attribute Persistence Service
RMI Classloader
Remote JNDI Naming
JNDI View
Pooled Invoker
Bean Shell Deployer
For indepth understanding on JBoss click on: