Monday, July 28, 2014

Get the thread dump for weblogic server from command prompt

Open the command prompt and type jps.
This will give the PID of the server.
>jps

Then type jstack <PID> on command prompt . This will give the thread dump
>jstack 3176

How to get garbage collection statistics

Get the ProcessID using jps command
Then execute the jstat command with the following option
-gccause
-h10  : number of lines
-<PID> : processID
-2000 : time interval


D:\>jstat -gccause -h10 3176 2000
  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
 27.88   0.00  32.55  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC


Where S0 and S1 are survivor spaces
 E is Eden space
 O Old Generation Size
 P Permanent generation
YGC Young Garbage Collection
YGCT Time taken for Young Garbage Collection
FGC FullGarbage Collection
FGCT Time taken for  FullGarbage Collection
GCT Total Garbage Collection Time

How to get the ProcessID of weblogic server in windows

Open the command prompt and type the command jps. This will give the process and their IDs as shown below. The ID corresponding to Server is the weblogic server processId


How to configure JMX Port for weblogic managed servers

There could be situations we need to set JMX Port on the managed servers to allow monitoring tools like VisualVM to connect to the managed server and get the server statistics.

 To configure the JMX port just add the following as the arguments for JVM in the setDomainEnv.sh or setDomainENV.cmd as shown below

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8500 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder