Load Distribution
- Getting a faster machine and connection is almost always
enough.
- Enterprise Java
Beans (EJB) are designed to be distributable objects. As
such, an EJB must follow certain rules.
- Servlets have no such rules, but a good approximation is
- Instance and static variables should not store state,
since different instances of the servlet might exist.
ServletContext
cannot be use to store
state, for the same reason.
- Any object placed in
HttpSession
should
implement java.io.Serializable
.
- Use the
getServletContext()getResource()
to read files.
- If you follow these rules you can mark servlet as
<distributable/>
in web.xml
- There are several distribution (clustering) styles.
- No clustering.
- Clustering with no session migration and no session
failover. Sessions stick to original server. A crash can
result in broken session.
- Clustering with session migration and no session
failover. All session objects must be serializable.
- Clustering with session migration and failover. Crash
does not invalidate session.
- These are implemented by servlet server. You must simply
follow the rules.
José M. Vidal
.
64 of 89