AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
Expand all | Collapse all

Java program using lots of CPU while doing nothing?

  • 1.  Java program using lots of CPU while doing nothing?

    Posted Thu February 02, 2012 04:01 PM

    Originally posted by: SystemAdmin


    Hi all,

    I haven't really been using AIX for the past 10 years, so this might be a silly beginner's question, but here goes:

    I wrote a small Java program, but was surprised at how much CPU it was consuming. It wasn't really doing anything but waiting for input, but still it consumed about 50% CPU. I reduced the program to the following lines:
    
    System.out.println(
    "Sleeping 60 seconds..."); Thread.sleep(60000); System.out.println(
    "Awake.");
    

    and it still consumed about 50% CPU while sleeping. topas reports:
    
    Topas Monitor 
    
    for host:    xxxxxxxxxx           EVENTS/QUEUES    FILE/TTY Thu Feb  2 21:41:24 2012   Interval:  2         Cswitch   11206  Readch   399.3K Syscall  115.4K  Writech   78627 Kernel   31.6   |#########                   |  Reads        51  Rawin         0 User     31.5   |#########                   |  Writes       14  Ttyout      856 Wait      0.0   |#                           |  Forks         0  Igets         0 Idle     36.9   |###########                 |  Execs         0  Namei     71238 Physc =  1.12                     %Entc= 139.9  Runqueue    3.5  Dirblk        0 Waitqueue   0.0 Network  KBPS   I-Pack  O-Pack   KB-In  KB-Out                   MEMORY Total     5.1     10.0     8.0     2.5     2.6  PAGING           Real,MB   25600 Faults        0  % Comp     40 Disk    Busy%     KBPS     TPS KB-Read KB-Writ  Steals        0  % Noncomp  32 Total     5.0   1635.6   127.0  1376.0   259.6  PgspIn        0  % Client   32 PgspOut       0 FileSystem        KBPS     TPS KB-Read KB-Writ  PageIn        0  PAGING SPACE Total            470.3    52.5  397.3   73.0    PageOut       0  Size,MB   12800 Sios          0  % Used      0 Name            PID  CPU%  PgSp Owner                            % Free    100 java       18153540  55.1  51.1 sin             NFS (calls/sec) vmmd         458766   0.9   1.4 root            SerV2         0  WPAR Activ    0 topas      28639348   0.1   5.8 sin             CliV2         0  WPAR Total    0 oracle     10092598   0.1  19.1 oracle          SerV3         0  Press: 
    "h"-help oracle     17236048   0.1  17.1 oracle          CliV3         0         
    "q"-quit oracle     11403358   0.1  19.1 oracle oracle     11469020   0.1  19.1 oracle oracle     18874394   0.1  19.1 oracle oracle     17956902   0.1  17.1 oracle oracle     11010130   0.1  17.1 oracle oracle     17629218   0.1  17.1 oracle oracle     17563650   0.1  19.1 oracle oracle     20054036   0.1  19.1 oracle oracle     17170470   0.1  19.1 oracle oracle     16973868   0.1  19.1 oracle oracle     14745800   0.1  19.1 oracle oracle     20185164   0.1  19.1 oracle oracle     16580654   0.1  19.1 oracle oracle      9371712   0.1  19.1 oracle oracle     13697148   0.1  19.1 oracle
    


    Am I reading topas all wrong/misunderstanding the CPU usage, or can someone point me towards what is going on?

    Thanks in advance,
    Simon.
    #AIX-Forum


  • 2.  Re: Java program using lots of CPU while doing nothing?

    Posted Thu March 01, 2012 06:17 PM

    Originally posted by: SystemAdmin


    I found a fix for this. Turns out to be an infinite loop in IBM's JVM version 6.0.0 SR6 and SR7.

    The APAR ID is IZ73533, and documentation/workaround/fix is available at www-01.ibm.com/support/docview.wss?uid=isg1IZ73533

    Best regards,
    Simon Kepp Nielsen.
    #AIX-Forum