SyntaxHighlighter

Wednesday, December 12, 2012

Part 3: Troubleshoot Connection Leak - Using WLDF

Overview:
In Part 2 of this series, we have seen how we can access weblogic server remotely using JMX API and monitor connection leak.

In this post, We will end "Connection Leak" trip journey by looking how we can achieve the same within Weblogic by configuring "Weblogic Diagnostic Framework (WLDF)" and assigning it a task we are interested in (in our case monitoring "Connection Leak") and configure WLDF to send an alert via email.


Introduction:
Weblogic Diagnostic Framework provides a runtime monitoring capablities at various component/module level to gather statistics of the server instance.

Let's go through step by step and see how to create
  1. WLDF module.
  2. Watches and Notification.
  3. Configure JDBC MBean to monitor Connection Leak etc...
STEP 1: Start Admin Server and login to console. In the left hand bar--> Click Diagnostic Modules.


STEP 2: Click "New" button as shown below. 



STEP 3: Give any name to your Diagnostic Module as below. e.g "WLDF_ConnectionLeak" and click "OK"


STEP 4: You will see "WLDF_ConnectionLeak" is created. Now click on it.


STEP 5: Now its time to set "Watches and Notification" module. On Page, select "Watches" tab from the lower pane and click "New" button.


STEP 6: Give any name to your "Watches" module. e.g Connection_Leak_Detector" and select following configuration as shown below. Click "Next".

STEP 7: Now lets add expressions, like what you want this Watches Module to watch. Click "Add Expression" button.

STEP 8: Select Server location , Domain Runtime or Server Runtime. Choose ServerRuntime option as we are going to monitor runtime information.

STEP 9: Choose What kind of MBean you want to configure. We are looking to JDBC DataSource monitoring, so select "JDBCDataSourceRuntimeMBean".

STEP 10: Choose which server instance you want to configure.

STEP 11:  Choose what feature you want to enable from JDBCDataSourceRuntimeMBean as we selected above. I selected Connection Leak Count > 0

STEP 12: Verify your condition or exression and click "Finish" button.


STEP 13: Choose Alarm option.

STEP 14: Our Watches module has been configured successfully. Now time to configure "Notification", so that if Watch module finds our criteria we configured, he can notifiy via Notification module. Click "New" button on Notification tab.



STEP 15: Choose mode of Notification. I chose "SMTP(E-Mail)". Click Next.

STEP 16: Enable Notification and give Notification module a name. e.g Connection_Leak_Notification.

STEP 17: Configure EMAIL properties and click "Finish".



STEP 18: Now we got to associate our Notification Module with "Watches" module we created.

STEP 19: Once we are done. Click on the "Target" tab for WLDF module and associate it to the server instance.

Based on above configurations we did,Weblogic server will generate following XML under $DOMAIN_HOME/config/diagnostics/WLDF_MODULE_NAME.xml file.
WLDF_ConnectionLeak
  
    true
    60000
  
  
    
      Connection_Leak_Detector
      true
      Harvester
      (${ServerRuntime//[weblogic.management.runtime.JDBCDataSourceRuntimeMBean]com.bea:Name=TestPool,ServerRuntime=AdminServer,Type=JDBCDataSourceRuntime//LeakedConnectionCount} > 0)
      
      Connection_Leak_Notification
    
    
      Connection_Leak_Notification
      true
      TestMail
      
      
      rajesh.k.khullar@verizon.com
    
  
STEP 20: Deploy application code which grabs the connection and never returns back as we did in "Part 1 : Troubleshoot Connection Leak- Using Weblogic Server".

STEP 21: Watches Module will start printing Leak Connection related information in server log file as below.


STEP 22: Watch out for email coming to your inbox as below:


With this, we will end our Connection Leak troubleshooting.Hope it helps troubleshooting. 

Enjoy !

3 comments:

  1. thank you, Rajesh. it helps. Appreciate it.

    ReplyDelete
  2. that was an excellent tutorial! thanks a lot.

    ReplyDelete