Portlet load monitoring for WebSphere Portal
Portlet load monitoring, new with v8.0, allows administrators to set...
- Allowed number of concurrent requests
- Allowed average response time
If a portlet exceeds either the defined maximum number of concurrent requests, or the average response time, then Portlet Load Monitoring no longer allows further requests by the portlet. Instead, the portal renders the portlet as unavailable, and the portlet code is no longer called for further requests. This way, the portal installation is protected from non-responsive portlets consuming an increasing number of threads. For example, if set to 50, average response time is calculated from the latest 50 requests that this portlet served. These settings apply to all portlets that Portlet load monitoring monitors.
Portlet preferences configuration and administration
We can set the following parameters for individual portlets in portlet.xml before deploying or later using the Manage Portlets portlet.
- Maximum number of concurrent requests allowed for a portlet
- Reactivation limit of concurrent requests allowed for reactivating the portlet
- Allowed average response time
We can also perform the following administrative tasks on individual portlets using the Manage Portlets portlet only:
- Check whether a portlet is being monitored by Portlet load monitoring
- Manually reenable a portlet that Portlet load monitoring has blocked
- Manually block a portlet monitored by Portlet load monitoring from responding to requests.
Configure Portlet load monitoring
Add the following properties to resource environment provider WP ConfigService. These parameters affect all parameters in the portal:
com.ibm.wps.plm.enabled Enable and disable. Default is disabled (false). com.ibm.wps.plm.statistics.requestnumber Number of samples for the calculation of the average response time for a portlet. Default is 50, where average response time is calculated from the 50 latest requests that this portlet served.
Portlet configuration
Configure these portlet preferences using portlet.xml before deploying the portlet or after the deployment using the Manage Portlets portlet.
- com.ibm.wps.pe.plm.maxrequest
- Maximum number of concurrent requests allowed for a portlet. If the number of requests that the portlet serves at any time exceeds the maximum number of concurrent requests specified, then Portlet load monitoring blocks further requests to this portlet. Instead of responding to the requests the portlet renders with a message stating that the portlet is not available. To re-enable this portlet for rendering, a portal administrator can enable the portlet using the Manage Portlets portlet.
- com.ibm.wps.pe.plm.minrequest
- Reactivation limit for a portlet. Use for a recovery process. If Portlet load monitoring blocked the portlet because it exceeded the maximum number of allowed concurrent requests, then no more requests to this portlet are allowed. If the portlet then completes its active requests after some time, the number of concurrent requests currently served by the portlet decreases. If the number of concurrent requests in the portlet falls back down to the reactivation limis specified for the portlet preference parameter...
com.ibm.wps.pe.plm.minrequest
Portlet load monitoring enables the portlet for responding to requests and rendering again. This setting is subject to two restrictions:
- This setting is only evaluated when set the maximum number of concurrent requests using the parameter...
com.ibm.wps.pe.plm.maxrequest
- This value must be less than the maximum number of concurrent requests that you entered for the parameter...
com.ibm.wps.pe.plm.maxrequest
Example 1: The portlet to respond to requests again when it has no more than three active requests open, set the portlet preference parameter...
com.ibm.wps.pe.plm.minrequest = 3
Example 2: If set the maximum number of concurrent requests for a portlet to 10 using the parameter...
com.ibm.wps.pe.plm.maxrequest
and the reactivation limit of concurrent requests for the same portlet to three using the parameter...
com.ibm.wps.pe.plm.minrequest
...Portlet load monitoring works as follows:
- When the portlet exceeds 10 and reaches 11 concurrent requests, Portlet load monitoring blocks the portlet from further requests.
- When the portlet completes 8 active requests and has three active requests to complete, Portlet load monitoring allows the portlet to respond to incoming requests again.
- com.ibm.wps.pe.plm.average.time.processing
- Allowed average response time for the portlet. Specify value in milliseconds. If the portlet exceeds the average response time specified, then Portlet load monitoring blocks further requests to this portlet. To reenable this portlet for rendering, a portal administrator can enable the portlet using the Manage Portlets portlet.
For example: To specify 3 seconds as the average response time allowed for a portlet, set the portlet preference...
com.ibm.wps.pe.plm.average.time.processing to 3000
Administer Portlet load monitoring
We can administer Portlet load monitoring and the portlets that it monitors. We can determine whether and in which cases Portlet load monitoring blocks or reenables a portlet by setting its portlet preferences. We can also check which portlets Portlet load monitoring monitors, and we can manually block or activate these portlets.
For example, we can reenable a portlet after Portlet load monitoring has blocked it.
Administer portlet preferences for Portlet load monitoring
We can set portlet preferences to influence in which cases Portlet load monitoring blocks or reenables JSR portlets.
Configure parameters for the following:
- Maximum number of concurrent requests
- Reactivation limit of concurrent requests for reactivating the portlet
- Allowed average response time.
To set these parameters...
- Log in to the portal using a portal administrator user ID.
- Select...
Administration | Portlet Management | Portlets | portlet | Configure Portlet icon
- Add a new portlet preference as required and type number for the new portlet preference as required:
- To set the maximum number of requests to allow for this portlet, add...
com.ibm.wps.pe.plm.maxrequest = xyz
For example, to allow this portlet no more than 15 concurring requests, specify...
com.ibm.wps.pe.plm.maxrequest = 15
- To set the reactivation limit for this portlet, add...
com.ibm.wps.pe.plm.minrequest = xyz
For example, if you want this portlet to be reenabled when its concurrent requests fall back to 5 or less, specify...
com.ibm.wps.pe.plm.minrequest = 5
- To set the allowed average response time for this portlet, add...
com.ibm.wps.pe.plm.average.time.processing = xyz
...where xyz is the average response time in milliseconds.
For example, if we specify...
com.ibm.wps.pe.plm.average.time.processing = 3000
...and the average response time for this portlet exceeds 3 seconds, then Portlet load monitoring blocks further requests to this portlet.
- Click the Add button to add the preference.
- Save the changes by clicking the OK button.
As an alternative, we can define a portlet preference before deploying the portlet. In this case add the portlet preference to the portlet.xml deployment descriptors of the WAR file.
Administer portlets for Portlet load monitoring
We can administer the portlets that Portlet load monitoring monitors. We can check which portlets Portlet load monitoring monitors, and we can manually block or activate these portlets.
For example, we can reenable a portlet after Portlet load monitoring has blocked it.
To do this, we use the Manage Portlets portlet. Proceed by the following steps:
- Log in to the portal using a portal administrator user ID.
- Select...
Administration | | Portlet Management | Portlets | portlet
- Administer the portlet as required:
- For each portlet that is monitored by Portlet load monitoring, the Manage Portlets portlet displays an icon for disabling or enabline that portlet.
- If a portlet that is monitored by Portlet load monitoring is currently active, the list shows an icon for disabline that portlet. If you click this icon, the portlet is blocked by Portlet load monitoring and is no longer rendered in the portal.
- If a portlet that is monitored by Portlet load monitoring is currently blocked and inactive, the list shows an icon for enabline that portlet. If you click this icon, the portlet is enabled for rendering again.
- If the portlet was blocked for exceeding the maximum number of concurrent requests and the number of requests did not decrease and you did not set the value for maximum number of requests to a higher value, clicking this icon has no effect. In this case, the portlet is blocked again with the next request that arrives for this portlet.
- Activating a blocked portlet clears the response times stored for this portlet.
Log and audit events
Portlet load monitoring allows us to log events.
For example, this can help you audit events. When Portlet load monitoring blocks or enables a portlet, it creates a log file entry in the WebSphere Portal log file SystemOut.log . This log file entry contains the portlet object ID, the portlet name, the WAR file name of the portlet and the EAR file display name. The log file entries consist of translated messages. If we use tools that monitor log files for events, we can check for log file entries related to Portlet load monitoring as described in the following.
Portlet load monitoring creates log file entries for the events described in the following.
- Portlet load monitoring blocks a portlet because the portlet exceeds the maximum number of requests.
- If Portlet load monitoring blocks a portlet because it exceeded the maximum number of concurrent requests specified for it, Portlet load monitoring creates the following log file entry with the message code EJPPG3001W:
EJPPG3001W: Portlet load monitoring disabled the portlet with object ID: Object_ID, portlet name: Portlet_Name, WAR file name: WAR_File_Name, EAR file display name: EAR_File_Display_Name, because the portlet exceeded its maximum number of requests.
- Portlet load monitoring blocks a portlet because the portlet exceeds the average response time.
- If Portlet load monitoring blocks a portlet because that portlet exceeded the average response time specified for this portlet, Portlet load monitoring creates the following log file entry with the message code EJPPG3002W:
EJPPG3002W: Portlet load monitoring disabled the portlet with object ID: Object_ID, portlet name: Portlet_Name, WAR file name: WAR_File_Name, EAR file display name: EAR_File_Display_Name, because the portlet exceeded its average response time.
- Portlet load monitoring activates a portlet because the portlet returns to the reactivation limit.
- If Portlet load monitoring reenables a blocked portlet because the blocked portlet falls back down to the reactivation limit of concurrent requests defined for the portlet, Portlet load monitoring creates the following log file entry with the message code EJPPG3003I:
EJPPG3003I: Portlet load monitoring reenabled the portlet with object ID: Object_ID, portlet name: Portlet_Name, WAR file name: WAR_File_Name, EAR file display name: EAR_File_Display_Name because number of portlet requests fell below the reactivation limit.
- Administrator manually blocks requests to a portlet.
- If a portal administrator manually blocks requests to a portlet, Portlet load monitoring creates the following log file entry with the message code EJPPD0101I:
EJPPD0101I: Portal administrator admin_user_ID manually blocked requests to the portlet with object ID: Object_ID, portlet name: Portlet_Name, WAR file name: WAR_File_Name, EAR file display name: EAR_File_Display_Name
- Administrator manually unblocks requests to a portlet.
- If an administrator manually unblocks requests to a blocked portlet, Portlet load monitoring creates the following log file entry with the message code EJPPD0100I:
EJPPD0100I: Portal administrator admin_user_ID manually unblocked requests to the portlet with object ID: Object_ID, portlet name: Portlet_Name, WAR file name: WAR_File_Name, EAR file display name: EAR_File_Display_Name.
In the log entry, the variables Object_ID, Portlet_Name, War_File_Name, EAR_File_Dislay_Name, admin_user_ID are substituted with the corresponding values for the affected portlet and the administrative user.
Example: If Portlet load monitoring blocks a portlet with the portlet name StdWorldClock because the portlet exceeded the maximum number of requests allowed, then the log file entry might look like this:
EJPPG3001W: Portlet load monitoring disabled the portlet with ObjectID: [ObjectIDImpl '3_MLSU3F540O0360ISG212TT2003', PORTLET_DEFINITION, VP: 0, [Domain: rel], DB: 0000-B6723F5E2100836180E45004D1BB0060], portlet name: StdWorldClock, WAR file name: StdWorldClock.war, EAR file display name: PA_StandardWorldClock because portlet exceeded its maximum number of requests.
API for accessing Portlet load monitoring data
Portlet load monitoring provides an API for accessing the monitoring data. We can use this API to write custom code to access that data.
Portlet load metrics interface
The PortletLoadMetrics object is defined in the package...
com.ibm.portal.plm.PortletLoadMetrics
It contains metrics data for one specific PortletDefinition. The interface looks as follows:
package com.ibm.portal.plm; /* * This interface provides access to portlet metrics stored for Portlet Load Monitoring. */ public interface PortletLoadMetrics { /* * Returns true if the portlet is enabled for rendering (either by admin or by PLM). * If the portlet is disabled for rendering, this method returns false. * * @return boolean true if the portlet is enabled either by admin or by PLM. */ public abstract boolean isPortletEnabled(); /* * Checks if the Portlet is currently enabled for rendering due to PLM constraints. * If PLM disabled the portlet for rendering, this method returns false. * * @return boolean true if the Portlet is enabled for rendering, false if the Portlet is disabled for rendering. */ public abstract boolean isPortletEnabledByPLM(); /* * Returns true if the portlet is manually enabled by the portal administrator. * If the portal administrator disabled the portlet for rendering, this method returns false. * * @return boolean true if the portlet is enabled for rendering by the portal administrator. */ public abstract boolean isPortletEnabledByAdmin(); /* * Returns the number of requests this portlet currently serves. * * @return int number of requests this portlet currently serves. */ public abstract int getCurrentNumberOfRequests(); /* * Calculates the average response time for requests of this portlet in milliseconds. * * @return int average response time of the portlet in milliseconds. */ public abstract int getAverageResponseTime();
Portlet load metrics service
The isPortletLoadMetricsService is contained in the package com.ibm.portal.plm.service.PortletLoadMetricsService. We can use this service to access PortletLoadMetrics objects. It also allows us to query general Portlet load monitoring related information. To obtain the PortletLoadMetricsService, you have to perform a JNDI lookup in the following way:
PortletLoadMetricsEnabled(ObjectID portletID) plm; javax.naming.Context ctx = new javax.naming.InitialContext(); try { plm = (PortletLoadMetricsService ctx.lookup(PortletLoadMetricsService.JNDI_NAME); } catch(javax.naming.NameNotFoundException ex) { ... error handling ... }Once you successfully obtained the PortletLoadMetricsService, we can use methods as defined in the PortletLoadMetrics interface:public interface PortletLoadMetricsService { String JNDI_NAME = "portal:service/plm/PortletLoadMetrics"; /** * Determines if PLM is enabled for a given portlet. * * @param portletID ObjectID of the portlet. * @return true If PLM is enable for a given portlet. * false If PLM is not enabled for a given portlet or if portlet does not exist. */ boolean isPortletLoadMetricsEnabled(ObjectID portletID); /** * Returns a PortletLoadMetrics object for the portlet. * Creates the PortletLoadMetrics if PLM is enabled for this portlet and * it the PortletLoadMetrics object does not yet exist. * * @param portletID ObjectID of the portlet. * @return Reference to a PortletLoadMetrics object. * Null if PLM is not enabled for the specified portlet. */ PortletLoadMetrics getPortletLoadMetrics(ObjectID portletID); /** * Returns a String object containing the portlet preference value set for maximum concurrent * requests allowed for this portlet. * * @param portletID ObjectID of the portlet. * @return String containing the portlet preference value set for maximum concurrent * requests allowed for this portlet. Returns "null" if the portlet did not set the * portlet preference for maximum concurrent requests. */ String getMaximumRequestPreferenceValue(ObjectID portletID); /** * Returns a String object containing the portlet preference value set for the * reactivation limit for this portlet (PLM self-healing) * * @param portletID ObjectID of the portlet. * @return String containing the portlet preference value set for the reactivation * limit for this portlet (PLM self-healing). Returns "null" if the portlet * did not set the portlet preference for the reactivation limit. */ String getMinimumRequestPreferenceValue(ObjectID portletID); /** * Returns a String object containing the portlet preference value set for allowed average * response time for this portlet * * @param portletID ObjectID of the portlet. * @return String containing the portlet preference value set for allowed average * response time for this portlet. Returns "null" if the portlet * did not set the portlet preference for allowed average response time. */ String getAverageResponseTimePreferenceValue(ObjectID portletID); /** * Returns a Map containing all PortletLoadMetrics objects. * * @return Map<ObjectID, PortletLoadMetrics> containig all PortletLoadMetrics objects. * Key of the Map is the ObjectID of the PortletDefinition. * The value of the Map is the PortletLoadMetrics object of the PortletDefinition. */ Map<ObjectID, PortletLoadMetrics> getAllPortletLoadMetricsObjects(); }
Parent: Monitoring
Related: Administer Portlet load monitoring
Administer Portlet load monitoring
Log and audit events
Configure Portlet load monitoring
Administer portlet preferences for Portlet load monitoring
API for accessing Portlet load monitoring data