Improving application performance and optimizing application performance is key to enhancing user experience with websites. Monitoring individual portlet load times and optimizing individual portlets can contribute to better user experience and better overall performance of an application.

Liferay provides an easy way of displaying individual portlet load times in a page.

Adding the following properties to portal-ext.properties will display portlet load times for all the portlets in the webpage in a commented out section of the rendered page’s source. Please note that these properties are not advised in a production environment.

monitoring.data.sample.thread.local=true
 monitoring.level.com.liferay.monitoring.Portal=HIGH
 monitoring.level.com.liferay.monitoring.Portlet=HIGH
 monitoring.portal.request=true
 monitoring.portlet.action.request=true
 monitoring.portlet.event.request=true
 monitoring.portlet.render.request=true
 monitoring.portlet.resource.request=true
 monitoring.show.per.request.data.sample=true
 

In our example, we will be using an out-of-the-box Liferay 6.2 EE GA1 SP4 bundled with Tomcat for simplicity purposes. We created a new page on the website and called it “documents”. On the documents page, we added the “Documents and Media” portlet. After we added Documents and Media portlet to the documents page, we refreshed the page so that we get the portlet load times for all the portlets on the webpage. Load times for all the included portlets are displayed before the </body@gt; tag of the HTML source of the rendered webpage.

The following HTML code has the load times for all the portlets on the page. All times are displayed in seconds.

<!--
{displayName=Documents and Media, portletId=20, requestType=RENDER,
 {attributes=null, companyId=10153, description=null,
 duration=126, name=20, namespace=com.liferay.monitoring.Portlet,
 requestStatus=SUCCESS, stopWatch=0:00:00.126, timeout=0, user=10405}}<br />
{displayName=Kaleo Designer Loader, portletId=1_WAR_kaleodesignerportlet, requestType=RENDER,
 {attributes=null, companyId=10153, description=null,
 duration=1, name=1, namespace=com.liferay.monitoring.Portlet,
 requestStatus=SUCCESS, stopWatch=0:00:00.001, timeout=0, user=10405}}<br />
{displayName=Dockbar, portletId=145, requestType=RENDER,
 {attributes=null, companyId=10153, description=null,
 duration=29, name=145, namespace=com.liferay.monitoring.Portlet,
 requestStatus=SUCCESS, stopWatch=0:00:00.029, timeout=0, user=10405}}<br />
{requestURL=http://localhost:8080/html/common/themes/portal.jsp.jsp_display,
 {attributes=null, companyId=10153, description=Portal Request,
 duration=45, name=/html/common/themes/portal.jsp, namespace=com.liferay.monitoring.Portal,
 requestStatus=SUCCESS, stopWatch=0:00:00.045, timeout=-1, user=10405}}<br />
 -->

From the above example, we can see that Documents and Media portlet took 126 milliseconds to load, Kaleo Designer Loader took 1 millisecond to load and Dockbar took 29 milliseconds to load.

Share This