bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

JavaServer Page Guide

Tuning JSP Performance

When a customer requests a page on your e-business Web site, WebLogic Portal compiles the corresponding JSP into a servlet. In addition to servlets that come from compiled JSPs, WebLogic Portal provides a set of servlets for exchanging information between various components of the system.

This section provides information on tuning JSP compiling and updating. It includes information in the following subjects:

- Step 1: Precompile JSPs

- Step 2: Specify a Java Compiler for a Web Application

- Step 3: Adjust the Intervals for Checking JSP and Servlet Modifications

Step 1: Precompile JSPs

For each of your Web applications that you deploy, you can determine when WebLogic Portal compiles JSPs:

- Manually precompile JSPs using weblogic.jspc.

- You can specify that the application server precompiles all JSPs when you start the server. When you activate the precompile option, the server startup process checks for new or modified JSPs in the Web application and compiles them.

- You can specify that the application server compiles JSPs only when they are requested. With this option deactivated, the server starts quickly but must compile each new or modified JSP when you access it, causing a significant delay the first time you request a new or modified JSP.

The sample applications for WebLogic Portal samples are precompiled on installation.

Use the following steps. For more information, see the WebLogic Server XML elements documentation at http://e-docs.bea.com/wls/docs70/webapp/weblogic_xml.html, and the WebLogic Server Administration Guide at http://e-docs.bea.com/wls/docs70/adminguide/overview.html#1036999.

1. If your Web application is deployed as a WAR file, unjar it.

2. In the WebLogic Server console, navigate to the web application, click the Configuration tab, and mark Precompile. (The parameter name in the weblogic.xml file is weblogic.jsp.precompile.)

3. Save the file.

4. If appropriate, rejar the WAR file.

5. Restart the server.

Step 2: Specify a Java Compiler for a Web Application

The WebLogic Server Administration Console specifies a Java compiler for each server configuration. All applications that you deploy on a server use this compiler unless a Web application's weblogic.xml file specifies a different compiler.

To review the current Java compiler for your server, in the left pane of the WebLogic Server Administration Console, click a server. In the right pane, on the Configurations tab, click the Compilers subtab. To enter a new name, enter the pathname of the Java compiler that you want to use for the Web application. To deploy any modifications, restart the server.

For more information, see the WebLogic Server XML elements documentation at http://e-docs.bea.com/wls/docs70/webapp/weblogic_xml.html, and the WebLogic Server Administration Guide at http://e-docs.bea.com/wls/docs70/adminguide/overview.html#1036999.

Step 3: Adjust the Intervals for Checking JSP and Servlet Modifications

You can specify how frequently a server checks for modifications to JSPs and source files for other servlets in a Web application.

The sample Web applications check for modified JSPs each time a Web browser requests a JSP. Likewise, each time the server sends a request to a servlet in a sample Web application, it checks for any modifications to the servlet class files.

For your production Web site, you can decrease the amount of time in which WebLogic Portal serves JSPs and processes requests to servlets by increasing the intervals at which the server checks for modifications.

Although the server performs faster with higher values for the modification-check intervals, the higher values reduce sensitivity to changes in your source files. For example, you can set the server to check for JSP modifications every 10 minutes. After you change a JSP, it will take up to 10 minutes for the server to see the modifications.

This section includes information on the following subjects:

- Understand the Page-Check Intervals Properties

- Adjust the Intervals

Understand the Page-Check Intervals Properties

The pageCheckSeconds attribute determines the interval at which a server checks to see if JSP files in a Web application have changed and need recompiling. Each Web application defines this property separately in its WEB-INF\weblogic.xml file:

<jsp-param>
<param-name>pageCheckSeconds</param-name>
<param-value>1</param-value>
</jsp-param>

The page-check interval does not determine the frequency with which a server checks for updated content that is stored in the database and in a content management system. Instead, the TTL (time-to-live) settings for various caches determine the refresh rate for content. For example, if you set the page-check intervals to once a second, and you set the TTL for the content cache to 10 minutes, it can take up to 10 minutes for the server to see the new content, even though it is checking for new JSP source code every second. For information on setting TTL properties, see "Performance Tuning" in the Development Guide at http://edocs.bea.com/wlp/docs70/dev/x10ding.htm#1040480

Adjust the Intervals

To determine the optimal page-check and reload-servlet intervals for your production Web site do the following:

1. Establish performance baselines by testing WebLogic Portal performance with the interval set to -1 (which specifies that the server never checks for modifications).

2. Test the performance with the interval set to various numbers of seconds. For example, set the interval to 600 seconds (10 minutes) and test the performance. Then set the interval to 900 seconds and test the performance.

3. Choose an interval that provides the best performance while checking for modifications to JSP files and servlet classes at a satisfactory rate.