Saturday, June 16

High Cpu Usage on Solaris

Command1: prstat -s cpu -n 5 
Will list the top 5 process consuming the CPU on the server 
Try to identify what type of process it is, whether is OS or application related process. Based on the process proceed with the corrective measures. 

Command2: prstat -t 
Will list the cpu utilization wrt the users 

Alternatievely you can also use: 
Command3: prstat -s cpu -a -n 8 
The output will display the Top 8 consumers of CPU


 We can follow below steps as assuming one of the wls managed server/jvm causing high cpu or slow performance on linux,

1. Find out which JVM is using more cpu or slow performance jvm by using top command

2. Run the below command to see which threads in the JVM's are using high cpu/slow performance,

top -Hp 

Note the thread id's which are causing more cpu usage or slow performance

3. Take a multiple threads dumps with 5 to 10 seconds interval using kill -3 

so we can see whether the same threads are using more cpu/slow performance at all the time,because some of threads takes more cpu for few seconds only,so taking multiple threads dumps will help us to get the threads which are using the cpu constantly.

4. In the threads dumps, you can search for the thread id's (if you are using the sun jdk then thread id is on hexa and that needs to be converted to decimal and look for the decimal on the thread dump but if u are using jrockit then u can directly search for the thread id in the dump

5. Once you have stack strace of the threads which are causing the high cpu/slow performance , u can see who is causing the issue ,may be a bad app code, third party library, or may be an slow network,or slow data base respone or Garbage collector thread. etc.. based on the issue we need to work on it to get it fixed.



How to solve the High CPU Utilization issue?
  • Rajasekhar Reddy Naredla before restarting the server we need verify the below tings. 1. top command –> to know the high CPU consuming process.
    2. ps -ef|grep –> to know details of the process consuming high CPU.
    3. ls -lrt /proc//fd

    or ls -lrt /proc//fd |grep log —-> to know the files accessed by the process. To know the log files and other related files.
  • Maheshkumar Subbaiyan We can follow below steps as assuming one of the wls managed server/jvm causing high cpu or slow performance on linux,

    1. Find out which JVM is using more cpu or slow performance jvm by using top command


    2. Run the below command to see which threads in the JVM's are using high cpu/slow performance,

    top -Hp

    Note the thread id's which are causing more cpu usage or slow performance

    3. Take a multiple threads dumps with 5 to 10 seconds interval using kill -3

    so we can see whether the same threads are using more cpu/slow performance at all the time,because some of threads takes more cpu for few seconds only,so taking multiple threads dumps will help us to get the threads which are using the cpu constantly.

    4. In the threads dumps, you can search for the thread id's (if you are using the sun jdk then thread id is on hexa and that needs to be converted to decimal and look for the decimal on the thread dump but if u are using jrockit then u can directly search for the thread id in the dump

    5. Once you have stack strace of the threads which are causing the high cpu/slow performance , u can see who is causing the issue ,may be a bad app code, third party library, or may be an slow network,or slow data base respone or Garbage collector thread. etc.. based on the issue we need to work on it to get it fixed.

No comments:

Post a Comment