Go Back   TechArena Community > Software > Tips & Tweaks
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links

Tuning JVM and Garbage Collector

Tips & Tweaks

Thread Tools Search this Thread
Old 23-07-2010
Join Date: Nov 2009
Posts: 583
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.

Reply With Quote
Old 23-07-2010
Join Date: Nov 2009
Posts: 583
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.
Reply With Quote

  TechArena Community > Software > Tips & Tweaks
Tags: , , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

All times are GMT +5.5. The time now is 03:22 PM.