0

In many of my bean classes, I've used session scope. I just want to know does it cause any performance issue like server overhead, memory issues etc.

SWeko
  • 30,434
  • 10
  • 71
  • 106
user2006716
  • 187
  • 1
  • 1
  • 6

1 Answers1

2

Abusing session scope and putting beans which should live only in view or request is not good idea for at least two reasons:

  1. User experience - as user will see some old data stayed on pages that he visited during that session, which is in most cases bad behavior (almost always when you enter some inputs leave page and return to that page you expect that data to be reset but you will see old data)
  2. Memory consumption - as it is obvious session scoped beans will live as long as session lives and they will occupy some memory. This is maybe not really huge memory consumption but it can be important especially when sessions is old (for example few hours). Session data in that case will be bigger during the time

I don't have to say anything new, you should see few more links:

I would just add note for another answer. As long as cookies in your browser are enabled size of HTTP request will not increase. Session is kept just on server, on client is just added JSESSIONID cookie which keep ID of current session.

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
partlov
  • 13,789
  • 6
  • 63
  • 82