Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it a good idea to invalidate a session or remove attribute to save resource ?

 
Artemesia Lakener
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking that after I use "session" to carry objects among several JSP pages, after I reach the final result page, maybe I should do something like "invalidate" the session or just remove those attributes stored in session, this should free some resources everytime. But the consequence will be --- if I click "back" button to go back to the middleway page, and then click "submit" or "continue" button, I will not get any results because the objects have been removed by me, so I have to go back to the first page and restart everything. What do you experienced guys usually do ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you having memory issues?
If not, I would let the sessions time themselves out.
You've already mentioned one problem with manually removing the objects.
Another is the extra code that you will have to maintain to do this.

Write your app for clarity, then profile it to find it's bottlenecks.
Once you've done that, you can start to optimize by changing things the things that will give you the most bang for the buck. Often, it's not where you think it will be.

As one of our esteemed oldtimers here often says:
"Premature optimization is the root of all evil."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic