Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much data can/should you store in a users session object?

We have several wizard style form applications on our website where we capture information from the user on each page and then submit to a backend process using a web service.

Unfortunately we can't submit the information in chunks during each form submission so we have to store it the users session until the end of the process and submit it all at the same time.

Is the amount of server memory/sql server disk space the only constraint on how much I can store in users sessions or is there something else I need to consider?

Edit: The site is built on ASP.NET web forms.

like image 818
Andy Rose Avatar asked Sep 16 '08 14:09

Andy Rose


People also ask

How much data can you store in session?

Session storage can also accommodate a huge amount of data. Most browsers, including Chrome and Firefox, can store about 10 MBs of data in session storage.

How much data we can store in session in PHP?

Maximum limit of data saving in SessionStorage is about 5 MB.

Can I store large data in session?

No, it's not good practice to do this.

Where is user session data stored?

The session data that you read and write using $_SESSION is stored on server side, usually in text files in a temporary directory. They can not be accessed from outside.


2 Answers

Assuming the information is not sensitive then you could store the information in a cookie which would reduce the amount of information required to be stored server side. This would also allow you to access the information via JavaScript.

Alternatively you could use the viewstate to store the information although this can lead to large amounts of data being sent between the server and the client and not my preferred solution.

The amount of session information you should store varies wildly depending on the application, number of expected users, server specification etc. To give a more accurate answer would require more information :)

Finally, assuming that the information collected throughout the process is not required from page to page then you could store all the information in a database table and only store the records unique id in the session. As each page is submitted the db record is updated and then on the final page all the information is retrieved and submitted. This is not an idea solution if you need to retrieve previous information on each subsequent page due to the number of db reads required.

like image 140
Toby Mills Avatar answered Sep 22 '22 17:09

Toby Mills


You could also have 1 asp page with the entire html form, and hide parts of it until the user fill and "submits" the visible part...

then simply hide the part that is filled out and show the next part of the form...

This would be extremely easy in the .NET framework, use panels for each "wizard step" and add loggic when to display and hide each panel.

you will then have all the data on one page.

like image 28
mmattax Avatar answered Sep 23 '22 17:09

mmattax