Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPSession variable limit

What is the maximum limit (i.e. size) of data that a HTTPSession variable can hold? What will happen if this exceeds? And most importantly, what is the alternative approach to have the data throughout the session if the size exceeds the maximum size that a HTTPSession variable can hold?

like image 702
user182944 Avatar asked Jul 28 '12 07:07

user182944


People also ask

How many session variables can you have?

As @Thariama said, there's no limit on the number of variables; also, there's no limit on the amount of data you can store in a session (I've seen sessions tens of MB in size).

Are session variables secure?

By default, session variables are created with the secure flag set to true. If any secure variables are saved to the database, you must type your password, which is used as the encryption key. If you supply the wrong password, you are prompted for the password again.


1 Answers

There is no limit, other than the memory of your server. The alternatives are

  • to run your server with more memory
  • to configure the server to swap sessions to disk (see http://tomcat.apache.org/tomcat-7.0-doc/config/manager.html for Tomcat)
  • to avoid putting large data in the session, and to use a cache or a database to store them instead.
like image 149
JB Nizet Avatar answered Oct 20 '22 18:10

JB Nizet