Sun Java System Web Server 7.0 Update 3 Performance Tuning, Sizing, and Scaling Guide

Java Server Page and Servlet Tuning

This section describes how to improve performance of web applications, both through coding practices and through deployment and configuration settings.

Suggested Coding Practices

This section provides some tips on coding practices that improve servlet and JSP application performance.

General Guidelines:

Follow these general guidelines to increase performance of the presentation tier:

Avoid Shared Modified Class Variables

In the servlet multithread model which is the default, a single instance of a servlet is created for each application server instance. All requests for a servlet on that application instance share the same servlet instance. This can lead to thread contention if there are synchronization blocks in the servlet code. So, avoid using shared modified class variables, since they create the need for synchronization.

HTTP Session Handling

Follow these guidelines when using HTTP sessions: