Showing posts with label Administerparallelportletrendering. Show all posts
Showing posts with label Administerparallelportletrendering. Show all posts

Parallel Rendering of Portlet Sample

Attaching sample potlet application that you can use for playing with Parallel Rendering of portlet. First Install PrallelRenderingTest.war file as portlet application. It has 4 portlets. Add all of them on one page say Parallel rendering Test Page.
In the sample portlet i am printing name of the current thread and for parallel rendering 1 and 2 portlet i have Thread.sleep() statement to put current render() request in sleep.
When you try to access the Parallel rendering test page you should see output like this[9/26/08 6:15:33:549 EDT] 000000ab SystemOut O Entering ParallelRenderingPortlet1 WebContainer : 6 Fri Sep 26 06:15:33 EDT 2008[9/26/08 6:15:35:164 EDT] 000000ab SystemOut O Exiting ParallelRenderingPortlet1 Fri Sep 26 06:15:35 EDT 2008[9/26/08 6:15:35:170 EDT] 000000a9 SystemOut O Entering ParallelRenderingPortlet 2 WebContainer : 6 Fri Sep 26 06:15:35 EDT 2008[9/26/08 6:15:38:673 EDT] 000000a9 SystemOut O Exiting ParallelRenderingPortlet 2 Fri Sep 26 06:15:38 EDT 2008[9/26/08 6:15:38:677 EDT] 000000a9 SystemOut O Entering Sequential rendering portlet 2 WebContainer : 6 Fri Sep 26 06:15:38 EDT 2008[9/26/08 6:15:38:677 EDT] 000000a9 SystemOut O Exiting Sequential rendering portlet 2 Fri Sep 26 06:15:38 EDT 2008[9/26/08 6:15:38:681 EDT] 000000a9 SystemOut O Entering Sequential rendering portlet 1 WebContainer : 6 Fri Sep 26 06:15:38 EDT 2008[9/26/08 6:15:38:681 EDT] 000000a9 SystemOut O Exiting Sequential rendering portlet 1 Fri Sep 26 06:15:38 EDT 2008As you can see the Thread Name for all 4 portlets is WebContainer : 6.
Now enable the parallel rendering at portla server level and at the portlet container level and try to access the page again[9/26/08 6:26:10:246 EDT] 000000ab SystemOut O Entering ParallelRenderingPortlet 2 WorkManager.wpsWorkManager : 0 Fri Sep 26 06:26:10 EDT 2008[9/26/08 6:26:10:295 EDT] 000000a7 SystemOut O Entering ParallelRenderingPortlet1 WebContainer : 4 Fri Sep 26 06:26:10 EDT 2008[9/26/08 6:26:25:296 EDT] 000000a7 SystemOut O Exiting ParallelRenderingPortlet1 Fri Sep 26 06:26:25 EDT 2008[9/26/08 6:26:27:306 EDT] 000000a7 AbstractRende E com.ibm.wps.pe.ext.render.AbstractRenderManager performService EJPPG1110E: A timeout occurred when reading the output for portlet window Control (ParallelRenderingPortlet2, [ObjectIDImpl '7_32DSUKG100GBC027P3ULPA00G0', NAVIGATION_NODE, VP: 0, [Domain: rel], DB: 0000-4334EE290C00C0C5803879F89A150010], [ObjectIDImpl '6_32DSUKG100GBC027P3ULPA0000', CONTENT_NODE, VP: 0, [Domain: rel], DB: 0000-4334EE290C00C0C5803879F89A150000], 200 that is rendered in a parallel thread. The portlet output will not be displayed. [9/26/08 6:26:45:244 EDT] 000000ab SystemOut O Exiting ParallelRenderingPortlet 2 Fri Sep 26 06:26:45 EDT 2008[9/26/08 6:51:27:264 EDT] 000000a7 SystemOut O Entering Sequential rendering portlet 2 WebContainer : 4 Fri Sep 26 06:51:27 EDT 2008[9/26/08 6:51:27:265 EDT] 000000a7 SystemOut O Exiting Sequential rendering portlet 2 Fri Sep 26 06:51:27 EDT 2008[9/26/08 6:51:27:334 EDT] 000000a7 SystemOut O Entering Sequential rendering portlet 1 WebContainer : 4 Fri Sep 26 06:51:27 EDT 2008[9/26/08 6:51:27:334 EDT] 000000a7 SystemOut O Exiting Sequential rendering portlet 1 Fri Sep 26 06:51:27 EDT 2008
As you can see Parallel Rendering Portlet 2 was called in WorkManager.wpsWorkManager : 0 where Parallel rendeing portlet 2 was called in WebContainer :4 thread, sequential portlet 1 and 2 were also called in WebContainer :4 thread.
You can also see "A timeout occurred when reading the output for portlet window Control" message in the SystemOut.log that message is because Parallel rendering portlet 2 is sleeping for 35000 milliseconds which is more than the parallel rendering timeout value. So the WPS server will abort rendering of Parallel Rendering 2 portlet and write this message in log. On the user output side it will render output of all 3 portlets except Parallel rendering portlet 2 and for that portlet it will display error message to the user.
The PortletContainer Service Link has further information about parallel rendering

Parallel Rendering of Portlet

By default the WebSphere Portlet tries to render all the portlets on page sequentially. For example if you have 4 different portlets on one page, then websphere portal will create one thread for handling the request and call render() method of each of the portlets sequentially one after another. So the total response time is Sum of execution time of all the portlets. One important point to remember is that result page wont get displayed to user until render() method of all the portlets is finished
This is acceptable behavior in most of the cases but what if you have a portlet that accesses a database/ file system and takes long time to get result in that case the page my timeout. Example one of my client had a issue that when they the portal was serving blank white page. When we debugged the issue we realized that one of the portlets was trying to access a db process which for some reason was taking very long time and as a result the Connection from ODR to Portal server was getting timed out and as a result user was getting blank page. In the same case if you try to access the portal directly then it used to take long time but it used to display output finally.
In cases like this you might want to enable parallel rendering. When you enable parallel rendering the portal server will try to create different threads and call render() methods of the portlet from different threads in parallel. One other advantage of this approach is you can set a time out by default it is 2000 milli seconds. The portal server will wait for this time and if the render() method does not finish executing in that time, the portal server will ignore that portlet and display rest of the page. Make sure that this timeout is less than your ODR or Http Server Connection timeout so that portal server does not show blank page to user.

Enabling Parallel rendering


By default the parallel rendering is disabled and you will have to enable the parallel rendering first globally at portal server level then you have to enable it at portlet level. When you enable parallel rendering at portal server level it will not open different threads for each of the portlets on the page instead it will render only portlets that have parallel rendering enabled in separate thread and other portlets on the page are still rendered sequentially.
Second important point to note is that enabling parallel portlet rendering is just a hint to WPS and it is not necessary that WPS will create separate thread for each of the portlets that are enabled for parallel rendering. It is recommended that do not enable parallel rendering for every portlet instead enable it for the portlets which really need them ex. Portlet which needs to access external resource that might take time and WSRP consumer portlet. This way WPS can use the separate threads more efficiently.

Enabling Parallel rendering at the level of Portal Server



You can change the portal wide settings for parallel portlet rendering in the PortletContainerService. You can use two different parameters for configuring parallel portlet rendering, depending on the type of portlets you want to have rendered parallel.
1)For IBM portlets enable the following parameter

