Solved

Hprof results

Posted on 2004-09-01
12
371 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java: The Public Class Main 4 46
Java program running SQL query 5 50
junit as external jar or library 7 40
IBM TS2900 (3572) Tape Autoloader Java? 12 61
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 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