The clustering promotes high availability and scalability. The considerations for servlet clustering are:
--Objects stored in a session should be serializable to support in-memory replication of sessions. Also consider the overhead of serializing very large objects. Test the performance to make sure it is acceptable.
-- Design for idempotence. Failure of a request or impatient users clicking again can result in duplicate requests being submitted. So the Servlets should be able to tolerate duplicate requests.
-- Avoid using instance and static variables in read and write mode because different instances may exist on different JVMs. Any state should be held in an external resource such as a database.
-- Avoid storing values in a ServletContext. A ServletContext is not serializable and also the different instances may exist in different JVMs.
-- Avoid using java.io.* because the files may not exist on all backend machines. Instead use getResourceAsStream().
-- By Author of the book "Java/J2EE Job Interview Companion" at http://www.lulu.com/java-success