Tuning server and Web application settings  Understanding HTTP response caching options

Chapter 5: Web Application Tuning

Tuning servlet and JSP settings and code

Use these tips to tune the implementation of servlets and JSPs and their deployment properties in EAServer.


Use local interfaces for EJB calls

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”:


Threading

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.


Preloading classes

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 compilation options

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.


Precompiling JSPs

There are two ways to precompile JSPs:


JSP file timestamp checking

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.


Runtime compilation settings

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:

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:





Copyright © 2005. Sybase Inc. All rights reserved. Understanding HTTP response caching options