Solved

Hprof results

Posted on 2004-09-01
12
362 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 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

10 Experts available now in Live!

Get 1:1 Help Now