legacy.useParallelRendering.html=true

2) For standard portlets or for remote portlets that you integrated in a WSRP Consumer portal, enable the following parameter

std.useParallelRendering.html=true

Please note that .html part is optional which says that enable parallel rendering only for HTML markup. In markups like WML there would be only one portlet on page so parallel rendering does not make sense
In addition there are couple of more parameters that you can set at PortletContainerService level

  • parallelRenderingTimeOut:Use this parameter to specify the timeout in milliseconds after which the render process of a portlet is aborted. Default value is 2000(2 seconds)

  • parallelRenderingWaitTimeOut:Use this parameter to specify the waiting time in milliseconds for parallel threads to finish the render process of portlet. A low value can result in exceptions caused by portlets that could not finish their parallel rendering process. A high value can cause an increase of the response time. The value 0 (zero) specifies that no timeout occurs and the main thread waits for all portlets to finish.

  • parallelRenderingWaitTimeOut:Use this parameters to specify the waiting time in milliseconds for parallel threads to finish the render process of portlets. The default is 1 millisecond. A low value can result in exceptions caused by portlets that could not finish their parallel rendering process. A high value can cause an increase of the response time. The value 0 (zero) specifies that no timeout occurs and the main thread waits for all portlets to finish.

  • parallelRenderingChunkSize:Specifies the size of the chunks in bytes that are read from the queue. The default value is 1024 bytes.


Enabling Parallel rendering at portlet level


Once the parallel rendering is enabled at portal level. You can enable it at portlet level. There are different methods for doing that depending on your role

  • Developer: If your portlet developer then you can enable the parallel rendering by using the the following parameter. You set this parameter as a configuration parameter in IBM portlets or as a read-only preference in standard portlets.parallel = (false)

  • Administrator: If your administrator you can change the setting for a portlet to parallel rendering in the Manage Portlets portlet.


Proceed by the following steps:

  1. Select Portal Administration > Portlet Management > Portlets.

  2. Select the desired portlet and click on the Configure (wrench) icon. The portal displays the panel for configuring the portlet.

  3. Mark the Enable parallel rendering checkbox to enable parallel rendering for the portlet.


When you enable a portlet for parallel rendering it should look like this.



Take a look at Infocenter for more information on Parallel portlet rendering