I have been reading articles about state management in ASP.NET for few days for my web application.
In this application, one user can create/save/execute queries, and I need to keep each parameter of a query before the user can save the query.
These parameters are string values, but the global size for one user may exceed few megabytes.
We plan to have our website running w/ ~100 users simultaneously.
In these conditions, I believe that it will not be good to store these values in session w/ in-proc mode.
We already implemented a ProfileProvider:SqlProfileProvider, using a caching mechanism and with AutoSave=true.
What is the best solution: storing these values in profile or in session but in an SQL database?
The best solution depends on whether you plan to grow beyond a single server. In a load balanced configuration, InProc session state won’t work correctly (without using sticky sessions, which presents other problems). Out of proc session state, such as State Server or SQL Server, requires that your state information be serialized and deserialized for each page access. With multiple MB per user, that could be very slow.
Cache is another option, as suggested by Dave. One issue there might be whether the cache needs to be kept in sync from one web server to another.
The usual approach to this kind of problem is to store the data in the DB and in Cache, and to only retrieve it for those pages where it’s really needed (unlike Session, which is read for every page). Then use SqlDependency or SqlCacheDependency to cache the data in a way that it can be updated on multiple servers if the DB changes.