On Sat, May 29, 2004 at 11:31:26AM -0700, Mike Duffy wrote:
: I asked these question in the Struts list and only received a minimal response:
Does anyone have
: any good ideas on managing session objects? In a complex application how do you
insure that the
: session does not become over burdened with unnecessary objects, thus degrading
system performance?
In no particular order:
1/ Use the Request object when you can; use the Session when you must.
(Paraphrasing a line I hear a lot in the C++ world...)
If you don't put something in the session, it certainly can't
stick around and take up space.
2/ Make sure each process that puts an object in the session is
designed to remove it. Obviously a "process" in this case may
span several requests; so, like good code, you'll have to
account for removing the object even in the event the process
short-circuits (e.g. when the user hits an error page instead
of reaching the proper ending). Unlike good code, you don't
have a handy "finally{}" clause... =)
3/ Load-test your app and size memory accordingly. Even with the
best-laid cleanup plans, people will close browsers without
formally logging out, etc. You simply have to deal with this
and make sure your app has enough heap space to handle the number
of concurrent users. Size per your worst-case scenario.
1 and 2 are coding practices, and must be enforced by the architect (by
explaining to the developers). This takes place before and during
development.
3 is an architectural issue, addressed during development and after a
good portion of the app has come to life.
ps - please create a new message when mailing the list. Responding to
an old (unrelated) message plays hell with thread-aware mailers, even if
you change the subject. Thank you.
-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]