Jaav thread consuming high load on Linux

Posted on 2011-05-03
Last Modified: 2012-05-11
We have a tomcat application using JDK 1.4 on RHEL 3. Sometimes one of the Java threads utilizes around 30-50 % of the CPU (from TOP command) causing the system load average to go over 1 (normally its 0.1-0.2) and hence results in the Application being very slow sometimes or inaccessible. Its only one thread that is consuming so much CPU (nearly 50 %) while CPU consumption by others does not go over 5%. The functional team says there are not performing any extra activities during the time when the issue occurs. So I need to know what is causing this Java thread to consume so much resources then.

Some findings -

1. The address space (Vmsize) of all the threads is around 1.5 GB (the limitation on Linux is 3 GB).
2. We used 'Kill -3 <pid_of_java_thread>' and generated a thread dump in /tmp directory but its only 16 Kb in size (we except it to be in GB's).

So please provide info on how the Java thread can be analyzed ?
Question by:makk2010
    LVL 92

    Expert Comment

    sounds like the load is possibly caused by garbage collection

    > 2. We used 'Kill -3 <pid_of_java_thread>' and generated a thread dump in /tmp directory but its only 16 Kb in size (we except it to be in GB's).

    it contains the start of all threads, its not going to be huge

    LVL 4

    Accepted Solution

    I would also guess that this is caused by the garbage collector.
    First I would let run the application with the "-verbose:gc" option where you could see some details about the garbage collector statistics. With other options evenmore details can be showed. You can change some parameters of the gc. Beside the default garbage collector there are also other garbage collectors which could be used (basically you can trade "gc troughput" with "application responsivness").
    More details here

    Author Comment

    Apologies for the late reply. The Garbage collector seems to be good but unfortunately I am not a Developer or Programmer to implement it and we have no support from Application team. So we are looking at some tool or command by which we can take a dump of the memory (used by the Java thread) at the time the issue occurs so we can know whether the resource consumption is a problem and if that is the case then add more memory to the server.
    LVL 4

    Expert Comment

    With jconsole you could look "inside" the java process and see the status of the java process.

    Author Comment

    It seems Jconsole is available with JDK 1.5 and higher. But we are having Java 1.4

    $ java -version
    java version "1.4.2_05"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
    Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

    LVL 4

    Assisted Solution

    As far as I remember its somehow possible to add the JMX also to a JVM 1.4 and then run the jconsole (client) on 1.5+. But RHEL 3 and jdk 1.4 is quiet old these days. If you're stuck to 1.4 it's probably really easier to just add some memory (which is very cheap these days) if possible to see if this ameliorates the situation. Other solution for example could be to restart the application periodically during off-business hours.

    Author Closing Comment

    Just got a hint that it could be due to Garbage objects in the memory and but could not find any tool or utility that could collect Java heap dump perhaps due to the version of JVM being used.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack or Above. The following steps a…
    It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now