Results 1 to 2 of 2

Thread: Tuning JVM and Garbage Collector

  1. #1
    Join Date
    Nov 2009

    Tuning JVM and Garbage Collector

    Introduction :
    The objective of this workshop is to sensitize the choice of memory spaces of the JVM, based on a generational GC. We have applied the SUN JDK. Set the size of the memory areas of the JVM depends on the application, the creation cycle of application objects and requires an understanding "detailed" the operation of the GC. The parameters to give the JVM of an application supporting a batch are not the same as those of a transactional web application. To illustrate the effects of the size of memory areas of the JVM, we deliberately used a simple example and available: the famous Swing Java2D demo. The principle of the workshop is simple: use the application Java2D (included in the jdk JAVA_HOME%% / demo/jfc/Java2D) with different parameters of the JVM and interpret the results.

    Prerequisites :
    Experiments of this can be done on Solaris, Linux and Windows: Where the Sun JDK Hotspot works. Simply install a later version JDK 5.0. The tests were performed with JDK 1.0.0 build 17. Note that the JDK which includes the "demos" is necessary - a JRE is not enough. Set environment variables JAVA_HOME. Download if needed visualgc. Now you're ready to start the workshop. Handling memory spaces of the younger generation.

  2. #2
    Join Date
    Nov 2009

    Re: Tuning JVM and Garbage Collector

    The memory of the young generation (young generation) is up to the area called "Eden" plus two spaces called "survivor".

    The objective of this part of the workshop is to know:
    - How to use the GUI to launch the java perf Java 2D Demo and monitor their performance with Visual GC.
    - Where to find the command line that sets the parameters of the JVM
    - How to recognize if the younger generation is too small, too large, with an adequate size

    Start by setting the following configuration
    -XX: NewSize = 1m-XX: MaxNewSize = 1m-Xms16m-Xmx16m-XX: MaxTenuringThreshold = 0
    These values are used only to focus on the effects of GC parameters.
    Launch the Java 2D% JAVA_HOME% / demo/jfc/Java2D with this command
    > Java-jar CommandGC Java2Demo.jar
    - Determine the identifier of the virtual machine (VMID). The command is "jps"
    Then use this to run the program VMID jstat and collect basic statistics GC
    - Start applying visual GC (download if necessary visualgc ).
    Visual GC gives an excellent overview of what happens in the JVM. When you combine this display additional statistics collected during the test you can gauge the performance of the target application

    The application visualGC consists of 3 components:
    1) Visual GC : Displays the basic applications such as time elapsed the process and a number of static (eg command line options). Note that the screen areas representing the Perm Gen Old Gen Eden and Survivor spaces (S0 and S1) are sized proportionally to the maximum capacity of spaces.
    2) Graph : Displays statistics as and when they evolve over time. For all exercises, the sampling interval was chosen to be one second.
    3) Survivor Space histogram : The histogram panel displays an overview of the age distribution of objects in space after the last active survivor of the young generation collection. The screen is composed of 32 regions of equal size, one for each age possible object.

    - Click on the tab quickly transform> transform the square anim (the bottom), increase the number of string objects and animated images to the maximum.
    - This manipulation is important to get the desired effect. Indeed, graphics applications tab "transform" are well suited for testing the tuning of the JVM because they create many temporary objects.

    - The first clue is the sawtooth pattern in the old generation. (NOTE: the speed at which objects are generated depends on the specific hardware you use. In some cases, this may take more time to manifest.)
    - Certain objects are still alive are promoted directly to the old generation.

Similar Threads

  1. JAVA - What is garbage collection
    By Bhim in forum Software Development
    Replies: 5
    Last Post: 28-04-2011, 01:13 PM
  2. Control the garbage collector
    By Anthony12 in forum Software Development
    Replies: 6
    Last Post: 02-08-2010, 10:32 AM
  3. Java - help with Garbage Collection
    By Messenger in forum Software Development
    Replies: 4
    Last Post: 23-07-2010, 10:18 AM
  4. What is the Garbage Collection in PHP?
    By Emma.J in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 12:40 AM
  5. What are the two kinds of Garbage Collectors for C++?
    By KALYAN23 in forum Software Development
    Replies: 3
    Last Post: 10-11-2009, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts