Solaris CPU run query report


Here I would like to provide small awk bases script to collect information about CPU run query statistic report on Sun Solaris OS.

 

In most Sun Solaris OS (9,10) after installation and put production mode you can detect too much processes are on sleep mode then in run mode. It often generate System Low Performance when Running non-stop online processes like with Database Instances or Java Based Application Servers. At first time when you try to investigate running processes on the systems everything can be looks fine – system can have less than average usage less CPU usage more System Idle percent. You can got this report from vmstat and prstat outputs. Bunt to any case the application part is reporting to slow performance ……

To detect what’s is gong on in real – you can use my script and detect current system status.

Below I will provide a script with which you can calculate statistics of running, sleeping, zombie and stopped processes:

   1: #!/bin/bash

   2: #

   3: #########################################################

   4: #                                                       #

   5: # Solaris CPU query process report                      #

   6: #                                                       #

   7: # Eldar Aydayev ©                                       #

   8: # UNIX Systems Professional Consultant                  #

   9: # Aydayev’s Investment Business Group                   #

  10: # 1676. 23rd Ave, Noriega St. San Francisco, CA 94122   #

  11: # E-mail: eldar@aydayev.com                             #

  12: # URL: http://eldar.aydayev.com                         #

  13: # LinkedIn: http://www.linkedin.com/in/eldar            #

  14: # Phone: +1 (650) 2062624                               #

  15: #                                                       #

  16: #########################################################

  17:  

  18:  

  19: printf "date\t\t\trun\tsleep\tstop\tzombie\n";

  20: count=1;

  21: while [ $count -le 10 ];

  22: do 

  23: prstat -n 10000 -L 1 1|grep -v Total|grep -v USERNAME|awk '{print $5}'|sort|cut -c-3|uniq -c| awk '{status[1]=d} {if ($2=="cpu") status[2]=$1; else if ($2=="sle") status[3]=$1; else if ($2=="sto") status[4]=$1; else if ($2=="zom") status[5]=$1;} END {for (x = 1; x <= 5; x++) printf status[x]"\t"}' "d=$(date '+%d.%m.%Y-%H:%M:%S')";

  24: echo;

  25: let count=$count+1;

  26: sleep 5;

  27: done

 

The output must be looks like this:

   1:  date                    run     sleep   stop    zombie
   2:  12.04.2011-12:10:30     47      2617    117     6       
   3:  12.04.2011-12:10:36     42      2622    85      9       
   4:  12.04.2011-12:10:42     34      1744            7       
   5:  12.04.2011-12:10:48     48      1632    1000    5       
   6:  12.04.2011-12:10:54     61      2804    66      7       
   7:  12.04.2011-12:11:01     27      2833    109     6       
   8:  12.04.2011-12:11:07     61      2786    161     9       
   9:  12.04.2011-12:11:14     53      1755    1092    10      
  10:  12.04.2011-12:11:21     30      2489            4       
  11:  12.04.2011-12:11:28     33      2049    476     6  

 

To reduce number of sleep processes is necessary to tuning “open file” limitation of the system. Check you parameters by command:

# ulimit –n

If output equal to 256 – it’s mean you system haven’t well configured and it have only Sun Solaris OS default parameters. To solving it is necessary to put next records in /etc/system and after it reboot the box:

   1:  set rlim_fd_cur=1024
   2:  set rlim_fd_max=260000
   3:  set maxphys=1048576
   4:  set md:md_maxphys=1048576

 

After reboot the box, you can again check the CPU query running process statistics and it can be looks like this:

   1:  date                    run     sleep   stop    zombie
   2:  12.04.2011-12:04:13     4       442             1       
   3:  12.04.2011-12:04:19     8       438             1       
   4:  12.04.2011-12:04:24     6       440             1       
   5:  12.04.2011-12:04:29     4       442             1       
   6:  12.04.2011-12:04:34     5       441             1       
   7:  12.04.2011-12:04:39     7       439             1       
   8:  12.04.2011-12:04:44     6       444             1       
   9:  12.04.2011-12:04:50     5       448             1       
  10:  12.04.2011-12:04:55     4       442             1       
  11:  12.04.2011-12:05:00     4       447             1    

 

As you can see the applied settings can definitely solving System Low Performance.

 

Eldar Aydayev ©

UNIX Systems Professional Consultant | Aydayev’s Investment Business Group

1676. 23rd Ave, Noriega St. San Francisco, CA 94122

E-mail: eldar@aydayev.com

URL: http://eldar.aydayev.com

LinkedIn: http://www.linkedin.com/in/eldar

Phone: +1 (650) 2062624