Wednesday, 1 May 2013

Verbose Garbage Collection logging in the WebSphere Liberty Profile

As part of an exercise to help a colleague, who was trying to work out how to enable verbose GC logging within the WAS Liberty Profile, I've just installed Liberty and the WAS Developer Tools onto my Mac.

I used this excellent blog post: -


as inspiration, as well as an earlier blog post of mine: -


I downloaded Eclipse Indigo from the Eclipse site here into which I installed the WAS 8.5 Liberty Profile Developer Tools.

I also downloaded the Liberty code directly from here which resulted in: -

wlp-developers-8.5.0.2.jar

and installed it here: -

/Users/hayd/Downloads/wlp

I then referred to this IBM Technote: -

Setting generic JVM arguments in the WebSphere Application Server V8.5 Liberty profile

which directs one to create a jvm.options file, containing the line: -

-verbose:gc

There are two options for the location of this file - from the Technote: -

Depending on your preferences, you might configure a single JVM or all Liberty JVMs with your options file.

To apply these settings to a single server, save jvm.options at:

${server.config.dir}/jvm.options 

To apply these changes to all Liberty JVMs, save jvm.options at:

${wlp.install.dir}/etc/jvm.options

This will take effect for all JVMs that do not have a locally defined jvm.options file.

I found that, for the second of these - {wlp.install.dir}/etc/ -  I had to manually create the etc subdirectory here: -

/Users/hayd/Downloads/wlp/etc

Once I restarted my JVM: -

/Users/hayd/Downloads/wlp/bin/server stop MyInstance
/Users/hayd/Downloads/wlp/bin/server start MyInstance

I could see the Verbose GC data being logged: -

Launching MyInstance (wlp-1.0.2.cl0220130316-0213/websphere-kernel_1.0.2) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_21-b12 (en_US)
[AUDIT   ] CWWKE0001I: The server MyInstance has been launched.
[GC 24640K->6261K(94144K), 0.0080240 secs]
[GC 30901K->7789K(94144K), 0.0114560 secs]
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[GC 32429K->12040K(94144K), 0.0106580 secs]
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/Pickle/*
[AUDIT   ] CWWKZ0001I: Application Pickle started in 0.92 seconds.
[ERROR   ] SRVE0164E: Web Application Pickle uses the context root /Pickle/*, which is already in use by Web Application Pickle. Web Application Pickle will not be loaded.
[AUDIT   ] CWWKZ0001I: Application PickleEAR started in 0.70 seconds.
[AUDIT   ] CWWKF0011I: The server MyInstance is ready to run a smarter planet.


here: -

/Users/hayd/Downloads/wlp/usr/servers/MyInstance/logs/console.log

I also tested placing the jvm.options file into the server.config.dir location instead: -

/Users/hayd/Downloads/wlp/usr/servers/MyInstance

and saw the same effect - verbose GC was enabled when I started the server.

Finally, this IBM Technote: -


was also of use to me in determining the precise location of the wlp.install.dir and shared.config.dir locations

4 comments:

Unknown said...

Hi, this line draw me to your post: "[ERROR ] SRVE0164E: Web Application Pickle uses the context root /Pickle/*, which is already in use by Web Application Pickle. Web Application Pickle will not be loaded."

I'm getting the same error when trying to deploy my web application in Websphere Liberty. Would you know what is causing it and how to solve the error?

Dave Hay said...

@Moises

You'd typically see that exception if you had two Web Applications (WAR files) using the same context root.

For example, if you had TWO .WAR files in the dropins folder: -

~/wlp/usr/servers/defaultServer/dropins/

both of which had the same context root of Pickle, then you'd see that exception.

Cheers, Dave

Unknown said...

Dave: I've already checked that, there is a single web app being deployed. Same as in your log, the new and already deployed conflicting applications are in fact the same. No wonder they have the same root. Somehow Websphere seems to be trying to deploy the app twice. Keep swimming.

Dave Hay said...

@Moises

Check your server.xml as per this example: -

/Users/hayd/wlp/usr/servers/defaultServer/server.xml

for lines such as this: -

...
application id="Liberty1" location="Liberty1.war" name="Liberty1" type="war"/
...

Cheers, Dave

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...