Tuesday, 30 January 2018

Weblogic forced Garbage collection for servers

========================================================================
Applies to:
Weblogic: 10.3.6 and later
OS: CentOS7
========================================================================
Procedure:
There are two ways to perform garbage collection.

Weblogic admin console:
1. Login to weblogic admin console using admin(usually weblogic) user.
2. From left pane of the Console, go to Environment => Servers.
3. On summary of servers page, select server for which you would like to perform Garbage collection.
4. Go to Monitoring => Performance
5. Click on Garbage Collect button.

Using WLST:
1. Invoke wlst.sh from $oracle_home/oracle_common/common/bin
e.g. /u02/oracle12213/middleware/oracle_home/oracle_common/common/bin
[oracle@purupoc bin]$ ./wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline>
2. Connect to admin server using below command,
connect('<<weblogic-username>>','<<weblogic-password>>','t3://<<adminserver-host>>:<<adminserver-port>>')

e.g. connect('weblogic','weblogic123','t3://localhost:7001')
wls:/offline> connect('weblogic','weblogic123','t3://localhost:7001')
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "wl_server".

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

wls:/wl_server/serverConfig/>

3. Enter into domainRuntime mode using domainRuntime()
wls:/wl_server/serverConfig/> domainRuntime()
Location changed to domainRuntime tree. This is a read-only tree
with DomainMBean as the root MBean.
For more help, use help('domainRuntime')

wls:/wl_server/domainRuntime/>

4. Go to server directory.
cd('/ServerRuntimes/<<Servername>>/JVMRuntime/<<Servername>>')
Use ls() command to check existing stats.

wls:/wl_server/domainRuntime/> cd('/ServerRuntimes/AdminServer/JVMRuntime/AdminServer')
wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer> ls()

-r--   HeapFreeCurrent                              273970360
-r--   HeapFreePercent                              61
-r--   HeapSizeCurrent                              471633920
-r--   HeapSizeMax                                  518979584
-r--   JavaVMVendor                                 Oracle Corporation
-r--   JavaVendor                                   Oracle Corporation
-r--   JavaVersion                                  1.8.0_161
-r--   Name                                         AdminServer
-r--   OSName                                       Linux
-r--   OSVersion                                    3.10.0-693.el7.x86_64
-r--   Type                                         JVMRuntime
-r--   Uptime                                       1480421


wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer>

5. Use cmo.runGC() to force garbage collection.
wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer> cmo.runGC()
wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer> ls()

-r--   HeapFreeCurrent                              311455952
-r--   HeapFreePercent                              69
-r--   HeapSizeCurrent                              471633920
-r--   HeapSizeMax                                  518979584
-r--   JavaVMVendor                                 Oracle Corporation
-r--   JavaVendor                                   Oracle Corporation
-r--   JavaVersion                                  1.8.0_161
-r--   Name                                         AdminServer
-r--   OSName                                       Linux
-r--   OSVersion                                    3.10.0-693.el7.x86_64
-r--   Type                                         JVMRuntime
-r--   Uptime                                       1691110


wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer>

6. Disconnect from AdminServer using disconnect() command
wls:/wl_server/domainRuntime/ServerRuntimes/AdminServer/JVMRuntime/AdminServer> disconnect()
Disconnected from weblogic server: AdminServer
wls:/offline> 

3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi,
    very useful info, and Your blog Content Attracting Visitors to read and Spend sometime. The Information which you provided is very much useful for WebLogic Training Learners

    ReplyDelete
  3. Useful information.I am actual blessed to read this article.thanks for giving us this advantageous information.I acknowledge this post.and I would like bookmark this post. Hope more articles from you. i also want to share about the weblogic application server tutorial with free Bundle videos.

    ReplyDelete