Wednesday, August 1, 2012

Serviceability gem: HTTP Session debugging in WebSphere Application Server - IBMTrackerDebug. servlet

Techniques for HTTPSession debugging in WebSphere Application Server

To dynamically view the number of sessions as a Web application is running, enable performance monitoring for HTTP sessions. This will give you an indication as to whether sessions are actually being created.

Alternatively, a special servlet can be invoked that displays the current configuration and statistics related to session tracking. This servlet has all the counters that are in performance monitor tool and has some additional counters.
  • Servlet name: com.ibm.ws.webcontainer.httpsession.IBMTrackerDebug.
  • It can be invoked from any Web module which is enabled to serve by class name. For example, using default_app, http://localhost:9080/servlet/com.ibm.ws.webcontainer.httpsession.IBMTrackerDebug.
    Note: If you have enabled the serve-by-class-name feature and want to disable the IBMTrackerDebug servlet, then specify the web container custom property, com.ibm.ws.webcontainer.donotservebyclassname.See Web container custom properties for more information on how to set this property.
  • If you are viewing the module via the serve-by-class-name feature, be aware that it may be viewable by anyone who can view the application. You may wish to map a specific, secured URL to the servlet instead and disable the serve-servlets-by-classname feature.

1 comments:

Anonymous said...

In addition you can use "SessionInspectServlet" to investigate what details are stored in HttpSession of your application:

-Names of the session attributes

-Size of the data in session attribute

-If the attribute is serializable or not

You might want to use this when you start getting NotSerializableException or you run into performance issue due to size of data stored in session.

E.g. https://a.b.c/MYAPP/servlet/com.ibm.ws.webcontainer.httpsession.SessionInspectServlet

(... ~/servlet/~ is the hidden invoker servlet, which is always "on" by default if not have disabled "serveServletsByClassnameEnabled" property to false in the ibm-web-ext.xmi file or by setting webcontainer custom property "com.ibm.ws.webcontainer.donotservebyclassname=true".

Session object details:
Creation time :Wed May 09 15:11:48 CEST 2012
Max inactive time :7200

Non Serializable attributes in session (attribute names):
1) menuLeftPermission
2) menuTopPermission

Serializable attributes in session (attribute names and their sizes in bytes):
1) racfLastAccess----------------26
2) org.apache.struts.action.TOKEN----------------39
3) userIsInABCDEFGHIJKLMNOP----------------47
4) screenHeight----------------81
5) sessionLoginUserDetail----------------1670
6) org.apache.struts.action.LOCALE----------------127
7) currentURI----------------31
8) popupHeight----------------10
9) awTableHeight----------------12
Total Size of all serializable attributes = 2043

No errors serializing/deserializing attributes currently present in session