Solved

Hprof results

Posted on 2004-09-01
12
373 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

623 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