Over a million developers have joined DZone.
Platinum Partner

Visual GC

The Performance Zone is brought to you in partnership with New Relic. New Relic APM provides constant monitoring of your apps so you don't have to.

Most of us are aware of the Java Tuning using the heap sizing, GC settings. But there are several more which one can use. Please refer the following websites for more details.



I was curious to know, how the Permgen, Oldgen, Eden spaces look (I can think of Hell or Heaven as no one has experienced :) )

So I wrote a small code to test the VisualGC output from JVisualVM and following are a few results which you can see. The details need to written as it would consume some more time for me to understand / digest.

    public class StudentBean {

    private long sId;
    private String fName;
    private String sName;

    private String division;
    private String address;

    public StudentBean(long sId, String fName, String sName, String division,
    String address) {
    this.sId = sId;
    this.fName = fName;
    this.sName = sName;
    this.division = division;
    this.address = address;

    public String toString() {
    return “StudentBean [sId=" + sId + ", fName=" + fName + ", sName="
    + sName + ", division=" + division + ", address=" + address
    + "]“;

    public long getsId() {
    return sId;
    public void setsId(long sId) {
    this.sId = sId;
    public String getfName() {
    return fName;
    public void setfName(String fName) {
    this.fName = fName;
    public String getsName() {
    return sName;
    public void setsName(String sName) {
    this.sName = sName;
    public String getDivision() {
    return division;
    public void setDivision(String division) {
    this.division = division;
    public String getAddress() {
    return address;
    public void setAddress(String address) {
    this.address = address;

    import java.util.Random;

    public class StudentTest {

    public static void main(String[] args) throws InterruptedException {

    Random randomize = new Random();
    for(;;) {

    StudentBean sBean = new StudentBean(randomize.nextLong(), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()));
    Thread t = Thread.currentThread();
    synchronized (t) {



-Xms128M -Xmx256M

-Xms128M -Xmx256M -Xmn64M

-Xms128M -Xmx256M -Xmn64M -XX:+UseConcMarkSweepGC

-Xms128M -Xmx256M -Xmn64M -XX:+UseParallelGC

-Xms128M -Xmx256M -Xmn64M -XX:+UseSerialGC

I would like to experiment the other options as well. The number of permutations and combinations would be high, but wanted to have a fair idea of how the Java Memory Model changes based on the Java options which are given by the user while invoking the JRE.

Will write a more detailed report(?) based on my understanding / grasping power. :)

The Performance Zone is brought to you in partnership with New Relic. New Relic’s SaaS-based Application Performance Monitoring helps you build, deploy, and maintain great web software.


Published at DZone with permission of Jagannathan Asokan , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}