This section presents several well-known issues that may affect performance and scalability for your Struts applications. This section is not meant to be exhaustive, but rather to single out a few of the more serious concerns.
Memory is limited. You can purchase
more memory for a machine, but at some point you’ll
stop receiving the same return on your investment.
It’s very common to store objects and data in the
HttpSession. In some
cases, this might be the only way to achieve a particular
requirement. However, you must consider the effect that storing
objects and data in the session has on an application.
The more information and objects that are stored in the session, the more you need to worry about scalability. Say that you store 0.5 MB worth of data for a single user. If the application were loaded with 1000 concurrent users, that would equal 500 MB (0.5 GB) worth of memory.
Don’t forget that there are other resources taking up memory, not just user sessions. There’s application-scope data, the rest of the Struts framework, your application components, the container itself, the JVM, and so on. You must consider all of these factors.
As you can see, using the session to store data can quickly eat up
memory. A better alternative is to use the
HttpServletRequest to temporarily store data that can be used by other components and then reclaimed by the garbage collector when the request is completed. With ...