JSP
- Use jspInit() method to cache static data
- Use StringBuffer rather than using + operator when you concatenate
multiple strings
- Use print() method rather than println() method
Use ServletOutputStream instead of JSPWriter to send binary data
- Initialize the 'out' object (implicit object) with proper size in the page
directive.
- Flush the data partly
- Minimize code in the synchronized block
- Set the content length
- Release resources in jspDestroy() method.
- Give 'false' value to the session in the page directive to avoid session
object creation.
- Use include directive instead of include action when you want to include
the child page content in the translation phase.
- Avoid giving unnecessary scope in the 'useBean' action.
- Do not use custom tags if you do not have reusability.
- Use application server caching facility
- Use Mixed session mechanisms such as 'session' with hidden fields
- Use 'session' and 'application' as cache.
- Use caching tags provided by different organizations like openSymphony.com
- Remove 'session' objects explicitly in your program whenever you finish
the task
- Reduce session time out value as much as possible
- Use 'transient' variables to reduce serialization overhead if your session
tracking mechanism uses serialization process.
- Disable JSP auto reloading feature.
- Use thread pool for your JSP engine and define the size of thread pool as
per application requirement.
Servlets
- Use init() method to cache static data
- Use StringBuffer rather than using + operator when you concatenate
multiple strings
- Use print() method rather than println() method
- Use ServletOutputStream rather than PrintWriter to send binary data
- Initialize the PrintWriter with proper size
- Flush the data partly
- Minimize code in the synchronized block
- Set the content length
- Release resources in destroy() method.
- Implement getLastModified() method to use browser cache and server cache
- Use application server caching facility
- Use Mixed session mechanisms such as HttpSession with hidden fields
- Remove HttpSession objects explicitly in your program whenever you finish
the task
- Reduce session time out value as much as possible
- Use 'transient' variables to reduce serialization overhead if your
HttpSession tracking mechanism uses serialization process.
- Disable servlet auto reloading feature.
- Use thread pool for your servlet engine and define the size as per
application requirement
Message driven beans
- Tune the Message driven beans pool size to promote concurrent
processing of messages.
- Use setMesssageDrivenContext() or ejbCreate() method to cache bean
specific resources.
- Release acquired resources in ejbRemove() method.
- Use JMS tuning techniques in Message driven beans.
Stateless session beans
- Tune the Stateless session beans pool size to avoid overhead of creation
and destruction of beans.
- Use setSessionContext() or ejbCreate() method to cache bean specific
resources.
- Release acquired resources in ejbRemove() method
Stateful session beans
- Tune Stateful session beans cache size to avoid overhead of activation and
passivation process.
- Set optimal Stateful session bean age(time-out) to avoid resource
congestion.
- Use 'transient' key word for unnecessary variables of Stateful session
bean to avoid serialization overhead.
- Remove Stateful session beans explicitly from client using remove()
method.
Entity beans
- Tune the entity beans pool size to avoid overhead of creation and
destruction of beans.
- Tune the entity beans cache size to avoid overhead of activation,
passivation and database calls.
- Use setEntityContext() method to cache bean specific resources.
- Release acquired resources in unSetEntityContext() method
- Use Lazy loading to avoid unnecessary pre-loading of child data.
- Choose optimal transaction isolation level to avoid blocking of other
transactional clients.
- Use proper locking strategy.
- Make read-only entity beans for read only operations.
- Use dirty flag to avoid unchanged buffer data updation.
- Commit the data after the transaction completes to reduce database calls
in between transaction.
- Do bulk updates to reduce database calls.
- Use CMP rather than BMP to utilize built-in performance optimization
facilities of CMP.
- Use ejbHome() methods for global operations.
- Tune connection pool size to reduce overhead of creation and destruction
of database connections.
- Use JDBC tuning techniques in BMP.
- Use direct JDBC rather than using entity beans when dealing with huge data
such as searching a large database.
- Use business logic that is specific to entity bean data.