Garbage Collection in Websphere Application Server And It’s Type

Garbage Collection: It is automatic memory management system, and Garbage Collector is used to collect all unused Java heap memory which are no longer used by objects. So that Memory can be used by other objects which are needed for application.


As long as objects are alive and are in use by application They are needed  for JVM.And once objects are not in use by application then they are not needed by JVM. Those unused objects are removed by Garbage Collection and memory got reclaimed upon that.

or when JAVA Heap is getting full and not able to satisfy a request for New object creation Then it automatically starts garbage Collection to free memory.

We have four Different Garbage Collection Policy in Websphere.

  • Optimize for throughput(-Xgcpolicy:optthruput)
  • Optimize for pause time(-Xgcpolicy:optavgpause)
  • Generational concurrent(Xgcpolicy:gencon)
  • balanced(Xgcpolicy:balanced)


Default Websphere Garbage Collection  policy in Websphere 8 is gencon.

Default Websphere Garbage Collection  policy in Websphere 7 is optthruput.


Optimize for throughput(optthruput) Garbage


optthruput is the Default policy. and also referred as mark-sweep-compact collector.

Mark phase will mark all live objects which are used by application.

Sweep phase will remove all objects which are unmarked.

in these policy after execution of that 2 phased we can have one compaction phase as well that depends on possibility like

Lets take an example when unmarked objects get cleared so frequently , and we have a number of small free chunks left in memory on different locations.

There are number of small chunks, But by gathering that small chunks we can have large heap space.

In these case Compaction will move all the objects to the beginning of the Heap and align them like no small chunk space left.


Garbage Collection in Websphere Application Server
Garbage Collection in Websphere Application Server optthruput



optthruput consume entire heap before invoking garbage collection so does we have long pause in application.


Optimize for pause time(optavgpause) Garbage Collection

That also uses mark and sweep phases, But application Pause will be shorter as compared to optthruput.
But application throughput is reduced because garbage collection is working while application is running.
In  these policy it is doing garbage collection works  parallel with application. So have less pause time.

If you have multiple and large number of short-lived object than you should use gencon policy .


Generational(gencon) Garbage Collection

In gencon Policy , it uses and divide memory into two spaces one for short lived object and another for longer lived object.

Named as nursery space for short-lived object and   tenured space for Longer-lived objects.

Pause time is also shorter than other produce good throughput.

Heap fragmentation is also reduced in gencon.

It is default policy in websphere version 8

Balanced Garbage Collection

Balanced Garbage Collection is new in Websphere Application server, It got introduced version 8 of Websphere.

It also uses mark,sweep , compact and style garbage collection. It disable the concurrent mark phase.It used a region based layout .

It splits Java heap in to regions and garbage collection works on those regions.

As those region individually managed under garbage collection thus it reduced maximum pause time which occurs in clearing large heap.

That policy is designed for 64 bit Websphere application servers with minimum 4GB heap space.

It has degraded performance as compared to gencon


Please follow and like us:

  1 comment for “Garbage Collection in Websphere Application Server And It’s Type

  1. gracylayla
    April 24, 2018 at 2:59 pm

    When choosing an application server platform on which to run applications and services, architects and developers need to know that WAS will support new JEE features and improved coding practices. WAS has evolved as a product with each new update of the JEE standard, and IBM has continued to provide new versions of WAS to support available features of each new JEE release.

Leave a Reply

Your email address will not be published. Required fields are marked *