Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Java VM Developer
Feedback!
Please provide any feedback you have to lvenkata@in.ibm.com or baileyc@uk.ibm.com
Important Disclaimers
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED.
ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED
ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBMS CURRENT PRODUCT
PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE
OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
- CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR
SUPPLIERS AND/OR LICENSORS
High CPU will be seen in topas and perfmon performance counters as seen previously
First step is to understand whether CPU cost is specific to any given thread, or collection of threads
10
A series of javacore.txt files provides a rough idea of what the threads are doing
For a single thread using 100% CPU, the stack track should be sufficient
For a group of threads, it shows some of the methods being executed
11
Health Center
12
Health Center
13
Method Profiling:
(Very) low overhead method profiling
Call paths to show code flow
Timelines to show changes in behaviour
First step is to look for threads blocked on monitors in the javacore.txt file
14
15
Provides time accounting and contention statistics for Java and JVM locks
16
17
Functionality includes:
Counters associated with contended locks
Total number of successful acquires
Recursive acquires times a thread
acquires a lock it already owns
Number of times a thread blocks because
a monitor is already owned
Cumulative time the monitor was held.
18
External Delays
19
20
Can profile how long the waits are using Method Trace
2011 IBM Corporation
21
Controlling Trace
22
23
The value of each keyword is then set to the trace points required
-Xtrace:maximal=all
traces all of the information available from all JVM trace points to
internal wrapping buffers.
-Xtrace:iprint=awt
traces all of the JVM internal AWT trace points to stderr, with
indentations on entry and exit.
-Xtrace:iprint=mt
activates method trace and set the output to stderr with
indentations
Method Trace
24
Detailed information:
Entry and Exit points, with thread information and microsecond time stamps
Triggering
25
Triggering Examples
26
Examples:
-Xtrace:trigger=method{java/lang/StackOverflowError*, sysdump}
create a system dump on the first (and only the first) instance of a StackOverflowError
method being called - which is the <clinit> method.
-Xtrace:resumecount=1
-Xtrace:trigger=method{HelloWorld.main,resume,suspend}
trace all threads once HelloWorld.main() is called and stop tracing when HelloWorld.main()
returns.
2011 IBM Corporation
-Xtrace:
iprint=mt,
methods={myapp/MyTime*},
resumecount=1,
trigger=method{myapp/MyTime.main,resume,suspend}
21:05:47.992*0x806cb00
static method
21:05:47.994 0x806cb00
21:05:47.994 0x806cb00
809baec
21:05:47.994 0x806cb00
arguments: ()
21:05:47.994 0x806cb00
21:05:47.994 0x806cb00
809baf0
21:05:47.994 0x806cb00
arguments: ()
21:05:48.079 0x806cb00
21:05:48.079 0x806cb00
static method
27
mt.3
mt.19
mt.0
mt.18
mt.6
mt.0
mt.18
mt.6
mt.9
-Xtrace:
iprint=mt,
methods={myapp/*},
resumecount=1,
trigger=method{myapp/MyTime.test,resume,suspend}
21:07:14.968*0x806cb00
21:07:14.970 0x806cb00
arguments: ()
21:07:15.067 0x806cb00
21:07:15.067 0x806cb00
21:07:15.067 0x806cb00
21:07:15.069 0x806cb00
28
mt.0
mt.18
mt.3
mt.19
mt.9
mt.6
Can profile calls to this method via method trace with the following:
-Xtrace:maximal=mt,output=mtrace#.out,10m,10,V
Trace methods to 10 files named mtrace#.out each sized at 10MB
Vmethods={com/ibm/as400/access/AS400ThreadedServer.receive}
Trace entry and exit of AS400ThreadedServer.receive
29
Summary
30
Questions?
31
References
Learn:
IBM Java InfoCenters:
https://www.ibm.com/developerworks/java/jdk/docs.html
Discuss:
IBM Java Runtimes and SDKs Forum:
http://www.ibm.com/developerworks/forums/forum.jspa?forumID=367&start=0
IBM Java Technology Community:
https://www.ibm.com/developerworks/mydeveloperworks/groups/service/html/communityview?
communityUuid=738b7897-cd38-4f24-9f05-48dd69116837
IBM on Troubleshooting Java Applications Blog:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/troubleshootingjava/
32
32
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business
Machines Corp., and registered in many jurisdictions worldwide.
Other product and service names might be trademarks of IBM or other companies.
A current list of IBM trademarks is available on the Web see the IBM Copyright and trademark
information page at URL: www.ibm.com/legal/copytrade.shtml
33
33