Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hprof results

Posted on 2004-09-01
12
Medium Priority
?
374 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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.
Suggested Courses

721 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