Jboss Enterprise Application Platform: Troubleshooting Guide
Jboss Enterprise Application Platform: Troubleshooting Guide
Contents
1. Common Diagnostic Tools for Troubleshooting
..................2
1.1 Shell Commands for Linux/Unix Users.............................2
1.2 Tools in Java Standard Edition..............................................3
1.3 Tools available with JBoss EAP.............................................5
1.3.1 JMX-Console.........................................................................5
1.3.2 JBoss Operations Network.............................................5
2. Troubleshooting Systems bottleneck........................................6
2.1 CPU....................................................................................................6
2.1.1 Under utilization.................................................................6
2.1.2 High utilization....................................................................6
2.2 Disk IO.............................................................................................7
2.3 OutOfMemory Errors.................................................................8
3. Troubleshooting Application Server...........................................9
3.1 Troubleshooting Classloading..............................................9
3.2 JBoss AS Thread Pool................................................................9
3.3 Database Connection Pooling.............................................11
3.4 Clustering....................................................................................12
3.5 JBoss Messaging.......................................................................13
4. References...........................................................................................15
5. Feedback .............................................................................................15
The upper section describes the statistics about the machine, including Tasks,
CPU, Memory and Swaps, in real time. The lower section provides information
on per-process basis. For example you can see that there is one java process
with PID 6707 run by the user somil which is using 13.6 percent of the memory
and 0.3 percent of the CPU cycles
We will see later in the document how we can use these shell commands in
troubleshooting issues that we see with Java EE application deployed in JBoss
Enterprise Application Platform.
JConsole can be used to observe information about an application running on the Java
platform.Some of the core monitoring and management functionalities provided by the
JConsole includes
• Detect low memory
• Enable or disable GC and class loading verbose tracing
• Deadlocks detection
• Control the log level in an application
bash-4.0$ vmstat
procs -----------memory---------- ----swap--- ---io----system-----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1700600 239956 753072 0 0 6 4 70 85 35 55 5 0 0
In this case CPU is busy (90% ) but it does not necessarily mean that there is a
system bottleneck. It may rather indicate that its running in optimal state.
One should be concerned if the run queue (r value under procs column) is more
that the number of CPUs on the machine. For example below is the out from
vmstat command
In this case the CPU utilization is high (which may or may not be an issue), but
at the same time the value of r under the procs column is 5 which exceeds the
number of CPUs on the machine which confirms that there is CPU constraint .
You can further examine the cpu column to determine where its spending most
of its cycles. In this example CPU is spending 60% of its cycles in performing
system calls as reflected by sy value under cpu column. This may be because
the application may be executing lots of input/output , sockets or timestamp
creation. For example there may be a class thats opening socket for each
request, using a pooled approach may solve the problem, another example can
be a class performing lots of input/output , using buffered approach can solve
the problem.
In multi CPU machine there might be a case where one of the CPU is
experiencing high utilization. It may be caused by if single thread is used to
manage some resources. You can check the garbage collection, make sure its
configured properly and then you should verify if there is any contention for
some resources.
2.2. Disk IO
Generally reading and writing to a disk can be slow and may result in frequent
bottleneck for enterprise application. In Linux (RHEL/Fedora) you can use iostat
command to get input/output statistics. For example below is the output of
iostat command
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.13 0.86 0.46 0.29 11.10 9.21 26.97 0.03 39.58 2.20 0.17
• Most modern Java virtual machines segments the memory heap into
generations. Your virtual machine may complain about lack of memory
when it has only exhausted one segment (a specific generation) from its
total maximum heap size. Also under some conditions on Linux/Unix
systems running out of some Operating System resources may yield an
OutOfMemoryError for example the inability for the OS to create more new
threads for the JVM.
You can set this in the run.bat (Windows) or run.sh (Linux) or run.conf
You can use VisualVM or JConsole to get in depth information on classes being
loaded and can narrow it to the classes causing memory leaks.
<mbean code="org.jboss.util.threadpool.BasicThreadPool"
name="jboss.system:service=ThreadPool">
<attribute name="Name">JBoss System Threads</attribute>
<attribute name="ThreadGroupName">System Threads</attribute>
<attribute name="KeepAliveTime">60000</attribute>
<attribute name="MaximumPoolSize">10</attribute>
<attribute name="MaximumQueueSize">1000</attribute>
<attribute name="BlockingMode">run</attribute>
</mbean>
Figure 8: Example of AS Thread Pool configuration
When all the thread in the pool are busy, all the new request are added to the
queue and queue size is determined by the QueueSize attribute. When the
queue has reached its max, any subsequent request behavior would depend on
the value of Blocking Mode attribute.
Using JMX console you can check the size of the queue. If you have a steady (or
worse, an increasing) QueueSize on your server, then you should consider
raising the MaximumPoolSize pool size attribute.However, simply incrementing
the queue size might not be enough to solve your problems—analyze at first
where your application is slowing down. For example, a very common scenario
is that your threads are busy because they are handling slow or stuck JDBC
Connection Leak: While Connection pooling has many advantages if not used
properly can result in many issues which may be difficult to troubleshoot. If
connections are not returned to the connection pool they will be kept open and
the available connection will leak away. At some point threads will either block
waiting for connection to be available or will generate exceptions perhaps after
few retries. There can be number of reason. For example:
• Developer forgets to return the connection
3.4. Clustering
Clustering allows you to run an application on several parallel servers (a.k.a
cluster nodes) while providing a single view to application clients. Load is
distributed across different servers, and even if one or more of the servers fails,
the application is still accessible via the surviving cluster nodes. Clustering is
crucial for scalable enterprise applications, as you can improve performance by
adding more nodes to the cluster. Clustering is crucial for highly available
enterprise applications, as it is the clustering infrastructure that supports the
redundancy needed for high availability. JBoss Application Server uses JGroups
and JBoss Cache for providing Clustering capabilities. For more details refer to
the “Clustering considerations” whitepaper in the Red Hat customer portal.
If you want to bind to a specific network interface card (NIC), use -bind_addr
192.168.0.2, where 192.168.0.2 is the IP address of the NIC to which you want
to bind. Use this parameter in both the sender and the receiver.
If using AIO, make sure the journal folder is on an ext2 or ext3 file system.
• JConsole: http://download.oracle.com/javase/6/docs/technotes/guides/
management/jconsole.html
• VisualVM: http://download.oracle.com/javase/6/docs/technotes/guides/
visualvm/index.html
• JMX-Console: http://community.jboss.org/wiki/JMXConsole
• http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/
5/html-single/Administration_And_Configuration_Guide/
index.html#id3276717
• http://docs.jboss.org/jbossmessaging/docs/userguide-2.0.0.alpha1/html/
troubleshooting.html
5. Questions/Comments/Issues
If you have questions or comments about this whitepaper, please enter them in the Red
Hat customer portal for this specific whitepaper:
https://access.redhat.com/knowledge/techbriefs .
If you have a technical issue following this whitepaper please open a support case:
https://access.redhat.com/support/cases/new