Portal Guide
CHAPTER 15
This chapter describes exteNd Director support for asynchronous portlet processing. The following topics are covered:
When portlets run asynchronously, they render their content in parallel. When a portal administrator enables asynchronous processing for the portal, exteNd Director manages asynchronous portlet render requests as shown in this diagram:
By default, the exteNd Director portal assigns each asynchronous render request to its own thread in the portlet thread pool. When all threads in the pool have been assigned, incoming asynchronous render requests are delegated to the main request thread, as described in The main request thread.
Asynchronous threads become available when the portlets assigned to them finish execution. At that time, the portal transfers pending asynchronous render requests out of the main thread to the next available individual thread in the pool, beginning with the oldest request.
Synchronous render requests are processed sequentially in the main request thread by default. However, portal administrators can configure the portal to allocate a separate thread for processing synchronous render requests, thereby preventing bottlenecks in the main request thread. See Properties that control asynchronous portlet rendering.
The portal waits for each portlet on a page to complete its render operation or to time out (whichever comes first), then aggregates the rendered output onto the page.
The main request thread The main request thread is the application server thread that processes client requests. The following portlet requests execute in the main thread by default:
In addition, asynchronous render requests may be delegated to the main request thread if no threads are available in the portlet thread pool, as described in About asynchronous processing.
Asynchronous portlet processing is an advanced feature that should be used only by portlet developers and administrators who are experienced in the following areas:
To set up the runtime environment for asynchronous portlet rendering, the following tasks must be completed:
Portlet administrator configures the application server for asynchronous portlet rendering, as described in Configuring the application server for asynchronous portlet rendering.
Portlet administrator enables asynchronous rendering for the portal, as described in Properties that control asynchronous portlet rendering.
Portlet developer determines whether individual portlets should render content synchronously or asynchronously, as described in Synchronous versus asynchronous processing.
Portlet administrator fine-tunes request timeout behavior, as described in Fine-tuning request timeout behavior.
exteNd Director provides varying levels of support for asynchronous portlet rendering on the following servers when they are configured appropriately
Server |
Restrictions |
Configuration requirements |
---|---|---|
Novell exteNd Application Server |
None |
See Configuring the Novell exteNd Application Server for asynchronous portlet rendering. |
IBM WebSphere |
Portlet applications can run in asynchronous mode only on the IBM WebSphere 5.02 Enterprise server. Asynchronous processing relies on functionality provided by the Work Manager. Consult IBM WebSphere documentation for further details. |
See Configuring the IBM WebSphere server for asynchronous portlet rendering. |
BEA WebLogic |
Portlet applications can run in asynchronous mode except when they: If your portlets include any of these restricted elements, you'll need to enable synchronous processing, as described in Enabling portlets to render content synchronously. |
See Configuring BEA WebLogic and Apache Tomcat servers for asynchronous portlet rendering |
Apache Tomcat |
Portlet applications can run in asynchronous mode except when they reference java:comp/env. For portlets that reference java:comp/env,enable synchronous processing, as described in Enabling portlets to render content synchronously. |
See Configuring BEA WebLogic and Apache Tomcat servers for asynchronous portlet rendering. |
To configure the Novell exteNd Application Server for asynchronous portlet rendering:
Open the deployment plan for your portal application project.
If prompted to build your project, you can select No don't build now and click OK.
Search for the <warJar> element.
TIP: It may be easier to find the <warJar> element if you switch from Descriptor view to XML view.
After the <warJar> descriptor (under </warJar>, add an element called <backgroundThreadMax> and set it to the maximum number of threads each Web application can use from the application server's thread pool.
For example, if you want to enable up to 15 threads, enter the following descriptor:
<backgroundThreadMax>15</backgroundThreadMax>
NOTE: If you do not add the <backgroundThreadMax> element,
Now you are ready to turn on asynchronous portlet rendering in the portal. See Properties that control asynchronous portlet rendering.
To configure the IBM WebSphere server for asynchronous portlet rendering:
Create a new Work Manager for your server and give it a name for the portal application.
Consult your WebSphere documentation for the correct procedure.
Open the Portal subsystem configuration file.
com.novell.afw.portal.aggregation.work.workmanager
Set the value of the property to the JNDI name of the Work Manager you created in Step 1.
For example if the JNDI name of the Work Manager is PortalWorkManager, you should add the following property to the Portal configuration file:
<property> <key>com.novell.afw.portal.aggregation.work.workmanager</key> <value>PortalWorkManager</value> </property>
Save the Portal subsystem configuration file.
Now you are ready to turn on asynchronous portlet rendering in the portal. See Properties that control asynchronous portlet rendering.
To configure BEA WebLogic or Apache Tomcat servers for asynchronous portlet rendering:
Open the Framework subsystem configuration file.
Assign values for the following thread pool properties:
For example, here are the default values for these properties in the Framework subsystem configuration file:
<!-- thread pool settings --> <property> <key>com.sssw.fw.api.threadpool.buffersize</key> <value>10</value> </property> <property> <key>com.sssw.fw.api.threadpool.maxthreads</key> <value>100</value> </property> <property> <key>com.sssw.fw.api.threadpool.minthreads</key> <value>4</value> </property> <property> <key>com.sssw.fw.api.threadpool.initialthreads</key> <value>10</value> </property> <property> <key>com.sssw.fw.api.threadpool.keepalifetime</key> <value>300000</value> </property> <property> <key>com.sssw.fw.api.threadpool.enabled_at_startup</key> <value>true</value> </property>
Save the Framework subsystem configuration file.
Now you are ready to turn on asynchronous portlet rendering in the portal. See Properties that control asynchronous portlet rendering.
The portal uses the following properties to manage asynchronous portlet rendering:
This section describes the effects of each configuration of property values. Note that Parallel portlet render enabled must be enabled in order for the other properties to have any effect..
Portal administrators must enable asynchronous portlet rendering in the portal in order for individual portlets to render content in parallel. Otherwise all portlets render content synchronously in the main request thread.
Portal administrators can enable asynchronous processing for the duration of a server session or permanently across server sessions.
The portal administrator uses the Director Administration Console (DAC) to turn on asynchronous portlet rendering for the duration of the server session. This means that the settings remain in effect until you restart the server or redeploy the application. Then, asynchronous rendering defaults back to the disabled state.
To persist asynchronous render settings across server sessions, see Enabling asynchronous portlet rendering across server sessions.
To enable asynchronous portlet rendering for the duration of a server session:
Start the DAC, as described in accessing the DAC.
Select the check box Parallel portlet render enabled.
IMPORTANT: The portal administrator must enable this property to turn on asynchronous rendering in the portal. If this property is disabled, portlets will not render content in parallel, even if portal developers enable asynchronous rendering for individual portlets, as described in Enabling portlets to render content synchronously.
Enable or disable Force portlet render timeout and force synchronous portlet serial rendering as described in Properties that control asynchronous portlet rendering.
To persist asynchronous portlet render settings across server sessions, the portal administrator must add and set the following properties to the Portal subsystem configuration file:
Property in the Portal subsystem configuration file |
Equivalent property in the DAC |
---|---|
com.novell.afw.portal.aggregation.parallel_enabled |
Parallel portlet render enabled |
com.novell.afw.portal.aggregation.force_render_timeout |
Force portlet render timeout |
com.novell.afw.portal.aggregation.serial_synch_render |
Force synchronous portlet serial rendering |
For a description of these properties, see Properties that control asynchronous portlet rendering.
To persist asynchronous portlet rendering across server sessions
Open the Portal subsystem configuration file.
Enable asynchronous portlet rending by adding and setting the parallel_enabled property descriptor as follows:
<property> <key>com.novell.afw.portal.aggregation.parallel_enabled</key> <value>true</value> </property>
Add and set the <force_render_timeout> and <serial_synch_render> elements as described in Properties that control asynchronous portlet rendering.
In this example, both properties are disabled:
<property> <key>com.novell.afw.portal.aggregation.force_render_timeout</key> <value>false</value> </property> <property> <key>com.novell.afw.portal.aggregation.serial_synch_render</key> <value>false</value> </property>
Save the Portal subsystem configuration file.
Portlet developers can set individual portlets to render content synchronously or asynchronously.
To determine the appropriate mode for rendering content, portal developers should consider the characteristics of each portlet. If a portlet does not use a lot of CPU time and does not call external sources, it should be configured to render content in synchronous mode.
To configure the individual portlets to run synchronously, see Enabling portlets to render content synchronously.
When developers create portlets using the exteNd Director Portlet Wizard, the portlets are configured for asynchronous content rendering by default. However, portlets render content asynchronously at runtime only if a portal administrator has enabled parallel portlet rendering in the portal, as described in Enabling asynchronous portlet rendering in the portal.
exteNd Director defines a property called synchronous for configuring individual portlets to render content serially. The portlet developer turns on serial rendering by adding and enabling the synchronous property in the portlet descriptor
To enable synchronous content rendering for individual portlets:
Open the project's novell-portlet.xml or its portlet fragment deployment descriptor.
Add the <synchronous> element to the portlet descriptor and set it to a value of 1 to enable synchronous processing. The entry should look like this:
<synchronous>1</synchronous>
TIP: If you want to re-enable asynchronous processing, either remove the synchronous element or set it to 0, as follows:
<synchronous>0</synchronous>
Save novell-portlet.xml or the portlet fragment deployment descriptor.
For more information about the <synchronous> element, see A look inside novell-portlet.xml.
In certain runtime situations, portlets may time out before they have a chance to render their content. For example, an asynchronous portlet may time out while waiting for an individual request thread to become available.
To optimize the performance of your portal application, exteNd Director provides a number of properties for fine-tuning portlet request timeout behavior. The request timeout is governed by an interaction between settings in the portal and settings for individual portlets, as described in How the request timeout is determined.
The Portal subsystem configuration file includes several properties that control request timeout behavior for the portal as a whole:
The novell-portlet.xml file includes a property called max-timeout that determines the maximum timeout interval for each portlet, as in this example:
<portlet name="StockQuotePortlet">
<style>
<name>StockQuotePortletDefault</name>
<display-name>Default StockQuote Portlet Style</display-name>
<user-agent>
<device-name>Generic_HTML</device-name>
<file-name>$RESOURCE_SET$/portlet-style/StockQuote.xsl
</file-name>
</user-agent>
</style>
<requires-authentication>0</requires-authentication>
<auto-register enabled="true">
<category>General Portlets</category>
</auto-register>
<max-timeout>1000</max-timeout>
</portlet>
The max-timeout property sets the maximum time (in milliseconds) that the Portal should wait for a portlet's render request to finish.
NOTE: A value of 0 is interpreted as -1, which indicates that this portlet does not have a timeout value and the default request timeout will be applied.
The timeout of a request is determined as follows:
The timeout of each asynchronous portlet is read and the greatest value is determined.
If the value from Step 1 is between the default_request_timeout and the max_request_timeout, it will be used as this request's maximum timeout.
If the value from Step 1 is below the default_request_timeout, the timeout for this request will be set to the default_request_timeout.
If the value from Step 1 is above the max_request_timeout value, the max_request_timeout value will be used as the timeout value for the current request.
The max_request_timeout setting applies to synchronous portlets, as well as asynchronous portlets. Since synchronous portlets are processed sequentially, the timeout is checked after each portlet returns. If the max_request_timeout value is reached, no new render process is started and the default timeout message is used as the portlet's content for all remaining, unprocessed synchronous portlets.
NOTE: You should not confuse the request timeout settings with the expiration cache setting in the portlet.xml file. The expiration cache setting is used for content caching.
Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. more ...