The Heart Of The Matter - PowerPoint PPT Presentation

About This Presentation
Title:

The Heart Of The Matter

Description:

Sun Hotspot JVM. IBM JVM. BEA JRockit. MAC OSRuntime for OSX. Oracle JVM aka JServer OJVM ... Oracle OC4J. Sun Java System Application Server (Sun One) ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 20
Provided by: mikeb84
Category:
Tags: heart | matter

less

Transcript and Presenter's Notes

Title: The Heart Of The Matter


1
The Heart Of The Matter
  • The Java Virtual Machine
  • Mike Brunt

2
The Heart Of The Matter - JVM
  • What is the JVM?
  • Main JVM Suppliers
  • ColdFusion and the JVM
  • Java J2EE Java EE Servlet Containers
  • Where everything sits-fits
  • Tuning the JVM
  • Metrics Logging
  • Using utilities to aid in tuning the JVM
  • References
  • Summary

3
What is the JVM?
  • Sun Microsystems created Java as a high-level
    programming language which should run on as many
    operating systems and hardware variations as
    possible. The goal of write once run anywhere
    meant that a predictable encapsulated operating
    system, no matter what the underlying hardware
    and software, was required.
  • The Java Virtual Machine (JVM or JRE) is a
    multi-threaded environment abstracting the actual
    computer operating system from the application
    code.

4
Main JVM Suppliers
  • These are the main suppliers of Java Virtual
    Machines, there are others.
  • Sun Hotspot JVM
  • IBM JVM
  • BEA JRockit
  • MAC OSRuntime for OSX
  • Oracle JVM aka JServer OJVM
  • Microsoft JVM

5
ColdFusion and the JVM
  • Since ColdFusion MX 6.0-6.1, CF has been a Java
    Application which needs what is known as a
    Servlet Container to run on. The most popular
    Servlet Container for ColdFusion is JRun.
  • In the Enterprise edition of ColdFusion, the
    actual Servlet Container to be used can be
    selected during the install. In non-Enterprise
    installs JRun is automatically used. The main
    point being that there is always a Servlet
    Container.

6
Java J2EE Java EE Servlet Containers
  • This is a list 0f Java Servlet Containers which
    are certified as fully J2EE Java EE compliant
    by Sun Microsystems.
  • Geronimo from Apache
  • JBoss from Red Hat
  • JRun from Adobe
  • Oracle OC4J
  • Sun Java System Application Server (Sun One).
  • WebLogic Server from BEA
  • WebSphere Server from IBM

7
Where everything sits-fits
  • This is a simple diagram showing where the
    Operating System, JVM, Servlet Container and Java
    Application Server sit in relativity.

8
ColdFusion and the JVM
  • Standard-Server
  • Enterprise
  • Windows Install
  • Windows Install

9
ColdFusion and the JVM
  • This is a simple diagram showing where the
    Operating System, JVM, Servlet Container and Java
    Application Server sit in relativity.

10
Tuning the JVM
  • Garbage Collectors
  • Garbage Collectors (different arguments to
    jvm.config)
  • -XXUseParallelGC Use parallel garbage
    collection, this is typically the default
    collector for ColdFusion installations. This
    collector is also referred to as the throughput
    collector. It uses a parallel version of the
    young generation collector. The old (tenured)
    generation is still cleaned with the default
    collector. Note This option can not be used in
    conjunction with -XXUseConcMarkSweepGC.
  • -XXUseConcMarkSweepGC Use concurrent garbage
    collection. This collector is also referred to as
    the concurrent low pause collector. It collects
    garbage in the old (tenured) generation
    concurrently to executing the application. Note
    that this option can not be used in conjunction
    with -XXUseParallelGC. Instead you may combine
    it with -XXUseParNewGC
  • -XXUseParNewGC Instructs the VM to use a
    parallel collector for the young generation. This
    option can be used in conjunction with
    -XXUseConcMarkSweepGC.
  • As a note I have found that using the
    ConcMarkSweepGC along with ParNewGC can cause
    longer Full GCs, I tend to use ParNewGC on its
    own.

11
Tuning the JVM
  • Full Garbage Collections Minimize
  • Sun JVMs use a generational garbage collector
    with two young generations and an old generation.
    New objects are always allocated in the young
    generation part of the heap. Every time the young
    generation is full a minor garbage collection
    takes place. Minor garbage collections don't take
    very long.
  • Objects which survived some minor collections,
    because they are still referenced from the
    application, are promoted to the older
    generation. Usually the older generation is full
    at some point too, and needs to be cleaned. This
    leads to a major garbage collection or Full
    Garbage (Full GC) collection that removes garbage
    from both the old and the younger generations.
    Full GCs are stop-the-world events and need to
    occur only when absolutely necessary.

