Solved

Hprof results

Posted on 2004-09-01
12
365 Views
Last Modified: 2008-02-01
Hi All
I have simple application running over tomcat.
I use Hprof to understand system behavior.

results:

   rank   self  accum   count trace method
   1 15.42% 15.42%    2603   320 java.net.PlainSocketImpl.socketAccept
   2 15.30% 30.73%    2583   383 java.net.PlainSocketImpl.socketAccept
   3 15.30% 46.02%    2582   384 java.net.PlainSocketImpl.socketAccept
   4 14.73% 60.75%    2486   360 java.net.PlainSocketImpl.socketAccept
   5 14.71% 75.46%    2482   381 java.net.PlainSocketImpl.socketAccept
   6 14.70% 90.16%    2481   382 java.net.PlainSocketImpl.socketAccept

90.16% of cpu is the accept how come ?
I load the system at 8 request in second.
0
Comment
Question by:dannysh
  • 5
  • 3
  • 2
12 Comments
 
LVL 12

Expert Comment

by:Giant2
ID: 11953339
>90.16% of cpu is the accept how come ?
>I load the system at 8 request in second.

What do you mean??
I see a total of 90.16% and 6 accept.
0
 

Author Comment

by:dannysh
ID: 11953533
Hi

The HProf  output third column is total cpu usage, it shows that socketAccept (and there are 6 lines) use ~15% each.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11953695
How "simple" is your application?
Are there some thread, resource consuming object?
0
 

Author Comment

by:dannysh
ID: 11953907
Hi
My app reads XML data from the request body, parse and validate it then store it to db.
The Hprof also shows those actions (parse , validate, store) but all conumes just 0.1%.
The real heavy conumer is the accept.
The problem is that I load the system in 8 request in second and it seems just 5 end in a second.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11954272
normally a webserver wait for listen over a port (not for accept).
It seems the system try to accept the connection and it has difficulties (and so consume resources)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:primusmagestri
ID: 11967054
Giant2, socketAccept is exactly the method that the inner object uses when you call accept for a ServerSocket object. It is a listener, you should pay attention to the java.net package classes.

dannysh, my idea is that you do not have too much data to transfer, parse, validate and store to DB. The accept method takes the most amount of CPU time to be executed. Network access, and by that I mean establishing a connection, takes much effort. I don't remember exactly, but isn't the CPU value indicated in HPROF results the percentage of CPU consumed out of the total per application? I mean, your CPU really goes to ~90% usage?
0
 
LVL 12

Accepted Solution

by:
Giant2 earned 25 total points
ID: 11970458
Do you use the setting: cpu=samples?

I find this interesting post:

"The hprof cpu=samples option samples the runnable threads and bumps a counter for every stack trace where the thread appears to have done something based on the JVMPI HasThreadRun interface. It's possible this thread isn't doing anything, but hprof is fooled. It is just a sample counter, so it really does not represent CPU time, just that this TRACE's popularity is 79%."

Bye, Giant.
0
 

Author Comment

by:dannysh
ID: 11983332
Hi
Do you use the setting: cpu=samples?

Yes I do use it.

So is there any other way to measure real CPU usage ?
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11987523
>So is there any other way to measure real CPU usage ?

Seems it's not.
0
 
LVL 1

Assisted Solution

by:primusmagestri
primusmagestri earned 25 total points
ID: 11987761
You could use cpu=time, but this is not good, either. The time spent could be because of some synchronization rather than time spent calculating something usefull :)
Read this article too: http://www.javaworld.com/javaworld/javaqa/2002-11/01-qa-1108-cpu.html
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

932 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

20 Experts available now in Live!

Get 1:1 Help Now