Chapter 5: Web Application Tuning
Use these tips to tune the implementation of servlets and JSPs and their deployment properties in EAServer.
If the Web application calls EJB components, local interface invocations offer the best performance since they pass parameters on the stack rather than marshalling parameter values into an IIOP stream. For information on using local interfaces, see these sections in the EAServer Programmer’s Guide, from Chapter 8, “Creating Enterprise JavaBeans Clients”:
Avoid using servlets that must be single-threaded. One instance of a single-threaded servlet can serve only one client at a time, while thread-safe servlets can serve all clients with one instance.
If you cannot avoid using a single-threaded servlet, configure the number of instances to minimize blocked client requests (requests block if there are more requests than available instances). For more information, see “Threading settings” in Chapter 22, “Creating Java Servlets,” in the EAServer Programmer’s Guide.
If your servlets that take a long time to load and initialize, configure them to load when the server starts. Otherwise, the first client that calls the servlet experiences poor response time when the servlet is loaded to satisfy the request. You can also configure JSPs to load at start-up. If a JSP is loaded at start-up, it is compiled if necessary.
Set the Load During start-up option on the General tab in the Web Component Properties dialog box, or set the com.sybase.jaguar.servlet.load-on-startup property for the servlet or JSP in the Web application deployment properties.
JSP runtime compilation is expensive. While this feature is convenient during the development phase, you should precompile JSPs when deploying them to production server. If you precompile JSPs, you can further improve performance by disabling runtime timestamp checking. If your application design requires runtime compilation, you can tune the JSP compilation settings to reduce compile time.
There are two ways to precompile JSPs:
Configure the JSP to load at start-up, as described in “Preloading classes”. The JSPs are compiled when the server starts up. This technique requires that you have Web components defined for each JSP in your application.
Compile the JSPs using the jagtool compilejsp command. You can do this from deployment scripts or batch files, or in an Ant build file. For more information, see Chapter 12, “Using jagtool and jagant,” in the EAServer System Administration Guide.
If you have precompiled all JSPs, you can turn off JSP file timestamp checking for the Web application. Doing so can increase performance by eliminating the required system calls. The com.sybase.jaguar.webapplicaton.jspc-interval Web application property controls how often EAServer checks to see if the JSP should be recompiled. The default is 0, which means the server must check the file timestamp every time the JSP is invoked. To disable checking, set the property to -1. To check after every n seconds, set the value to a positive integer n. For more information, see the description of this property in Appendix B, “Repository Properties Reference,” in the EAServer System Administration Guide.
If your application design requires runtime JSP compilation, you can configure the settings described here to decrease the time required to compile. These settings can also reduce server start-up time if you have configured JSPs to compile at start-up.
To reduce the compilation time for JavaServer Pages (JSPs), you can configure the class path for JSPs separately from the EAServer class path. By default, the JSP compiler class path includes the EAServer process class path plus these class entries and JAR files that are specific to the Web application:
The work/servername/servlet/WebApp-webapp directory, where EAServer generated servlet classes for JSPs. Here, servername is the name of the server, and webapp is the name of the Web application.
The Repository/WebApplication/webapp/WEB-INF/classes directory, where you deploy classes used by servlets and JSPs in the Web application. Here, webapp is the Web application name.
The JAR files in the Repository/WebApplication/webapp/WEB-INF/lib directory. Here, webapp is the Web application name.
The JAR files in the extensions directory of your EAServer installation.
For the fastest JSP compile times, you must configure the compiler class path to eliminate unnecessary entries. To do so, set these properties on the Advanced tab in the Web Application Properties and Web Component Properties dialog boxes:
For the Web application, set this property to false to exclude entries from the EAServer process CLASSPATH setting in the JSP compiler class path. The default of true indicates that the server class path should be included.
For individual JSPs (Web components in EAServer Manager), set this property to false to exclude entries from the EAServer process CLASSPATH setting in the JSP compiler class path. The default of true indicates that the server class path should be used.
For the Web application, set this property to specify whether JAR files in the EAServer java/lib subdirectory are included in the JSP compiler class path. If this property is true, all JAR files in this directory are included. The default is false. This property is ignored if the com.sybase.jaguar.webapplication.jsp.compile-use-eas-cp property is set to true.
For individual JSPs (Web components), set this property to specify whether JAR files in the EAServer java/lib subdirectory are included in the JSP compiler class path. If this property is true, all JAR files in this directory are included. The default is false. This property is ignored if the com.sybase.jaguar.webapplication.jsp.compile-use-eas-cp property is set to true for the Web application or the com.sybase.jaguar.servlet.jsp.compile-use-eas-cp is set to true for the Web component.
For the Web application, specifies additional JAR files and directories to include in the JSP compiler class path. Specify the paths in a comma-separated list, with paths relative to the EAServer installation directory. For example, to include $JAGUAR/java/lib/iaws.jar and $JAGUAR/java/classes/extra.jar, set the property to:
For individual JSPs, specifies additional JAR files and directories to include in the JSP compiler class path, using the same syntax as the com.sybase.jaguar.webapplication.jsp.compile-extra-cp property.
|Copyright © 2005. Sybase Inc. All rights reserved.|