12
Tuning the JVM
  • Full Garbage Collections Minimize
  • One of the first methods I always want to employ
    when troubleshooting is to ascertain how many
    Full GCs are taking place. To do so I add these
    arguments to the jvm.config file, which is
    located in one of these directories depending on
    the installation
  • Enterprise drive-volume\jrun4\bin
  • Standard/Server - drive-volume\CFusionMX7\runtim
    e\bin
  • -XXPrintGCDetails -XXPrintGCTimeStamps
  • -XXPrintHeapAtGC -verbosegc -Xloggcyourname.lo
    g
  • This will send Garbage collection output to the
    std-out.log and will create a log of all GC
    activity with whatever name you gave yourname in
    either..
  • Enterprise drive-volume\jrun4\bin
  • Standard/Server - drive-volume\CFusionMX7\runtim
    e\bin

13
Tuning the JVM
  • Full Garbage Collections Minimize
  • Here is an example of the Verbose Garbage
    Collection log output
  • par new generation total 97088K, used 0K
    0x10010000, 0x171d0000, 0x171d0000)
  • eden space 77696K, 0 used 0x10010000,
    0x10010000, 0x14bf0000)
  • from space 19392K, 0 used 0x14bf0000,
    0x14bf0000, 0x15ee0000)
  • to space 19392K, 0 used 0x15ee0000,
    0x15ee0000, 0x171d0000)
  • tenured generation total 932096K, used 11109K
    0x171d0000, 0x50010000, 0x50010000)
  • the space 932096K, 1 used 0x171d0000,
    0x17ca95b8, 0x17ca9600, 0x50010000)
  • compacting perm gen total 26624K, used 26606K
    0x50010000, 0x51a10000, 0x58010000)
  • the space 26624K, 99 used 0x50010000,
    0x51a0b8a0, 0x51a0ba00, 0x51a10000)
  • , 0.1523967 secs
  • 3691.704 Full GC Heap before GC
    invocations8
  • Heap
  • This Full GC was almost certainly unnecessary
    because at the time it ran only 1109k out of
    932096k of the tenured (old) generation had been
    used. I also note the timestamp (3691.704) of
    every Full GC in the log. If I see a regular
    pattern it almost always means something is
    calling a Full GC perhaps using system.gc()

14
Tuning the JVM
  • Full Garbage Collections Minimize How?
  • One pattern I have seen over and over with
    ColdFusion is that Full GCs are very often
    occurring at regular 60 second intervals.
    Although I have never been able to pin this down
    fully, I suspect it is due to a Java process
    called RMI(Remote Method Invocation). So then
    what do we do to control these unnecessary
    stop-the-world Full GCs? There are two
    alternatives
  • 1/ Disable Full GCs using the -XXDisableExplici
    tGC jvm.config argument. I am not totally happy
    doing this and in many cases it will not work
  • 2/ Run Full GCs at longer regular intervals.
    Applying these arguments instead of
    -XXDisableExplicitGC will cause Full GCs every
    10 minutes (600,000 ms).
  • -Dsun.rmi.dgc.client.gcInterval600000-Dsun.rmi.
    dgc.server.gcInterval600000

15
Metrics Logging
  • I have found that enabling metrics looking is
    invaluable in troubleshooting ColdFusion and JRun
    application issues. Metrics logging will show the
    status of the CF-JRun instance at pre-selected
    time intervals in terms of number of threads in
    use and available memory. In order to enable
    metrics logging we need to edit the jrun.xml
    file, here
  • Enterprise install
  • drive-volume\JRun4\servers\servername\SERVER-
    INF
  • Server-Standard install
  • drive-volume
  • \CFusionMX7\runtime\servers\servername\SERVER-I
    NF
  • Setting detail is on the next slide

16
Metrics Logging
  • Here is how to enable metrics logging in the
    jrun.xml file
  • Firstly uncomment the service class
  • Then set metricsEnabled to true, we will leave
    other settings to default.
  • Lastly I like to spilt the logs out to make
    reading them easier by this change

17
References
  • Sun JVM Versions up to 1.5 (5.0)
  • http//java.sun.com/j2se/codenames.html
  • GC Viewer Tool (Sun JVM up to 1.4x)
  • http//www.javaperformancetuning.com/tools/gcview
    er/index.shtml

18
Summary
  • I have found that the only way to really
    determine the correct garbage collector to use
    for your applications and what the correct
    arguments are to pass to the JVM, via the
    jvm.config file, to effectively manage garbage
    collections is to first determine how many Full
    GCs are occurring and control that if there are
    too many. Then load-test the application whilst
    tuning the arguments passed to the JVM, via the
    jvm.config file.

19
The Heart Of The Matter -Presenter
  • Mike Brunt
  • mbrunt_at_go2ria.net
Write a Comment
User Comments (0)
About PowerShow.com