Configure Portlet Load monitoring for maximum response time

The WebSphere Portal Server 7.0 introduced concept of portlet load monitoring, it lets you set maximum response time for a portlet and if the response time exceeds that time, WPS will block that portlet and would disable further request to that portlet.

I wanted to try this feature so i followed these steps


  • First enable Portlet load monitoring at portal server level

  • Then i created HelloPLM simple portlet that takes 10 seconds to respond.

    package com.wpcertification.wp70.plm;
    import java.io.IOException;
    import javax.portlet.GenericPortlet;
    import javax.portlet.PortletException;
    import javax.portlet.RenderRequest;
    import javax.portlet.RenderResponse;
    public class HelloPLMPortlet extends GenericPortlet{

    protected void doView(RenderRequest request, RenderResponse response)
    throws PortletException, IOException {
    System.out.println("Entering HelloPLMPortlet.doView()");
    try {
    Thread.sleep(10000);
    } catch (InterruptedException e) {
    e.printStackTrace(System.out);
    }
    response.setContentType("text/html");
    response.getWriter().println("Inside HelloPLMPortlet.doView()");
    System.out.println("Exiting HelloPLMPortlet.doView()");
    }
    }

    In the doView() method i am using Thread.sleep() call to block request for 10 seconds. You can download this sample application from here

  • Then i installed the portlet on the WPS 70 server

  • Once the portlet is installed, you can enable PLM for it by setting com.ibm.wps.pe.plm.average.time.processing preference. Value of this preference defines what is the maximum allowed time for this portlet. Example: If you want to specify the average response time allowed for a portlet as 3 seconds, set the portlet preference com.ibm.wps.pe.plm.average.time.processing to a value of 3000 (milliseconds) for this portlet. If portlet takes more than that time it will blocked


    In my case i am setting the maximum allowed time to 900 milliseconds which is less than 1 second

  • After setting the preference when i looked at the portlet in manager portlet, i could see that it had one additional button that would let me block the portlet manually


  • Then i went to a page which has HelloPLM portlet and it took 10 seconds to respond and on the first request it did render the output correctly but in the SystemOut.log file i could see this message

    [9/4/10 17:34:26:927 PDT] 00000067 GlobalPortlet W com.ibm.wps.pe.pc.waspc.plm.GlobalPortletLoadMonitoringFilter handlePreFilterInvocation() EJPPG3002W: Portlet Load Monitoring disabled the portlet with object ID: [ObjectIDImpl 'Z3_OGFLMKG10G0HE0IAR5N7GE3007', PORTLET_DEFINITION, VP: 0, [Domain: rel], DB: 0000-18BE6A290C0082E88054BBDC03DD00E0], portlet name: Hello PLM portlet, WAR file name: HelloPLM.war, EAR file display name: PA_HelloPLM because the portlet exceeded its average response time.

    The HelloPLM portlet took more than the allowed time so it was disabled

  • Now when i went to Manage portlet, portlet i could see that the portlet is disabled, from the request you can see that the portlet exceeded limit


  • Now if i go to the page which has the HelloPLM portlet, then i directly get portlet unavailable message without the portlet being called at all


  • You can unblock the portlet from Portal Admin Console

No comments: