Storing Data In Memory: Session vs Cache vs Static -


A bit of backstory: I am working on a web application that requires a little bit of time to prepare the data before giving it. For the user to edit / manipulate the data request function ~ 15/20 seconds to complete and one second once for the process, the user can manipulate the voices on the fly.

Update: To avoid confusion, I am only calling data 1 time (15 second) and then want to keep the result in memory so that I will not have to call it again unless The user is not working 100%. Therefore, it will take some time to draw first, but, using Ajax, I am going to update the in-memory data continuously and for about 2 seconds or so (I hope) to keep the response time.

To make this efficient, I am taking the initial data in memory and using Ajax to call back on the server so that I can handle the rearrangement at the time of processing I can reduce what happens with this user's updates.

Here's my question, keeping in mind the performance, what would be the best way to store this data, assuming that only 1 user will work w / this data given at any given time .

In addition, the user could potentially work in the process for a few hours. When the user is working w / data, then I will need some kind of failure to save the user's current data (in DB or in a sorted binary file), their session should be interrupted in some way. In other words, I would need a solution that I have a proper object, allowing me to dump the memory object's data so that the user gets disconnected / distracted for a long time.

So far my thinking:

Session state - Professionals: A user has been closed. The event of the end of the session which will meet my failure requirements. Opposition: The incidence of the end of the perf session at the slowest pace of my current options is sometimes difficult to ensure that it starts to fire properly.

Caching - Professionals: Good pre-dependency is reached, which can be a bonus later but is not really useful in the current realm. Opposition: There is no easy unsuccessful step in addition to writing based on time intervals. Global In Scope - It has to be ensured that users do not bump into each other's work.

Static - Pros: The best perf is easy to maintain because I can directly benefit from my current class structures. Opposition: There is no easy unsuccessful step in addition to writing based on time intervals. Global In Scope - It has to be ensured that users do not bump into each other's work.

Do I have any options / suggestions on which I should choose?

Thank you!

Update: Forget to mention, I'm using VB.Net, ASP.Net, and SQL Server 2005 to perform this task.

I want to go with the caching method to store data across any page load. You can name the cache to save that data to avoid conflicts.

To track changes made by the user, I want to go from a more old-school approach: Add to a text file every time the user makes a change to save the change on DB and Then swaps that file at intervals if you name the files based on user / account or some other session-unique indicator, conflict and app (or some other support app, which Usually there can be a better idea), there is no problem with it, even after updating all such files and sessions, also update the DB.

Earlier part can be adjusted to write more: Save changes in session, then type to file at intervals, then large file intervals you can tune it to display And can choose which level of potential user-change loss is possible.


Comments