简体   繁体   中英

is it ok to store rather big amount of data in session?

I'm doing a survey builder, and I think to store the survey in session with a unique guid key until the user creates it fully and saves it
I'm thinking it is going to be an array of 100~200 objects (8 properties class)

That sounds like a fair use of Session.

Whether your data is too large depends on quite a few things, such as your web server's memory. The best thing to do is test the performance using Session. If you find your data is too heavy for Session have a look at ASP.NET Profile .

That doesn't sound like that much data unless we are talking about reams of text for each answer. I would not worry about it unless I was working on a web site expected to have thousands of these open at any given point in time.

IMHO I think the data should be stored in something other than the Session.
Session objects can disappear for a myriad of reasons. Would your users be annoyed if their answers are not persisted and needs to start afresh.

Remember to write the data to a persistent store (DB, files, etc) as soon as possible unless the users don't mind starting over.

I agree with ggonsalv. I would store the data somewhere just in case the session is lost. I have been to sites where I fill stuff out and then it looses it near the end. It's not fun to start over.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM